11cb0ef41Sopenharmony_ci// Copyright (c) 1994-2006 Sun Microsystems Inc. 21cb0ef41Sopenharmony_ci// All Rights Reserved. 31cb0ef41Sopenharmony_ci// 41cb0ef41Sopenharmony_ci// Redistribution and use in source and binary forms, with or without 51cb0ef41Sopenharmony_ci// modification, are permitted provided that the following conditions are 61cb0ef41Sopenharmony_ci// met: 71cb0ef41Sopenharmony_ci// 81cb0ef41Sopenharmony_ci// - Redistributions of source code must retain the above copyright notice, 91cb0ef41Sopenharmony_ci// this list of conditions and the following disclaimer. 101cb0ef41Sopenharmony_ci// 111cb0ef41Sopenharmony_ci// - Redistribution in binary form must reproduce the above copyright 121cb0ef41Sopenharmony_ci// notice, this list of conditions and the following disclaimer in the 131cb0ef41Sopenharmony_ci// documentation and/or other materials provided with the distribution. 141cb0ef41Sopenharmony_ci// 151cb0ef41Sopenharmony_ci// - Neither the name of Sun Microsystems or the names of contributors may 161cb0ef41Sopenharmony_ci// be used to endorse or promote products derived from this software without 171cb0ef41Sopenharmony_ci// specific prior written permission. 181cb0ef41Sopenharmony_ci// 191cb0ef41Sopenharmony_ci// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 201cb0ef41Sopenharmony_ci// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 211cb0ef41Sopenharmony_ci// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 221cb0ef41Sopenharmony_ci// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 231cb0ef41Sopenharmony_ci// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 241cb0ef41Sopenharmony_ci// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 251cb0ef41Sopenharmony_ci// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 261cb0ef41Sopenharmony_ci// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 271cb0ef41Sopenharmony_ci// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 281cb0ef41Sopenharmony_ci// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 291cb0ef41Sopenharmony_ci// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 301cb0ef41Sopenharmony_ci 311cb0ef41Sopenharmony_ci// The original source code covered by the above license above has been 321cb0ef41Sopenharmony_ci// modified significantly by Google Inc. 331cb0ef41Sopenharmony_ci// Copyright 2012 the V8 project authors. All rights reserved. 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ci#ifndef V8_CODEGEN_MIPS_ASSEMBLER_MIPS_H_ 361cb0ef41Sopenharmony_ci#define V8_CODEGEN_MIPS_ASSEMBLER_MIPS_H_ 371cb0ef41Sopenharmony_ci 381cb0ef41Sopenharmony_ci#include <stdio.h> 391cb0ef41Sopenharmony_ci#include <memory> 401cb0ef41Sopenharmony_ci 411cb0ef41Sopenharmony_ci#include <set> 421cb0ef41Sopenharmony_ci 431cb0ef41Sopenharmony_ci#include "src/codegen/assembler.h" 441cb0ef41Sopenharmony_ci#include "src/codegen/external-reference.h" 451cb0ef41Sopenharmony_ci#include "src/codegen/label.h" 461cb0ef41Sopenharmony_ci#include "src/codegen/mips/constants-mips.h" 471cb0ef41Sopenharmony_ci#include "src/codegen/mips/register-mips.h" 481cb0ef41Sopenharmony_ci#include "src/objects/smi.h" 491cb0ef41Sopenharmony_ci 501cb0ef41Sopenharmony_cinamespace v8 { 511cb0ef41Sopenharmony_cinamespace internal { 521cb0ef41Sopenharmony_ci 531cb0ef41Sopenharmony_ciclass SafepointTableBuilder; 541cb0ef41Sopenharmony_ci 551cb0ef41Sopenharmony_ci// Allow programmer to use Branch Delay Slot of Branches, Jumps, Calls. 561cb0ef41Sopenharmony_cienum BranchDelaySlot { USE_DELAY_SLOT, PROTECT }; 571cb0ef41Sopenharmony_ci 581cb0ef41Sopenharmony_ci// ----------------------------------------------------------------------------- 591cb0ef41Sopenharmony_ci// Machine instruction Operands. 601cb0ef41Sopenharmony_ci 611cb0ef41Sopenharmony_ci// Class Operand represents a shifter operand in data processing instructions. 621cb0ef41Sopenharmony_ciclass Operand { 631cb0ef41Sopenharmony_ci public: 641cb0ef41Sopenharmony_ci // Immediate. 651cb0ef41Sopenharmony_ci V8_INLINE explicit Operand(int32_t immediate, 661cb0ef41Sopenharmony_ci RelocInfo::Mode rmode = RelocInfo::NO_INFO) 671cb0ef41Sopenharmony_ci : rm_(no_reg), rmode_(rmode) { 681cb0ef41Sopenharmony_ci value_.immediate = immediate; 691cb0ef41Sopenharmony_ci } 701cb0ef41Sopenharmony_ci V8_INLINE explicit Operand(const ExternalReference& f) 711cb0ef41Sopenharmony_ci : rm_(no_reg), rmode_(RelocInfo::EXTERNAL_REFERENCE) { 721cb0ef41Sopenharmony_ci value_.immediate = static_cast<int32_t>(f.address()); 731cb0ef41Sopenharmony_ci } 741cb0ef41Sopenharmony_ci V8_INLINE explicit Operand(const char* s); 751cb0ef41Sopenharmony_ci explicit Operand(Handle<HeapObject> handle); 761cb0ef41Sopenharmony_ci V8_INLINE explicit Operand(Smi value) 771cb0ef41Sopenharmony_ci : rm_(no_reg), rmode_(RelocInfo::NO_INFO) { 781cb0ef41Sopenharmony_ci value_.immediate = static_cast<intptr_t>(value.ptr()); 791cb0ef41Sopenharmony_ci } 801cb0ef41Sopenharmony_ci 811cb0ef41Sopenharmony_ci static Operand EmbeddedNumber(double number); // Smi or HeapNumber. 821cb0ef41Sopenharmony_ci static Operand EmbeddedStringConstant(const StringConstantBase* str); 831cb0ef41Sopenharmony_ci 841cb0ef41Sopenharmony_ci // Register. 851cb0ef41Sopenharmony_ci V8_INLINE explicit Operand(Register rm) : rm_(rm) {} 861cb0ef41Sopenharmony_ci 871cb0ef41Sopenharmony_ci // Return true if this is a register operand. 881cb0ef41Sopenharmony_ci V8_INLINE bool is_reg() const; 891cb0ef41Sopenharmony_ci 901cb0ef41Sopenharmony_ci inline int32_t immediate() const; 911cb0ef41Sopenharmony_ci 921cb0ef41Sopenharmony_ci bool IsImmediate() const { return !rm_.is_valid(); } 931cb0ef41Sopenharmony_ci 941cb0ef41Sopenharmony_ci HeapObjectRequest heap_object_request() const { 951cb0ef41Sopenharmony_ci DCHECK(IsHeapObjectRequest()); 961cb0ef41Sopenharmony_ci return value_.heap_object_request; 971cb0ef41Sopenharmony_ci } 981cb0ef41Sopenharmony_ci 991cb0ef41Sopenharmony_ci bool IsHeapObjectRequest() const { 1001cb0ef41Sopenharmony_ci DCHECK_IMPLIES(is_heap_object_request_, IsImmediate()); 1011cb0ef41Sopenharmony_ci DCHECK_IMPLIES(is_heap_object_request_, 1021cb0ef41Sopenharmony_ci rmode_ == RelocInfo::FULL_EMBEDDED_OBJECT || 1031cb0ef41Sopenharmony_ci rmode_ == RelocInfo::CODE_TARGET); 1041cb0ef41Sopenharmony_ci return is_heap_object_request_; 1051cb0ef41Sopenharmony_ci } 1061cb0ef41Sopenharmony_ci 1071cb0ef41Sopenharmony_ci Register rm() const { return rm_; } 1081cb0ef41Sopenharmony_ci 1091cb0ef41Sopenharmony_ci RelocInfo::Mode rmode() const { return rmode_; } 1101cb0ef41Sopenharmony_ci 1111cb0ef41Sopenharmony_ci private: 1121cb0ef41Sopenharmony_ci Register rm_; 1131cb0ef41Sopenharmony_ci union Value { 1141cb0ef41Sopenharmony_ci Value() {} 1151cb0ef41Sopenharmony_ci HeapObjectRequest heap_object_request; // if is_heap_object_request_ 1161cb0ef41Sopenharmony_ci int32_t immediate; // otherwise 1171cb0ef41Sopenharmony_ci } value_; // valid if rm_ == no_reg 1181cb0ef41Sopenharmony_ci bool is_heap_object_request_ = false; 1191cb0ef41Sopenharmony_ci RelocInfo::Mode rmode_; 1201cb0ef41Sopenharmony_ci 1211cb0ef41Sopenharmony_ci friend class Assembler; 1221cb0ef41Sopenharmony_ci // friend class MacroAssembler; 1231cb0ef41Sopenharmony_ci}; 1241cb0ef41Sopenharmony_ci 1251cb0ef41Sopenharmony_ci// On MIPS we have only one addressing mode with base_reg + offset. 1261cb0ef41Sopenharmony_ci// Class MemOperand represents a memory operand in load and store instructions. 1271cb0ef41Sopenharmony_ciclass V8_EXPORT_PRIVATE MemOperand : public Operand { 1281cb0ef41Sopenharmony_ci public: 1291cb0ef41Sopenharmony_ci // Immediate value attached to offset. 1301cb0ef41Sopenharmony_ci enum OffsetAddend { offset_minus_one = -1, offset_zero = 0 }; 1311cb0ef41Sopenharmony_ci 1321cb0ef41Sopenharmony_ci explicit MemOperand(Register rn, int32_t offset = 0); 1331cb0ef41Sopenharmony_ci explicit MemOperand(Register rn, int32_t unit, int32_t multiplier, 1341cb0ef41Sopenharmony_ci OffsetAddend offset_addend = offset_zero); 1351cb0ef41Sopenharmony_ci int32_t offset() const { return offset_; } 1361cb0ef41Sopenharmony_ci 1371cb0ef41Sopenharmony_ci bool OffsetIsInt16Encodable() const { return is_int16(offset_); } 1381cb0ef41Sopenharmony_ci 1391cb0ef41Sopenharmony_ci private: 1401cb0ef41Sopenharmony_ci int32_t offset_; 1411cb0ef41Sopenharmony_ci 1421cb0ef41Sopenharmony_ci friend class Assembler; 1431cb0ef41Sopenharmony_ci}; 1441cb0ef41Sopenharmony_ci 1451cb0ef41Sopenharmony_ciclass V8_EXPORT_PRIVATE Assembler : public AssemblerBase { 1461cb0ef41Sopenharmony_ci public: 1471cb0ef41Sopenharmony_ci // Create an assembler. Instructions and relocation information are emitted 1481cb0ef41Sopenharmony_ci // into a buffer, with the instructions starting from the beginning and the 1491cb0ef41Sopenharmony_ci // relocation information starting from the end of the buffer. See CodeDesc 1501cb0ef41Sopenharmony_ci // for a detailed comment on the layout (globals.h). 1511cb0ef41Sopenharmony_ci // 1521cb0ef41Sopenharmony_ci // If the provided buffer is nullptr, the assembler allocates and grows its 1531cb0ef41Sopenharmony_ci // own buffer. Otherwise it takes ownership of the provided buffer. 1541cb0ef41Sopenharmony_ci explicit Assembler(const AssemblerOptions&, 1551cb0ef41Sopenharmony_ci std::unique_ptr<AssemblerBuffer> = {}); 1561cb0ef41Sopenharmony_ci 1571cb0ef41Sopenharmony_ci virtual ~Assembler() {} 1581cb0ef41Sopenharmony_ci 1591cb0ef41Sopenharmony_ci // GetCode emits any pending (non-emitted) code and fills the descriptor desc. 1601cb0ef41Sopenharmony_ci static constexpr int kNoHandlerTable = 0; 1611cb0ef41Sopenharmony_ci static constexpr SafepointTableBuilder* kNoSafepointTable = nullptr; 1621cb0ef41Sopenharmony_ci void GetCode(Isolate* isolate, CodeDesc* desc, 1631cb0ef41Sopenharmony_ci SafepointTableBuilder* safepoint_table_builder, 1641cb0ef41Sopenharmony_ci int handler_table_offset); 1651cb0ef41Sopenharmony_ci 1661cb0ef41Sopenharmony_ci // Convenience wrapper for code without safepoint or handler tables. 1671cb0ef41Sopenharmony_ci void GetCode(Isolate* isolate, CodeDesc* desc) { 1681cb0ef41Sopenharmony_ci GetCode(isolate, desc, kNoSafepointTable, kNoHandlerTable); 1691cb0ef41Sopenharmony_ci } 1701cb0ef41Sopenharmony_ci 1711cb0ef41Sopenharmony_ci // Unused on this architecture. 1721cb0ef41Sopenharmony_ci void MaybeEmitOutOfLineConstantPool() {} 1731cb0ef41Sopenharmony_ci 1741cb0ef41Sopenharmony_ci // Mips uses BlockTrampolinePool to prevent generating trampoline inside a 1751cb0ef41Sopenharmony_ci // continuous instruction block. For Call instrution, it prevents generating 1761cb0ef41Sopenharmony_ci // trampoline between jalr and delay slot instruction. In the destructor of 1771cb0ef41Sopenharmony_ci // BlockTrampolinePool, it must check if it needs to generate trampoline 1781cb0ef41Sopenharmony_ci // immediately, if it does not do this, the branch range will go beyond the 1791cb0ef41Sopenharmony_ci // max branch offset, that means the pc_offset after call CheckTrampolinePool 1801cb0ef41Sopenharmony_ci // may have changed. So we use pc_for_safepoint_ here for safepoint record. 1811cb0ef41Sopenharmony_ci int pc_offset_for_safepoint() { 1821cb0ef41Sopenharmony_ci return static_cast<int>(pc_for_safepoint_ - buffer_start_); 1831cb0ef41Sopenharmony_ci } 1841cb0ef41Sopenharmony_ci 1851cb0ef41Sopenharmony_ci // Label operations & relative jumps (PPUM Appendix D). 1861cb0ef41Sopenharmony_ci // 1871cb0ef41Sopenharmony_ci // Takes a branch opcode (cc) and a label (L) and generates 1881cb0ef41Sopenharmony_ci // either a backward branch or a forward branch and links it 1891cb0ef41Sopenharmony_ci // to the label fixup chain. Usage: 1901cb0ef41Sopenharmony_ci // 1911cb0ef41Sopenharmony_ci // Label L; // unbound label 1921cb0ef41Sopenharmony_ci // j(cc, &L); // forward branch to unbound label 1931cb0ef41Sopenharmony_ci // bind(&L); // bind label to the current pc 1941cb0ef41Sopenharmony_ci // j(cc, &L); // backward branch to bound label 1951cb0ef41Sopenharmony_ci // bind(&L); // illegal: a label may be bound only once 1961cb0ef41Sopenharmony_ci // 1971cb0ef41Sopenharmony_ci // Note: The same Label can be used for forward and backward branches 1981cb0ef41Sopenharmony_ci // but it may be bound only once. 1991cb0ef41Sopenharmony_ci void bind(Label* L); // Binds an unbound label L to current code position. 2001cb0ef41Sopenharmony_ci 2011cb0ef41Sopenharmony_ci enum OffsetSize : int { kOffset26 = 26, kOffset21 = 21, kOffset16 = 16 }; 2021cb0ef41Sopenharmony_ci 2031cb0ef41Sopenharmony_ci // Determines if Label is bound and near enough so that branch instruction 2041cb0ef41Sopenharmony_ci // can be used to reach it, instead of jump instruction. 2051cb0ef41Sopenharmony_ci bool is_near(Label* L); 2061cb0ef41Sopenharmony_ci bool is_near(Label* L, OffsetSize bits); 2071cb0ef41Sopenharmony_ci bool is_near_branch(Label* L); 2081cb0ef41Sopenharmony_ci inline bool is_near_pre_r6(Label* L) { 2091cb0ef41Sopenharmony_ci DCHECK(!IsMipsArchVariant(kMips32r6)); 2101cb0ef41Sopenharmony_ci return pc_offset() - L->pos() < kMaxBranchOffset - 4 * kInstrSize; 2111cb0ef41Sopenharmony_ci } 2121cb0ef41Sopenharmony_ci inline bool is_near_r6(Label* L) { 2131cb0ef41Sopenharmony_ci DCHECK(IsMipsArchVariant(kMips32r6)); 2141cb0ef41Sopenharmony_ci return pc_offset() - L->pos() < kMaxCompactBranchOffset - 4 * kInstrSize; 2151cb0ef41Sopenharmony_ci } 2161cb0ef41Sopenharmony_ci 2171cb0ef41Sopenharmony_ci int BranchOffset(Instr instr); 2181cb0ef41Sopenharmony_ci 2191cb0ef41Sopenharmony_ci // Returns the branch offset to the given label from the current code 2201cb0ef41Sopenharmony_ci // position. Links the label to the current position if it is still unbound. 2211cb0ef41Sopenharmony_ci // Manages the jump elimination optimization if the second parameter is true. 2221cb0ef41Sopenharmony_ci int32_t branch_offset_helper(Label* L, OffsetSize bits); 2231cb0ef41Sopenharmony_ci inline int32_t branch_offset(Label* L) { 2241cb0ef41Sopenharmony_ci return branch_offset_helper(L, OffsetSize::kOffset16); 2251cb0ef41Sopenharmony_ci } 2261cb0ef41Sopenharmony_ci inline int32_t branch_offset21(Label* L) { 2271cb0ef41Sopenharmony_ci return branch_offset_helper(L, OffsetSize::kOffset21); 2281cb0ef41Sopenharmony_ci } 2291cb0ef41Sopenharmony_ci inline int32_t branch_offset26(Label* L) { 2301cb0ef41Sopenharmony_ci return branch_offset_helper(L, OffsetSize::kOffset26); 2311cb0ef41Sopenharmony_ci } 2321cb0ef41Sopenharmony_ci inline int32_t shifted_branch_offset(Label* L) { 2331cb0ef41Sopenharmony_ci return branch_offset(L) >> 2; 2341cb0ef41Sopenharmony_ci } 2351cb0ef41Sopenharmony_ci inline int32_t shifted_branch_offset21(Label* L) { 2361cb0ef41Sopenharmony_ci return branch_offset21(L) >> 2; 2371cb0ef41Sopenharmony_ci } 2381cb0ef41Sopenharmony_ci inline int32_t shifted_branch_offset26(Label* L) { 2391cb0ef41Sopenharmony_ci return branch_offset26(L) >> 2; 2401cb0ef41Sopenharmony_ci } 2411cb0ef41Sopenharmony_ci uint32_t jump_address(Label* L); 2421cb0ef41Sopenharmony_ci uint32_t branch_long_offset(Label* L); 2431cb0ef41Sopenharmony_ci 2441cb0ef41Sopenharmony_ci // Puts a labels target address at the given position. 2451cb0ef41Sopenharmony_ci // The high 8 bits are set to zero. 2461cb0ef41Sopenharmony_ci void label_at_put(Label* L, int at_offset); 2471cb0ef41Sopenharmony_ci 2481cb0ef41Sopenharmony_ci // Read/Modify the code target address in the branch/call instruction at pc. 2491cb0ef41Sopenharmony_ci // The isolate argument is unused (and may be nullptr) when skipping flushing. 2501cb0ef41Sopenharmony_ci static Address target_address_at(Address pc); 2511cb0ef41Sopenharmony_ci V8_INLINE static void set_target_address_at( 2521cb0ef41Sopenharmony_ci Address pc, Address target, 2531cb0ef41Sopenharmony_ci ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED) { 2541cb0ef41Sopenharmony_ci set_target_value_at(pc, static_cast<uint32_t>(target), icache_flush_mode); 2551cb0ef41Sopenharmony_ci } 2561cb0ef41Sopenharmony_ci // On MIPS there is no Constant Pool so we skip that parameter. 2571cb0ef41Sopenharmony_ci V8_INLINE static Address target_address_at(Address pc, 2581cb0ef41Sopenharmony_ci Address constant_pool) { 2591cb0ef41Sopenharmony_ci return target_address_at(pc); 2601cb0ef41Sopenharmony_ci } 2611cb0ef41Sopenharmony_ci V8_INLINE static void set_target_address_at( 2621cb0ef41Sopenharmony_ci Address pc, Address constant_pool, Address target, 2631cb0ef41Sopenharmony_ci ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED) { 2641cb0ef41Sopenharmony_ci set_target_address_at(pc, target, icache_flush_mode); 2651cb0ef41Sopenharmony_ci } 2661cb0ef41Sopenharmony_ci 2671cb0ef41Sopenharmony_ci static void set_target_value_at( 2681cb0ef41Sopenharmony_ci Address pc, uint32_t target, 2691cb0ef41Sopenharmony_ci ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED); 2701cb0ef41Sopenharmony_ci 2711cb0ef41Sopenharmony_ci // This sets the branch destination (which gets loaded at the call address). 2721cb0ef41Sopenharmony_ci // This is for calls and branches within generated code. The serializer 2731cb0ef41Sopenharmony_ci // has already deserialized the lui/ori instructions etc. 2741cb0ef41Sopenharmony_ci inline static void deserialization_set_special_target_at( 2751cb0ef41Sopenharmony_ci Address instruction_payload, Code code, Address target); 2761cb0ef41Sopenharmony_ci 2771cb0ef41Sopenharmony_ci // Get the size of the special target encoded at 'instruction_payload'. 2781cb0ef41Sopenharmony_ci inline static int deserialization_special_target_size( 2791cb0ef41Sopenharmony_ci Address instruction_payload); 2801cb0ef41Sopenharmony_ci 2811cb0ef41Sopenharmony_ci // This sets the internal reference at the pc. 2821cb0ef41Sopenharmony_ci inline static void deserialization_set_target_internal_reference_at( 2831cb0ef41Sopenharmony_ci Address pc, Address target, 2841cb0ef41Sopenharmony_ci RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE); 2851cb0ef41Sopenharmony_ci 2861cb0ef41Sopenharmony_ci // Difference between address of current opcode and target address offset. 2871cb0ef41Sopenharmony_ci static constexpr int kBranchPCOffset = kInstrSize; 2881cb0ef41Sopenharmony_ci 2891cb0ef41Sopenharmony_ci // Difference between address of current opcode and target address offset, 2901cb0ef41Sopenharmony_ci // when we are generatinga sequence of instructions for long relative PC 2911cb0ef41Sopenharmony_ci // branches. It is distance between address of the first instruction in 2921cb0ef41Sopenharmony_ci // the jump sequence, and the value that ra gets after calling nal(). 2931cb0ef41Sopenharmony_ci static constexpr int kLongBranchPCOffset = 3 * kInstrSize; 2941cb0ef41Sopenharmony_ci 2951cb0ef41Sopenharmony_ci // Adjust ra register in branch delay slot of bal instruction in order to skip 2961cb0ef41Sopenharmony_ci // instructions not needed after optimization of PIC in 2971cb0ef41Sopenharmony_ci // TurboAssembler::BranchAndLink method. 2981cb0ef41Sopenharmony_ci static constexpr int kOptimizedBranchAndLinkLongReturnOffset = 3 * kInstrSize; 2991cb0ef41Sopenharmony_ci 3001cb0ef41Sopenharmony_ci // Offset of target relative address in calls/jumps for builtins. It is 3011cb0ef41Sopenharmony_ci // distance between instruction that is placed just after calling 3021cb0ef41Sopenharmony_ci // RecordRelocInfo, and the value that ra gets aftr calling nal(). 3031cb0ef41Sopenharmony_ci static constexpr int kRelativeJumpForBuiltinsOffset = 1 * kInstrSize; 3041cb0ef41Sopenharmony_ci // Relative target address of jumps for builtins when we use lui, ori, dsll, 3051cb0ef41Sopenharmony_ci // ori sequence when loading address that cannot fit into 32 bits. 3061cb0ef41Sopenharmony_ci static constexpr int kRelativeCallForBuiltinsOffset = 3 * kInstrSize; 3071cb0ef41Sopenharmony_ci 3081cb0ef41Sopenharmony_ci // Here we are patching the address in the LUI/ORI instruction pair. 3091cb0ef41Sopenharmony_ci // These values are used in the serialization process and must be zero for 3101cb0ef41Sopenharmony_ci // MIPS platform, as Code, Embedded Object or External-reference pointers 3111cb0ef41Sopenharmony_ci // are split across two consecutive instructions and don't exist separately 3121cb0ef41Sopenharmony_ci // in the code, so the serializer should not step forwards in memory after 3131cb0ef41Sopenharmony_ci // a target is resolved and written. 3141cb0ef41Sopenharmony_ci 3151cb0ef41Sopenharmony_ci static constexpr int kSpecialTargetSize = 0; 3161cb0ef41Sopenharmony_ci 3171cb0ef41Sopenharmony_ci // Number of consecutive instructions used to store 32bit constant. This 3181cb0ef41Sopenharmony_ci // constant is used in RelocInfo::target_address_address() function to tell 3191cb0ef41Sopenharmony_ci // serializer address of the instruction that follows LUI/ORI instruction 3201cb0ef41Sopenharmony_ci // pair. 3211cb0ef41Sopenharmony_ci static constexpr int kInstructionsFor32BitConstant = 2; 3221cb0ef41Sopenharmony_ci 3231cb0ef41Sopenharmony_ci // Max offset for instructions with 16-bit offset field 3241cb0ef41Sopenharmony_ci static constexpr int kMaxBranchOffset = (1 << (18 - 1)) - 1; 3251cb0ef41Sopenharmony_ci 3261cb0ef41Sopenharmony_ci // Max offset for compact branch instructions with 26-bit offset field 3271cb0ef41Sopenharmony_ci static constexpr int kMaxCompactBranchOffset = (1 << (28 - 1)) - 1; 3281cb0ef41Sopenharmony_ci 3291cb0ef41Sopenharmony_ci static constexpr int kTrampolineSlotsSize = 3301cb0ef41Sopenharmony_ci IsMipsArchVariant(kMips32r6) ? 2 * kInstrSize : 7 * kInstrSize; 3311cb0ef41Sopenharmony_ci 3321cb0ef41Sopenharmony_ci RegList* GetScratchRegisterList() { return &scratch_register_list_; } 3331cb0ef41Sopenharmony_ci 3341cb0ef41Sopenharmony_ci // --------------------------------------------------------------------------- 3351cb0ef41Sopenharmony_ci // Code generation. 3361cb0ef41Sopenharmony_ci 3371cb0ef41Sopenharmony_ci // Insert the smallest number of nop instructions 3381cb0ef41Sopenharmony_ci // possible to align the pc offset to a multiple 3391cb0ef41Sopenharmony_ci // of m. m must be a power of 2 (>= 4). 3401cb0ef41Sopenharmony_ci void Align(int m); 3411cb0ef41Sopenharmony_ci // Insert the smallest number of zero bytes possible to align the pc offset 3421cb0ef41Sopenharmony_ci // to a mulitple of m. m must be a power of 2 (>= 2). 3431cb0ef41Sopenharmony_ci void DataAlign(int m); 3441cb0ef41Sopenharmony_ci // Aligns code to something that's optimal for a jump target for the platform. 3451cb0ef41Sopenharmony_ci void CodeTargetAlign(); 3461cb0ef41Sopenharmony_ci void LoopHeaderAlign() { CodeTargetAlign(); } 3471cb0ef41Sopenharmony_ci 3481cb0ef41Sopenharmony_ci // Different nop operations are used by the code generator to detect certain 3491cb0ef41Sopenharmony_ci // states of the generated code. 3501cb0ef41Sopenharmony_ci enum NopMarkerTypes { 3511cb0ef41Sopenharmony_ci NON_MARKING_NOP = 0, 3521cb0ef41Sopenharmony_ci DEBUG_BREAK_NOP, 3531cb0ef41Sopenharmony_ci // IC markers. 3541cb0ef41Sopenharmony_ci PROPERTY_ACCESS_INLINED, 3551cb0ef41Sopenharmony_ci PROPERTY_ACCESS_INLINED_CONTEXT, 3561cb0ef41Sopenharmony_ci PROPERTY_ACCESS_INLINED_CONTEXT_DONT_DELETE, 3571cb0ef41Sopenharmony_ci // Helper values. 3581cb0ef41Sopenharmony_ci LAST_CODE_MARKER, 3591cb0ef41Sopenharmony_ci FIRST_IC_MARKER = PROPERTY_ACCESS_INLINED, 3601cb0ef41Sopenharmony_ci }; 3611cb0ef41Sopenharmony_ci 3621cb0ef41Sopenharmony_ci // Type == 0 is the default non-marking nop. For mips this is a 3631cb0ef41Sopenharmony_ci // sll(zero_reg, zero_reg, 0). We use rt_reg == at for non-zero 3641cb0ef41Sopenharmony_ci // marking, to avoid conflict with ssnop and ehb instructions. 3651cb0ef41Sopenharmony_ci void nop(unsigned int type = 0) { 3661cb0ef41Sopenharmony_ci DCHECK_LT(type, 32); 3671cb0ef41Sopenharmony_ci Register nop_rt_reg = (type == 0) ? zero_reg : at; 3681cb0ef41Sopenharmony_ci sll(zero_reg, nop_rt_reg, type, true); 3691cb0ef41Sopenharmony_ci } 3701cb0ef41Sopenharmony_ci 3711cb0ef41Sopenharmony_ci // --------Branch-and-jump-instructions---------- 3721cb0ef41Sopenharmony_ci // We don't use likely variant of instructions. 3731cb0ef41Sopenharmony_ci void b(int16_t offset); 3741cb0ef41Sopenharmony_ci inline void b(Label* L) { b(shifted_branch_offset(L)); } 3751cb0ef41Sopenharmony_ci void bal(int16_t offset); 3761cb0ef41Sopenharmony_ci inline void bal(Label* L) { bal(shifted_branch_offset(L)); } 3771cb0ef41Sopenharmony_ci void bc(int32_t offset); 3781cb0ef41Sopenharmony_ci inline void bc(Label* L) { bc(shifted_branch_offset26(L)); } 3791cb0ef41Sopenharmony_ci void balc(int32_t offset); 3801cb0ef41Sopenharmony_ci inline void balc(Label* L) { balc(shifted_branch_offset26(L)); } 3811cb0ef41Sopenharmony_ci 3821cb0ef41Sopenharmony_ci void beq(Register rs, Register rt, int16_t offset); 3831cb0ef41Sopenharmony_ci inline void beq(Register rs, Register rt, Label* L) { 3841cb0ef41Sopenharmony_ci beq(rs, rt, shifted_branch_offset(L)); 3851cb0ef41Sopenharmony_ci } 3861cb0ef41Sopenharmony_ci void bgez(Register rs, int16_t offset); 3871cb0ef41Sopenharmony_ci void bgezc(Register rt, int16_t offset); 3881cb0ef41Sopenharmony_ci inline void bgezc(Register rt, Label* L) { 3891cb0ef41Sopenharmony_ci bgezc(rt, shifted_branch_offset(L)); 3901cb0ef41Sopenharmony_ci } 3911cb0ef41Sopenharmony_ci void bgeuc(Register rs, Register rt, int16_t offset); 3921cb0ef41Sopenharmony_ci inline void bgeuc(Register rs, Register rt, Label* L) { 3931cb0ef41Sopenharmony_ci bgeuc(rs, rt, shifted_branch_offset(L)); 3941cb0ef41Sopenharmony_ci } 3951cb0ef41Sopenharmony_ci void bgec(Register rs, Register rt, int16_t offset); 3961cb0ef41Sopenharmony_ci inline void bgec(Register rs, Register rt, Label* L) { 3971cb0ef41Sopenharmony_ci bgec(rs, rt, shifted_branch_offset(L)); 3981cb0ef41Sopenharmony_ci } 3991cb0ef41Sopenharmony_ci void bgezal(Register rs, int16_t offset); 4001cb0ef41Sopenharmony_ci void bgezalc(Register rt, int16_t offset); 4011cb0ef41Sopenharmony_ci inline void bgezalc(Register rt, Label* L) { 4021cb0ef41Sopenharmony_ci bgezalc(rt, shifted_branch_offset(L)); 4031cb0ef41Sopenharmony_ci } 4041cb0ef41Sopenharmony_ci void bgezall(Register rs, int16_t offset); 4051cb0ef41Sopenharmony_ci inline void bgezall(Register rs, Label* L) { 4061cb0ef41Sopenharmony_ci bgezall(rs, branch_offset(L) >> 2); 4071cb0ef41Sopenharmony_ci } 4081cb0ef41Sopenharmony_ci void bgtz(Register rs, int16_t offset); 4091cb0ef41Sopenharmony_ci void bgtzc(Register rt, int16_t offset); 4101cb0ef41Sopenharmony_ci inline void bgtzc(Register rt, Label* L) { 4111cb0ef41Sopenharmony_ci bgtzc(rt, shifted_branch_offset(L)); 4121cb0ef41Sopenharmony_ci } 4131cb0ef41Sopenharmony_ci void blez(Register rs, int16_t offset); 4141cb0ef41Sopenharmony_ci void blezc(Register rt, int16_t offset); 4151cb0ef41Sopenharmony_ci inline void blezc(Register rt, Label* L) { 4161cb0ef41Sopenharmony_ci blezc(rt, shifted_branch_offset(L)); 4171cb0ef41Sopenharmony_ci } 4181cb0ef41Sopenharmony_ci void bltz(Register rs, int16_t offset); 4191cb0ef41Sopenharmony_ci void bltzc(Register rt, int16_t offset); 4201cb0ef41Sopenharmony_ci inline void bltzc(Register rt, Label* L) { 4211cb0ef41Sopenharmony_ci bltzc(rt, shifted_branch_offset(L)); 4221cb0ef41Sopenharmony_ci } 4231cb0ef41Sopenharmony_ci void bltuc(Register rs, Register rt, int16_t offset); 4241cb0ef41Sopenharmony_ci inline void bltuc(Register rs, Register rt, Label* L) { 4251cb0ef41Sopenharmony_ci bltuc(rs, rt, shifted_branch_offset(L)); 4261cb0ef41Sopenharmony_ci } 4271cb0ef41Sopenharmony_ci void bltc(Register rs, Register rt, int16_t offset); 4281cb0ef41Sopenharmony_ci inline void bltc(Register rs, Register rt, Label* L) { 4291cb0ef41Sopenharmony_ci bltc(rs, rt, shifted_branch_offset(L)); 4301cb0ef41Sopenharmony_ci } 4311cb0ef41Sopenharmony_ci void bltzal(Register rs, int16_t offset); 4321cb0ef41Sopenharmony_ci void nal() { bltzal(zero_reg, 0); } 4331cb0ef41Sopenharmony_ci void blezalc(Register rt, int16_t offset); 4341cb0ef41Sopenharmony_ci inline void blezalc(Register rt, Label* L) { 4351cb0ef41Sopenharmony_ci blezalc(rt, shifted_branch_offset(L)); 4361cb0ef41Sopenharmony_ci } 4371cb0ef41Sopenharmony_ci void bltzalc(Register rt, int16_t offset); 4381cb0ef41Sopenharmony_ci inline void bltzalc(Register rt, Label* L) { 4391cb0ef41Sopenharmony_ci bltzalc(rt, shifted_branch_offset(L)); 4401cb0ef41Sopenharmony_ci } 4411cb0ef41Sopenharmony_ci void bgtzalc(Register rt, int16_t offset); 4421cb0ef41Sopenharmony_ci inline void bgtzalc(Register rt, Label* L) { 4431cb0ef41Sopenharmony_ci bgtzalc(rt, shifted_branch_offset(L)); 4441cb0ef41Sopenharmony_ci } 4451cb0ef41Sopenharmony_ci void beqzalc(Register rt, int16_t offset); 4461cb0ef41Sopenharmony_ci inline void beqzalc(Register rt, Label* L) { 4471cb0ef41Sopenharmony_ci beqzalc(rt, shifted_branch_offset(L)); 4481cb0ef41Sopenharmony_ci } 4491cb0ef41Sopenharmony_ci void beqc(Register rs, Register rt, int16_t offset); 4501cb0ef41Sopenharmony_ci inline void beqc(Register rs, Register rt, Label* L) { 4511cb0ef41Sopenharmony_ci beqc(rs, rt, shifted_branch_offset(L)); 4521cb0ef41Sopenharmony_ci } 4531cb0ef41Sopenharmony_ci void beqzc(Register rs, int32_t offset); 4541cb0ef41Sopenharmony_ci inline void beqzc(Register rs, Label* L) { 4551cb0ef41Sopenharmony_ci beqzc(rs, shifted_branch_offset21(L)); 4561cb0ef41Sopenharmony_ci } 4571cb0ef41Sopenharmony_ci void bnezalc(Register rt, int16_t offset); 4581cb0ef41Sopenharmony_ci inline void bnezalc(Register rt, Label* L) { 4591cb0ef41Sopenharmony_ci bnezalc(rt, shifted_branch_offset(L)); 4601cb0ef41Sopenharmony_ci } 4611cb0ef41Sopenharmony_ci void bnec(Register rs, Register rt, int16_t offset); 4621cb0ef41Sopenharmony_ci inline void bnec(Register rs, Register rt, Label* L) { 4631cb0ef41Sopenharmony_ci bnec(rs, rt, shifted_branch_offset(L)); 4641cb0ef41Sopenharmony_ci } 4651cb0ef41Sopenharmony_ci void bnezc(Register rt, int32_t offset); 4661cb0ef41Sopenharmony_ci inline void bnezc(Register rt, Label* L) { 4671cb0ef41Sopenharmony_ci bnezc(rt, shifted_branch_offset21(L)); 4681cb0ef41Sopenharmony_ci } 4691cb0ef41Sopenharmony_ci void bne(Register rs, Register rt, int16_t offset); 4701cb0ef41Sopenharmony_ci inline void bne(Register rs, Register rt, Label* L) { 4711cb0ef41Sopenharmony_ci bne(rs, rt, shifted_branch_offset(L)); 4721cb0ef41Sopenharmony_ci } 4731cb0ef41Sopenharmony_ci void bovc(Register rs, Register rt, int16_t offset); 4741cb0ef41Sopenharmony_ci inline void bovc(Register rs, Register rt, Label* L) { 4751cb0ef41Sopenharmony_ci bovc(rs, rt, shifted_branch_offset(L)); 4761cb0ef41Sopenharmony_ci } 4771cb0ef41Sopenharmony_ci void bnvc(Register rs, Register rt, int16_t offset); 4781cb0ef41Sopenharmony_ci inline void bnvc(Register rs, Register rt, Label* L) { 4791cb0ef41Sopenharmony_ci bnvc(rs, rt, shifted_branch_offset(L)); 4801cb0ef41Sopenharmony_ci } 4811cb0ef41Sopenharmony_ci 4821cb0ef41Sopenharmony_ci // Never use the int16_t b(l)cond version with a branch offset 4831cb0ef41Sopenharmony_ci // instead of using the Label* version. 4841cb0ef41Sopenharmony_ci 4851cb0ef41Sopenharmony_ci // Jump targets must be in the current 256 MB-aligned region. i.e. 28 bits. 4861cb0ef41Sopenharmony_ci void j(int32_t target); 4871cb0ef41Sopenharmony_ci void jal(int32_t target); 4881cb0ef41Sopenharmony_ci void jalr(Register rs, Register rd = ra); 4891cb0ef41Sopenharmony_ci void jr(Register target); 4901cb0ef41Sopenharmony_ci void jic(Register rt, int16_t offset); 4911cb0ef41Sopenharmony_ci void jialc(Register rt, int16_t offset); 4921cb0ef41Sopenharmony_ci 4931cb0ef41Sopenharmony_ci // -------Data-processing-instructions--------- 4941cb0ef41Sopenharmony_ci 4951cb0ef41Sopenharmony_ci // Arithmetic. 4961cb0ef41Sopenharmony_ci void addu(Register rd, Register rs, Register rt); 4971cb0ef41Sopenharmony_ci void subu(Register rd, Register rs, Register rt); 4981cb0ef41Sopenharmony_ci void mult(Register rs, Register rt); 4991cb0ef41Sopenharmony_ci void multu(Register rs, Register rt); 5001cb0ef41Sopenharmony_ci void div(Register rs, Register rt); 5011cb0ef41Sopenharmony_ci void divu(Register rs, Register rt); 5021cb0ef41Sopenharmony_ci void div(Register rd, Register rs, Register rt); 5031cb0ef41Sopenharmony_ci void divu(Register rd, Register rs, Register rt); 5041cb0ef41Sopenharmony_ci void mod(Register rd, Register rs, Register rt); 5051cb0ef41Sopenharmony_ci void modu(Register rd, Register rs, Register rt); 5061cb0ef41Sopenharmony_ci void mul(Register rd, Register rs, Register rt); 5071cb0ef41Sopenharmony_ci void muh(Register rd, Register rs, Register rt); 5081cb0ef41Sopenharmony_ci void mulu(Register rd, Register rs, Register rt); 5091cb0ef41Sopenharmony_ci void muhu(Register rd, Register rs, Register rt); 5101cb0ef41Sopenharmony_ci 5111cb0ef41Sopenharmony_ci void addiu(Register rd, Register rs, int32_t j); 5121cb0ef41Sopenharmony_ci 5131cb0ef41Sopenharmony_ci // Logical. 5141cb0ef41Sopenharmony_ci void and_(Register rd, Register rs, Register rt); 5151cb0ef41Sopenharmony_ci void or_(Register rd, Register rs, Register rt); 5161cb0ef41Sopenharmony_ci void xor_(Register rd, Register rs, Register rt); 5171cb0ef41Sopenharmony_ci void nor(Register rd, Register rs, Register rt); 5181cb0ef41Sopenharmony_ci 5191cb0ef41Sopenharmony_ci void andi(Register rd, Register rs, int32_t j); 5201cb0ef41Sopenharmony_ci void ori(Register rd, Register rs, int32_t j); 5211cb0ef41Sopenharmony_ci void xori(Register rd, Register rs, int32_t j); 5221cb0ef41Sopenharmony_ci void lui(Register rd, int32_t j); 5231cb0ef41Sopenharmony_ci void aui(Register rs, Register rt, int32_t j); 5241cb0ef41Sopenharmony_ci 5251cb0ef41Sopenharmony_ci // Shifts. 5261cb0ef41Sopenharmony_ci // Please note: sll(zero_reg, zero_reg, x) instructions are reserved as nop 5271cb0ef41Sopenharmony_ci // and may cause problems in normal code. coming_from_nop makes sure this 5281cb0ef41Sopenharmony_ci // doesn't happen. 5291cb0ef41Sopenharmony_ci void sll(Register rd, Register rt, uint16_t sa, bool coming_from_nop = false); 5301cb0ef41Sopenharmony_ci void sllv(Register rd, Register rt, Register rs); 5311cb0ef41Sopenharmony_ci void srl(Register rd, Register rt, uint16_t sa); 5321cb0ef41Sopenharmony_ci void srlv(Register rd, Register rt, Register rs); 5331cb0ef41Sopenharmony_ci void sra(Register rt, Register rd, uint16_t sa); 5341cb0ef41Sopenharmony_ci void srav(Register rt, Register rd, Register rs); 5351cb0ef41Sopenharmony_ci void rotr(Register rd, Register rt, uint16_t sa); 5361cb0ef41Sopenharmony_ci void rotrv(Register rd, Register rt, Register rs); 5371cb0ef41Sopenharmony_ci 5381cb0ef41Sopenharmony_ci // ------------Memory-instructions------------- 5391cb0ef41Sopenharmony_ci 5401cb0ef41Sopenharmony_ci void lb(Register rd, const MemOperand& rs); 5411cb0ef41Sopenharmony_ci void lbu(Register rd, const MemOperand& rs); 5421cb0ef41Sopenharmony_ci void lh(Register rd, const MemOperand& rs); 5431cb0ef41Sopenharmony_ci void lhu(Register rd, const MemOperand& rs); 5441cb0ef41Sopenharmony_ci void lw(Register rd, const MemOperand& rs); 5451cb0ef41Sopenharmony_ci void lwl(Register rd, const MemOperand& rs); 5461cb0ef41Sopenharmony_ci void lwr(Register rd, const MemOperand& rs); 5471cb0ef41Sopenharmony_ci void sb(Register rd, const MemOperand& rs); 5481cb0ef41Sopenharmony_ci void sh(Register rd, const MemOperand& rs); 5491cb0ef41Sopenharmony_ci void sw(Register rd, const MemOperand& rs); 5501cb0ef41Sopenharmony_ci void swl(Register rd, const MemOperand& rs); 5511cb0ef41Sopenharmony_ci void swr(Register rd, const MemOperand& rs); 5521cb0ef41Sopenharmony_ci 5531cb0ef41Sopenharmony_ci // ----------Atomic instructions-------------- 5541cb0ef41Sopenharmony_ci 5551cb0ef41Sopenharmony_ci void ll(Register rd, const MemOperand& rs); 5561cb0ef41Sopenharmony_ci void sc(Register rd, const MemOperand& rs); 5571cb0ef41Sopenharmony_ci void llx(Register rd, const MemOperand& rs); 5581cb0ef41Sopenharmony_ci void scx(Register rd, const MemOperand& rs); 5591cb0ef41Sopenharmony_ci 5601cb0ef41Sopenharmony_ci // ---------PC-Relative-instructions----------- 5611cb0ef41Sopenharmony_ci 5621cb0ef41Sopenharmony_ci void addiupc(Register rs, int32_t imm19); 5631cb0ef41Sopenharmony_ci void lwpc(Register rs, int32_t offset19); 5641cb0ef41Sopenharmony_ci void auipc(Register rs, int16_t imm16); 5651cb0ef41Sopenharmony_ci void aluipc(Register rs, int16_t imm16); 5661cb0ef41Sopenharmony_ci 5671cb0ef41Sopenharmony_ci // ----------------Prefetch-------------------- 5681cb0ef41Sopenharmony_ci 5691cb0ef41Sopenharmony_ci void pref(int32_t hint, const MemOperand& rs); 5701cb0ef41Sopenharmony_ci 5711cb0ef41Sopenharmony_ci // -------------Misc-instructions-------------- 5721cb0ef41Sopenharmony_ci 5731cb0ef41Sopenharmony_ci // Break / Trap instructions. 5741cb0ef41Sopenharmony_ci void break_(uint32_t code, bool break_as_stop = false); 5751cb0ef41Sopenharmony_ci void stop(uint32_t code = kMaxStopCode); 5761cb0ef41Sopenharmony_ci void tge(Register rs, Register rt, uint16_t code); 5771cb0ef41Sopenharmony_ci void tgeu(Register rs, Register rt, uint16_t code); 5781cb0ef41Sopenharmony_ci void tlt(Register rs, Register rt, uint16_t code); 5791cb0ef41Sopenharmony_ci void tltu(Register rs, Register rt, uint16_t code); 5801cb0ef41Sopenharmony_ci void teq(Register rs, Register rt, uint16_t code); 5811cb0ef41Sopenharmony_ci void tne(Register rs, Register rt, uint16_t code); 5821cb0ef41Sopenharmony_ci 5831cb0ef41Sopenharmony_ci // Memory barrier instruction. 5841cb0ef41Sopenharmony_ci void sync(); 5851cb0ef41Sopenharmony_ci 5861cb0ef41Sopenharmony_ci // Move from HI/LO register. 5871cb0ef41Sopenharmony_ci void mfhi(Register rd); 5881cb0ef41Sopenharmony_ci void mflo(Register rd); 5891cb0ef41Sopenharmony_ci 5901cb0ef41Sopenharmony_ci // Set on less than. 5911cb0ef41Sopenharmony_ci void slt(Register rd, Register rs, Register rt); 5921cb0ef41Sopenharmony_ci void sltu(Register rd, Register rs, Register rt); 5931cb0ef41Sopenharmony_ci void slti(Register rd, Register rs, int32_t j); 5941cb0ef41Sopenharmony_ci void sltiu(Register rd, Register rs, int32_t j); 5951cb0ef41Sopenharmony_ci 5961cb0ef41Sopenharmony_ci // Conditional move. 5971cb0ef41Sopenharmony_ci void movz(Register rd, Register rs, Register rt); 5981cb0ef41Sopenharmony_ci void movn(Register rd, Register rs, Register rt); 5991cb0ef41Sopenharmony_ci void movt(Register rd, Register rs, uint16_t cc = 0); 6001cb0ef41Sopenharmony_ci void movf(Register rd, Register rs, uint16_t cc = 0); 6011cb0ef41Sopenharmony_ci 6021cb0ef41Sopenharmony_ci void sel(SecondaryField fmt, FPURegister fd, FPURegister fs, FPURegister ft); 6031cb0ef41Sopenharmony_ci void sel_s(FPURegister fd, FPURegister fs, FPURegister ft); 6041cb0ef41Sopenharmony_ci void sel_d(FPURegister fd, FPURegister fs, FPURegister ft); 6051cb0ef41Sopenharmony_ci void seleqz(Register rd, Register rs, Register rt); 6061cb0ef41Sopenharmony_ci void seleqz(SecondaryField fmt, FPURegister fd, FPURegister fs, 6071cb0ef41Sopenharmony_ci FPURegister ft); 6081cb0ef41Sopenharmony_ci void selnez(Register rd, Register rs, Register rt); 6091cb0ef41Sopenharmony_ci void selnez(SecondaryField fmt, FPURegister fd, FPURegister fs, 6101cb0ef41Sopenharmony_ci FPURegister ft); 6111cb0ef41Sopenharmony_ci void seleqz_d(FPURegister fd, FPURegister fs, FPURegister ft); 6121cb0ef41Sopenharmony_ci void seleqz_s(FPURegister fd, FPURegister fs, FPURegister ft); 6131cb0ef41Sopenharmony_ci void selnez_d(FPURegister fd, FPURegister fs, FPURegister ft); 6141cb0ef41Sopenharmony_ci void selnez_s(FPURegister fd, FPURegister fs, FPURegister ft); 6151cb0ef41Sopenharmony_ci 6161cb0ef41Sopenharmony_ci void movz_s(FPURegister fd, FPURegister fs, Register rt); 6171cb0ef41Sopenharmony_ci void movz_d(FPURegister fd, FPURegister fs, Register rt); 6181cb0ef41Sopenharmony_ci void movt_s(FPURegister fd, FPURegister fs, uint16_t cc = 0); 6191cb0ef41Sopenharmony_ci void movt_d(FPURegister fd, FPURegister fs, uint16_t cc = 0); 6201cb0ef41Sopenharmony_ci void movf_s(FPURegister fd, FPURegister fs, uint16_t cc = 0); 6211cb0ef41Sopenharmony_ci void movf_d(FPURegister fd, FPURegister fs, uint16_t cc = 0); 6221cb0ef41Sopenharmony_ci void movn_s(FPURegister fd, FPURegister fs, Register rt); 6231cb0ef41Sopenharmony_ci void movn_d(FPURegister fd, FPURegister fs, Register rt); 6241cb0ef41Sopenharmony_ci // Bit twiddling. 6251cb0ef41Sopenharmony_ci void clz(Register rd, Register rs); 6261cb0ef41Sopenharmony_ci void ins_(Register rt, Register rs, uint16_t pos, uint16_t size); 6271cb0ef41Sopenharmony_ci void ext_(Register rt, Register rs, uint16_t pos, uint16_t size); 6281cb0ef41Sopenharmony_ci void bitswap(Register rd, Register rt); 6291cb0ef41Sopenharmony_ci void align(Register rd, Register rs, Register rt, uint8_t bp); 6301cb0ef41Sopenharmony_ci 6311cb0ef41Sopenharmony_ci void wsbh(Register rd, Register rt); 6321cb0ef41Sopenharmony_ci void seh(Register rd, Register rt); 6331cb0ef41Sopenharmony_ci void seb(Register rd, Register rt); 6341cb0ef41Sopenharmony_ci 6351cb0ef41Sopenharmony_ci // --------Coprocessor-instructions---------------- 6361cb0ef41Sopenharmony_ci 6371cb0ef41Sopenharmony_ci // Load, store, and move. 6381cb0ef41Sopenharmony_ci void lwc1(FPURegister fd, const MemOperand& src); 6391cb0ef41Sopenharmony_ci void swc1(FPURegister fs, const MemOperand& dst); 6401cb0ef41Sopenharmony_ci 6411cb0ef41Sopenharmony_ci void mtc1(Register rt, FPURegister fs); 6421cb0ef41Sopenharmony_ci void mthc1(Register rt, FPURegister fs); 6431cb0ef41Sopenharmony_ci 6441cb0ef41Sopenharmony_ci void mfc1(Register rt, FPURegister fs); 6451cb0ef41Sopenharmony_ci void mfhc1(Register rt, FPURegister fs); 6461cb0ef41Sopenharmony_ci 6471cb0ef41Sopenharmony_ci void ctc1(Register rt, FPUControlRegister fs); 6481cb0ef41Sopenharmony_ci void cfc1(Register rt, FPUControlRegister fs); 6491cb0ef41Sopenharmony_ci 6501cb0ef41Sopenharmony_ci // Arithmetic. 6511cb0ef41Sopenharmony_ci void add_s(FPURegister fd, FPURegister fs, FPURegister ft); 6521cb0ef41Sopenharmony_ci void add_d(FPURegister fd, FPURegister fs, FPURegister ft); 6531cb0ef41Sopenharmony_ci void sub_s(FPURegister fd, FPURegister fs, FPURegister ft); 6541cb0ef41Sopenharmony_ci void sub_d(FPURegister fd, FPURegister fs, FPURegister ft); 6551cb0ef41Sopenharmony_ci void mul_s(FPURegister fd, FPURegister fs, FPURegister ft); 6561cb0ef41Sopenharmony_ci void mul_d(FPURegister fd, FPURegister fs, FPURegister ft); 6571cb0ef41Sopenharmony_ci void madd_s(FPURegister fd, FPURegister fr, FPURegister fs, FPURegister ft); 6581cb0ef41Sopenharmony_ci void madd_d(FPURegister fd, FPURegister fr, FPURegister fs, FPURegister ft); 6591cb0ef41Sopenharmony_ci void msub_s(FPURegister fd, FPURegister fr, FPURegister fs, FPURegister ft); 6601cb0ef41Sopenharmony_ci void msub_d(FPURegister fd, FPURegister fr, FPURegister fs, FPURegister ft); 6611cb0ef41Sopenharmony_ci void maddf_s(FPURegister fd, FPURegister fs, FPURegister ft); 6621cb0ef41Sopenharmony_ci void maddf_d(FPURegister fd, FPURegister fs, FPURegister ft); 6631cb0ef41Sopenharmony_ci void msubf_s(FPURegister fd, FPURegister fs, FPURegister ft); 6641cb0ef41Sopenharmony_ci void msubf_d(FPURegister fd, FPURegister fs, FPURegister ft); 6651cb0ef41Sopenharmony_ci void div_s(FPURegister fd, FPURegister fs, FPURegister ft); 6661cb0ef41Sopenharmony_ci void div_d(FPURegister fd, FPURegister fs, FPURegister ft); 6671cb0ef41Sopenharmony_ci void abs_s(FPURegister fd, FPURegister fs); 6681cb0ef41Sopenharmony_ci void abs_d(FPURegister fd, FPURegister fs); 6691cb0ef41Sopenharmony_ci void mov_d(FPURegister fd, FPURegister fs); 6701cb0ef41Sopenharmony_ci void mov_s(FPURegister fd, FPURegister fs); 6711cb0ef41Sopenharmony_ci void neg_s(FPURegister fd, FPURegister fs); 6721cb0ef41Sopenharmony_ci void neg_d(FPURegister fd, FPURegister fs); 6731cb0ef41Sopenharmony_ci void sqrt_s(FPURegister fd, FPURegister fs); 6741cb0ef41Sopenharmony_ci void sqrt_d(FPURegister fd, FPURegister fs); 6751cb0ef41Sopenharmony_ci void rsqrt_s(FPURegister fd, FPURegister fs); 6761cb0ef41Sopenharmony_ci void rsqrt_d(FPURegister fd, FPURegister fs); 6771cb0ef41Sopenharmony_ci void recip_d(FPURegister fd, FPURegister fs); 6781cb0ef41Sopenharmony_ci void recip_s(FPURegister fd, FPURegister fs); 6791cb0ef41Sopenharmony_ci 6801cb0ef41Sopenharmony_ci // Conversion. 6811cb0ef41Sopenharmony_ci void cvt_w_s(FPURegister fd, FPURegister fs); 6821cb0ef41Sopenharmony_ci void cvt_w_d(FPURegister fd, FPURegister fs); 6831cb0ef41Sopenharmony_ci void trunc_w_s(FPURegister fd, FPURegister fs); 6841cb0ef41Sopenharmony_ci void trunc_w_d(FPURegister fd, FPURegister fs); 6851cb0ef41Sopenharmony_ci void round_w_s(FPURegister fd, FPURegister fs); 6861cb0ef41Sopenharmony_ci void round_w_d(FPURegister fd, FPURegister fs); 6871cb0ef41Sopenharmony_ci void floor_w_s(FPURegister fd, FPURegister fs); 6881cb0ef41Sopenharmony_ci void floor_w_d(FPURegister fd, FPURegister fs); 6891cb0ef41Sopenharmony_ci void ceil_w_s(FPURegister fd, FPURegister fs); 6901cb0ef41Sopenharmony_ci void ceil_w_d(FPURegister fd, FPURegister fs); 6911cb0ef41Sopenharmony_ci void rint_s(FPURegister fd, FPURegister fs); 6921cb0ef41Sopenharmony_ci void rint_d(FPURegister fd, FPURegister fs); 6931cb0ef41Sopenharmony_ci void rint(SecondaryField fmt, FPURegister fd, FPURegister fs); 6941cb0ef41Sopenharmony_ci 6951cb0ef41Sopenharmony_ci void cvt_l_s(FPURegister fd, FPURegister fs); 6961cb0ef41Sopenharmony_ci void cvt_l_d(FPURegister fd, FPURegister fs); 6971cb0ef41Sopenharmony_ci void trunc_l_s(FPURegister fd, FPURegister fs); 6981cb0ef41Sopenharmony_ci void trunc_l_d(FPURegister fd, FPURegister fs); 6991cb0ef41Sopenharmony_ci void round_l_s(FPURegister fd, FPURegister fs); 7001cb0ef41Sopenharmony_ci void round_l_d(FPURegister fd, FPURegister fs); 7011cb0ef41Sopenharmony_ci void floor_l_s(FPURegister fd, FPURegister fs); 7021cb0ef41Sopenharmony_ci void floor_l_d(FPURegister fd, FPURegister fs); 7031cb0ef41Sopenharmony_ci void ceil_l_s(FPURegister fd, FPURegister fs); 7041cb0ef41Sopenharmony_ci void ceil_l_d(FPURegister fd, FPURegister fs); 7051cb0ef41Sopenharmony_ci 7061cb0ef41Sopenharmony_ci void class_s(FPURegister fd, FPURegister fs); 7071cb0ef41Sopenharmony_ci void class_d(FPURegister fd, FPURegister fs); 7081cb0ef41Sopenharmony_ci 7091cb0ef41Sopenharmony_ci void min(SecondaryField fmt, FPURegister fd, FPURegister fs, FPURegister ft); 7101cb0ef41Sopenharmony_ci void mina(SecondaryField fmt, FPURegister fd, FPURegister fs, FPURegister ft); 7111cb0ef41Sopenharmony_ci void max(SecondaryField fmt, FPURegister fd, FPURegister fs, FPURegister ft); 7121cb0ef41Sopenharmony_ci void maxa(SecondaryField fmt, FPURegister fd, FPURegister fs, FPURegister ft); 7131cb0ef41Sopenharmony_ci void min_s(FPURegister fd, FPURegister fs, FPURegister ft); 7141cb0ef41Sopenharmony_ci void min_d(FPURegister fd, FPURegister fs, FPURegister ft); 7151cb0ef41Sopenharmony_ci void max_s(FPURegister fd, FPURegister fs, FPURegister ft); 7161cb0ef41Sopenharmony_ci void max_d(FPURegister fd, FPURegister fs, FPURegister ft); 7171cb0ef41Sopenharmony_ci void mina_s(FPURegister fd, FPURegister fs, FPURegister ft); 7181cb0ef41Sopenharmony_ci void mina_d(FPURegister fd, FPURegister fs, FPURegister ft); 7191cb0ef41Sopenharmony_ci void maxa_s(FPURegister fd, FPURegister fs, FPURegister ft); 7201cb0ef41Sopenharmony_ci void maxa_d(FPURegister fd, FPURegister fs, FPURegister ft); 7211cb0ef41Sopenharmony_ci 7221cb0ef41Sopenharmony_ci void cvt_s_w(FPURegister fd, FPURegister fs); 7231cb0ef41Sopenharmony_ci void cvt_s_l(FPURegister fd, FPURegister fs); 7241cb0ef41Sopenharmony_ci void cvt_s_d(FPURegister fd, FPURegister fs); 7251cb0ef41Sopenharmony_ci 7261cb0ef41Sopenharmony_ci void cvt_d_w(FPURegister fd, FPURegister fs); 7271cb0ef41Sopenharmony_ci void cvt_d_l(FPURegister fd, FPURegister fs); 7281cb0ef41Sopenharmony_ci void cvt_d_s(FPURegister fd, FPURegister fs); 7291cb0ef41Sopenharmony_ci 7301cb0ef41Sopenharmony_ci // Conditions and branches for MIPSr6. 7311cb0ef41Sopenharmony_ci void cmp(FPUCondition cond, SecondaryField fmt, FPURegister fd, 7321cb0ef41Sopenharmony_ci FPURegister ft, FPURegister fs); 7331cb0ef41Sopenharmony_ci void cmp_s(FPUCondition cond, FPURegister fd, FPURegister fs, FPURegister ft); 7341cb0ef41Sopenharmony_ci void cmp_d(FPUCondition cond, FPURegister fd, FPURegister fs, FPURegister ft); 7351cb0ef41Sopenharmony_ci 7361cb0ef41Sopenharmony_ci void bc1eqz(int16_t offset, FPURegister ft); 7371cb0ef41Sopenharmony_ci inline void bc1eqz(Label* L, FPURegister ft) { 7381cb0ef41Sopenharmony_ci bc1eqz(shifted_branch_offset(L), ft); 7391cb0ef41Sopenharmony_ci } 7401cb0ef41Sopenharmony_ci void bc1nez(int16_t offset, FPURegister ft); 7411cb0ef41Sopenharmony_ci inline void bc1nez(Label* L, FPURegister ft) { 7421cb0ef41Sopenharmony_ci bc1nez(shifted_branch_offset(L), ft); 7431cb0ef41Sopenharmony_ci } 7441cb0ef41Sopenharmony_ci 7451cb0ef41Sopenharmony_ci // Conditions and branches for non MIPSr6. 7461cb0ef41Sopenharmony_ci void c(FPUCondition cond, SecondaryField fmt, FPURegister ft, FPURegister fs, 7471cb0ef41Sopenharmony_ci uint16_t cc = 0); 7481cb0ef41Sopenharmony_ci void c_s(FPUCondition cond, FPURegister ft, FPURegister fs, uint16_t cc = 0); 7491cb0ef41Sopenharmony_ci void c_d(FPUCondition cond, FPURegister ft, FPURegister fs, uint16_t cc = 0); 7501cb0ef41Sopenharmony_ci 7511cb0ef41Sopenharmony_ci void bc1f(int16_t offset, uint16_t cc = 0); 7521cb0ef41Sopenharmony_ci inline void bc1f(Label* L, uint16_t cc = 0) { 7531cb0ef41Sopenharmony_ci bc1f(shifted_branch_offset(L), cc); 7541cb0ef41Sopenharmony_ci } 7551cb0ef41Sopenharmony_ci void bc1t(int16_t offset, uint16_t cc = 0); 7561cb0ef41Sopenharmony_ci inline void bc1t(Label* L, uint16_t cc = 0) { 7571cb0ef41Sopenharmony_ci bc1t(shifted_branch_offset(L), cc); 7581cb0ef41Sopenharmony_ci } 7591cb0ef41Sopenharmony_ci void fcmp(FPURegister src1, const double src2, FPUCondition cond); 7601cb0ef41Sopenharmony_ci 7611cb0ef41Sopenharmony_ci // MSA instructions 7621cb0ef41Sopenharmony_ci void bz_v(MSARegister wt, int16_t offset); 7631cb0ef41Sopenharmony_ci inline void bz_v(MSARegister wt, Label* L) { 7641cb0ef41Sopenharmony_ci bz_v(wt, shifted_branch_offset(L)); 7651cb0ef41Sopenharmony_ci } 7661cb0ef41Sopenharmony_ci void bz_b(MSARegister wt, int16_t offset); 7671cb0ef41Sopenharmony_ci inline void bz_b(MSARegister wt, Label* L) { 7681cb0ef41Sopenharmony_ci bz_b(wt, shifted_branch_offset(L)); 7691cb0ef41Sopenharmony_ci } 7701cb0ef41Sopenharmony_ci void bz_h(MSARegister wt, int16_t offset); 7711cb0ef41Sopenharmony_ci inline void bz_h(MSARegister wt, Label* L) { 7721cb0ef41Sopenharmony_ci bz_h(wt, shifted_branch_offset(L)); 7731cb0ef41Sopenharmony_ci } 7741cb0ef41Sopenharmony_ci void bz_w(MSARegister wt, int16_t offset); 7751cb0ef41Sopenharmony_ci inline void bz_w(MSARegister wt, Label* L) { 7761cb0ef41Sopenharmony_ci bz_w(wt, shifted_branch_offset(L)); 7771cb0ef41Sopenharmony_ci } 7781cb0ef41Sopenharmony_ci void bz_d(MSARegister wt, int16_t offset); 7791cb0ef41Sopenharmony_ci inline void bz_d(MSARegister wt, Label* L) { 7801cb0ef41Sopenharmony_ci bz_d(wt, shifted_branch_offset(L)); 7811cb0ef41Sopenharmony_ci } 7821cb0ef41Sopenharmony_ci void bnz_v(MSARegister wt, int16_t offset); 7831cb0ef41Sopenharmony_ci inline void bnz_v(MSARegister wt, Label* L) { 7841cb0ef41Sopenharmony_ci bnz_v(wt, shifted_branch_offset(L)); 7851cb0ef41Sopenharmony_ci } 7861cb0ef41Sopenharmony_ci void bnz_b(MSARegister wt, int16_t offset); 7871cb0ef41Sopenharmony_ci inline void bnz_b(MSARegister wt, Label* L) { 7881cb0ef41Sopenharmony_ci bnz_b(wt, shifted_branch_offset(L)); 7891cb0ef41Sopenharmony_ci } 7901cb0ef41Sopenharmony_ci void bnz_h(MSARegister wt, int16_t offset); 7911cb0ef41Sopenharmony_ci inline void bnz_h(MSARegister wt, Label* L) { 7921cb0ef41Sopenharmony_ci bnz_h(wt, shifted_branch_offset(L)); 7931cb0ef41Sopenharmony_ci } 7941cb0ef41Sopenharmony_ci void bnz_w(MSARegister wt, int16_t offset); 7951cb0ef41Sopenharmony_ci inline void bnz_w(MSARegister wt, Label* L) { 7961cb0ef41Sopenharmony_ci bnz_w(wt, shifted_branch_offset(L)); 7971cb0ef41Sopenharmony_ci } 7981cb0ef41Sopenharmony_ci void bnz_d(MSARegister wt, int16_t offset); 7991cb0ef41Sopenharmony_ci inline void bnz_d(MSARegister wt, Label* L) { 8001cb0ef41Sopenharmony_ci bnz_d(wt, shifted_branch_offset(L)); 8011cb0ef41Sopenharmony_ci } 8021cb0ef41Sopenharmony_ci 8031cb0ef41Sopenharmony_ci void ld_b(MSARegister wd, const MemOperand& rs); 8041cb0ef41Sopenharmony_ci void ld_h(MSARegister wd, const MemOperand& rs); 8051cb0ef41Sopenharmony_ci void ld_w(MSARegister wd, const MemOperand& rs); 8061cb0ef41Sopenharmony_ci void ld_d(MSARegister wd, const MemOperand& rs); 8071cb0ef41Sopenharmony_ci void st_b(MSARegister wd, const MemOperand& rs); 8081cb0ef41Sopenharmony_ci void st_h(MSARegister wd, const MemOperand& rs); 8091cb0ef41Sopenharmony_ci void st_w(MSARegister wd, const MemOperand& rs); 8101cb0ef41Sopenharmony_ci void st_d(MSARegister wd, const MemOperand& rs); 8111cb0ef41Sopenharmony_ci 8121cb0ef41Sopenharmony_ci void ldi_b(MSARegister wd, int32_t imm10); 8131cb0ef41Sopenharmony_ci void ldi_h(MSARegister wd, int32_t imm10); 8141cb0ef41Sopenharmony_ci void ldi_w(MSARegister wd, int32_t imm10); 8151cb0ef41Sopenharmony_ci void ldi_d(MSARegister wd, int32_t imm10); 8161cb0ef41Sopenharmony_ci 8171cb0ef41Sopenharmony_ci void addvi_b(MSARegister wd, MSARegister ws, uint32_t imm5); 8181cb0ef41Sopenharmony_ci void addvi_h(MSARegister wd, MSARegister ws, uint32_t imm5); 8191cb0ef41Sopenharmony_ci void addvi_w(MSARegister wd, MSARegister ws, uint32_t imm5); 8201cb0ef41Sopenharmony_ci void addvi_d(MSARegister wd, MSARegister ws, uint32_t imm5); 8211cb0ef41Sopenharmony_ci void subvi_b(MSARegister wd, MSARegister ws, uint32_t imm5); 8221cb0ef41Sopenharmony_ci void subvi_h(MSARegister wd, MSARegister ws, uint32_t imm5); 8231cb0ef41Sopenharmony_ci void subvi_w(MSARegister wd, MSARegister ws, uint32_t imm5); 8241cb0ef41Sopenharmony_ci void subvi_d(MSARegister wd, MSARegister ws, uint32_t imm5); 8251cb0ef41Sopenharmony_ci void maxi_s_b(MSARegister wd, MSARegister ws, uint32_t imm5); 8261cb0ef41Sopenharmony_ci void maxi_s_h(MSARegister wd, MSARegister ws, uint32_t imm5); 8271cb0ef41Sopenharmony_ci void maxi_s_w(MSARegister wd, MSARegister ws, uint32_t imm5); 8281cb0ef41Sopenharmony_ci void maxi_s_d(MSARegister wd, MSARegister ws, uint32_t imm5); 8291cb0ef41Sopenharmony_ci void maxi_u_b(MSARegister wd, MSARegister ws, uint32_t imm5); 8301cb0ef41Sopenharmony_ci void maxi_u_h(MSARegister wd, MSARegister ws, uint32_t imm5); 8311cb0ef41Sopenharmony_ci void maxi_u_w(MSARegister wd, MSARegister ws, uint32_t imm5); 8321cb0ef41Sopenharmony_ci void maxi_u_d(MSARegister wd, MSARegister ws, uint32_t imm5); 8331cb0ef41Sopenharmony_ci void mini_s_b(MSARegister wd, MSARegister ws, uint32_t imm5); 8341cb0ef41Sopenharmony_ci void mini_s_h(MSARegister wd, MSARegister ws, uint32_t imm5); 8351cb0ef41Sopenharmony_ci void mini_s_w(MSARegister wd, MSARegister ws, uint32_t imm5); 8361cb0ef41Sopenharmony_ci void mini_s_d(MSARegister wd, MSARegister ws, uint32_t imm5); 8371cb0ef41Sopenharmony_ci void mini_u_b(MSARegister wd, MSARegister ws, uint32_t imm5); 8381cb0ef41Sopenharmony_ci void mini_u_h(MSARegister wd, MSARegister ws, uint32_t imm5); 8391cb0ef41Sopenharmony_ci void mini_u_w(MSARegister wd, MSARegister ws, uint32_t imm5); 8401cb0ef41Sopenharmony_ci void mini_u_d(MSARegister wd, MSARegister ws, uint32_t imm5); 8411cb0ef41Sopenharmony_ci void ceqi_b(MSARegister wd, MSARegister ws, uint32_t imm5); 8421cb0ef41Sopenharmony_ci void ceqi_h(MSARegister wd, MSARegister ws, uint32_t imm5); 8431cb0ef41Sopenharmony_ci void ceqi_w(MSARegister wd, MSARegister ws, uint32_t imm5); 8441cb0ef41Sopenharmony_ci void ceqi_d(MSARegister wd, MSARegister ws, uint32_t imm5); 8451cb0ef41Sopenharmony_ci void clti_s_b(MSARegister wd, MSARegister ws, uint32_t imm5); 8461cb0ef41Sopenharmony_ci void clti_s_h(MSARegister wd, MSARegister ws, uint32_t imm5); 8471cb0ef41Sopenharmony_ci void clti_s_w(MSARegister wd, MSARegister ws, uint32_t imm5); 8481cb0ef41Sopenharmony_ci void clti_s_d(MSARegister wd, MSARegister ws, uint32_t imm5); 8491cb0ef41Sopenharmony_ci void clti_u_b(MSARegister wd, MSARegister ws, uint32_t imm5); 8501cb0ef41Sopenharmony_ci void clti_u_h(MSARegister wd, MSARegister ws, uint32_t imm5); 8511cb0ef41Sopenharmony_ci void clti_u_w(MSARegister wd, MSARegister ws, uint32_t imm5); 8521cb0ef41Sopenharmony_ci void clti_u_d(MSARegister wd, MSARegister ws, uint32_t imm5); 8531cb0ef41Sopenharmony_ci void clei_s_b(MSARegister wd, MSARegister ws, uint32_t imm5); 8541cb0ef41Sopenharmony_ci void clei_s_h(MSARegister wd, MSARegister ws, uint32_t imm5); 8551cb0ef41Sopenharmony_ci void clei_s_w(MSARegister wd, MSARegister ws, uint32_t imm5); 8561cb0ef41Sopenharmony_ci void clei_s_d(MSARegister wd, MSARegister ws, uint32_t imm5); 8571cb0ef41Sopenharmony_ci void clei_u_b(MSARegister wd, MSARegister ws, uint32_t imm5); 8581cb0ef41Sopenharmony_ci void clei_u_h(MSARegister wd, MSARegister ws, uint32_t imm5); 8591cb0ef41Sopenharmony_ci void clei_u_w(MSARegister wd, MSARegister ws, uint32_t imm5); 8601cb0ef41Sopenharmony_ci void clei_u_d(MSARegister wd, MSARegister ws, uint32_t imm5); 8611cb0ef41Sopenharmony_ci 8621cb0ef41Sopenharmony_ci void andi_b(MSARegister wd, MSARegister ws, uint32_t imm8); 8631cb0ef41Sopenharmony_ci void ori_b(MSARegister wd, MSARegister ws, uint32_t imm8); 8641cb0ef41Sopenharmony_ci void nori_b(MSARegister wd, MSARegister ws, uint32_t imm8); 8651cb0ef41Sopenharmony_ci void xori_b(MSARegister wd, MSARegister ws, uint32_t imm8); 8661cb0ef41Sopenharmony_ci void bmnzi_b(MSARegister wd, MSARegister ws, uint32_t imm8); 8671cb0ef41Sopenharmony_ci void bmzi_b(MSARegister wd, MSARegister ws, uint32_t imm8); 8681cb0ef41Sopenharmony_ci void bseli_b(MSARegister wd, MSARegister ws, uint32_t imm8); 8691cb0ef41Sopenharmony_ci void shf_b(MSARegister wd, MSARegister ws, uint32_t imm8); 8701cb0ef41Sopenharmony_ci void shf_h(MSARegister wd, MSARegister ws, uint32_t imm8); 8711cb0ef41Sopenharmony_ci void shf_w(MSARegister wd, MSARegister ws, uint32_t imm8); 8721cb0ef41Sopenharmony_ci 8731cb0ef41Sopenharmony_ci void and_v(MSARegister wd, MSARegister ws, MSARegister wt); 8741cb0ef41Sopenharmony_ci void or_v(MSARegister wd, MSARegister ws, MSARegister wt); 8751cb0ef41Sopenharmony_ci void nor_v(MSARegister wd, MSARegister ws, MSARegister wt); 8761cb0ef41Sopenharmony_ci void xor_v(MSARegister wd, MSARegister ws, MSARegister wt); 8771cb0ef41Sopenharmony_ci void bmnz_v(MSARegister wd, MSARegister ws, MSARegister wt); 8781cb0ef41Sopenharmony_ci void bmz_v(MSARegister wd, MSARegister ws, MSARegister wt); 8791cb0ef41Sopenharmony_ci void bsel_v(MSARegister wd, MSARegister ws, MSARegister wt); 8801cb0ef41Sopenharmony_ci 8811cb0ef41Sopenharmony_ci void fill_b(MSARegister wd, Register rs); 8821cb0ef41Sopenharmony_ci void fill_h(MSARegister wd, Register rs); 8831cb0ef41Sopenharmony_ci void fill_w(MSARegister wd, Register rs); 8841cb0ef41Sopenharmony_ci void pcnt_b(MSARegister wd, MSARegister ws); 8851cb0ef41Sopenharmony_ci void pcnt_h(MSARegister wd, MSARegister ws); 8861cb0ef41Sopenharmony_ci void pcnt_w(MSARegister wd, MSARegister ws); 8871cb0ef41Sopenharmony_ci void pcnt_d(MSARegister wd, MSARegister ws); 8881cb0ef41Sopenharmony_ci void nloc_b(MSARegister wd, MSARegister ws); 8891cb0ef41Sopenharmony_ci void nloc_h(MSARegister wd, MSARegister ws); 8901cb0ef41Sopenharmony_ci void nloc_w(MSARegister wd, MSARegister ws); 8911cb0ef41Sopenharmony_ci void nloc_d(MSARegister wd, MSARegister ws); 8921cb0ef41Sopenharmony_ci void nlzc_b(MSARegister wd, MSARegister ws); 8931cb0ef41Sopenharmony_ci void nlzc_h(MSARegister wd, MSARegister ws); 8941cb0ef41Sopenharmony_ci void nlzc_w(MSARegister wd, MSARegister ws); 8951cb0ef41Sopenharmony_ci void nlzc_d(MSARegister wd, MSARegister ws); 8961cb0ef41Sopenharmony_ci 8971cb0ef41Sopenharmony_ci void fclass_w(MSARegister wd, MSARegister ws); 8981cb0ef41Sopenharmony_ci void fclass_d(MSARegister wd, MSARegister ws); 8991cb0ef41Sopenharmony_ci void ftrunc_s_w(MSARegister wd, MSARegister ws); 9001cb0ef41Sopenharmony_ci void ftrunc_s_d(MSARegister wd, MSARegister ws); 9011cb0ef41Sopenharmony_ci void ftrunc_u_w(MSARegister wd, MSARegister ws); 9021cb0ef41Sopenharmony_ci void ftrunc_u_d(MSARegister wd, MSARegister ws); 9031cb0ef41Sopenharmony_ci void fsqrt_w(MSARegister wd, MSARegister ws); 9041cb0ef41Sopenharmony_ci void fsqrt_d(MSARegister wd, MSARegister ws); 9051cb0ef41Sopenharmony_ci void frsqrt_w(MSARegister wd, MSARegister ws); 9061cb0ef41Sopenharmony_ci void frsqrt_d(MSARegister wd, MSARegister ws); 9071cb0ef41Sopenharmony_ci void frcp_w(MSARegister wd, MSARegister ws); 9081cb0ef41Sopenharmony_ci void frcp_d(MSARegister wd, MSARegister ws); 9091cb0ef41Sopenharmony_ci void frint_w(MSARegister wd, MSARegister ws); 9101cb0ef41Sopenharmony_ci void frint_d(MSARegister wd, MSARegister ws); 9111cb0ef41Sopenharmony_ci void flog2_w(MSARegister wd, MSARegister ws); 9121cb0ef41Sopenharmony_ci void flog2_d(MSARegister wd, MSARegister ws); 9131cb0ef41Sopenharmony_ci void fexupl_w(MSARegister wd, MSARegister ws); 9141cb0ef41Sopenharmony_ci void fexupl_d(MSARegister wd, MSARegister ws); 9151cb0ef41Sopenharmony_ci void fexupr_w(MSARegister wd, MSARegister ws); 9161cb0ef41Sopenharmony_ci void fexupr_d(MSARegister wd, MSARegister ws); 9171cb0ef41Sopenharmony_ci void ffql_w(MSARegister wd, MSARegister ws); 9181cb0ef41Sopenharmony_ci void ffql_d(MSARegister wd, MSARegister ws); 9191cb0ef41Sopenharmony_ci void ffqr_w(MSARegister wd, MSARegister ws); 9201cb0ef41Sopenharmony_ci void ffqr_d(MSARegister wd, MSARegister ws); 9211cb0ef41Sopenharmony_ci void ftint_s_w(MSARegister wd, MSARegister ws); 9221cb0ef41Sopenharmony_ci void ftint_s_d(MSARegister wd, MSARegister ws); 9231cb0ef41Sopenharmony_ci void ftint_u_w(MSARegister wd, MSARegister ws); 9241cb0ef41Sopenharmony_ci void ftint_u_d(MSARegister wd, MSARegister ws); 9251cb0ef41Sopenharmony_ci void ffint_s_w(MSARegister wd, MSARegister ws); 9261cb0ef41Sopenharmony_ci void ffint_s_d(MSARegister wd, MSARegister ws); 9271cb0ef41Sopenharmony_ci void ffint_u_w(MSARegister wd, MSARegister ws); 9281cb0ef41Sopenharmony_ci void ffint_u_d(MSARegister wd, MSARegister ws); 9291cb0ef41Sopenharmony_ci 9301cb0ef41Sopenharmony_ci void sll_b(MSARegister wd, MSARegister ws, MSARegister wt); 9311cb0ef41Sopenharmony_ci void sll_h(MSARegister wd, MSARegister ws, MSARegister wt); 9321cb0ef41Sopenharmony_ci void sll_w(MSARegister wd, MSARegister ws, MSARegister wt); 9331cb0ef41Sopenharmony_ci void sll_d(MSARegister wd, MSARegister ws, MSARegister wt); 9341cb0ef41Sopenharmony_ci void sra_b(MSARegister wd, MSARegister ws, MSARegister wt); 9351cb0ef41Sopenharmony_ci void sra_h(MSARegister wd, MSARegister ws, MSARegister wt); 9361cb0ef41Sopenharmony_ci void sra_w(MSARegister wd, MSARegister ws, MSARegister wt); 9371cb0ef41Sopenharmony_ci void sra_d(MSARegister wd, MSARegister ws, MSARegister wt); 9381cb0ef41Sopenharmony_ci void srl_b(MSARegister wd, MSARegister ws, MSARegister wt); 9391cb0ef41Sopenharmony_ci void srl_h(MSARegister wd, MSARegister ws, MSARegister wt); 9401cb0ef41Sopenharmony_ci void srl_w(MSARegister wd, MSARegister ws, MSARegister wt); 9411cb0ef41Sopenharmony_ci void srl_d(MSARegister wd, MSARegister ws, MSARegister wt); 9421cb0ef41Sopenharmony_ci void bclr_b(MSARegister wd, MSARegister ws, MSARegister wt); 9431cb0ef41Sopenharmony_ci void bclr_h(MSARegister wd, MSARegister ws, MSARegister wt); 9441cb0ef41Sopenharmony_ci void bclr_w(MSARegister wd, MSARegister ws, MSARegister wt); 9451cb0ef41Sopenharmony_ci void bclr_d(MSARegister wd, MSARegister ws, MSARegister wt); 9461cb0ef41Sopenharmony_ci void bset_b(MSARegister wd, MSARegister ws, MSARegister wt); 9471cb0ef41Sopenharmony_ci void bset_h(MSARegister wd, MSARegister ws, MSARegister wt); 9481cb0ef41Sopenharmony_ci void bset_w(MSARegister wd, MSARegister ws, MSARegister wt); 9491cb0ef41Sopenharmony_ci void bset_d(MSARegister wd, MSARegister ws, MSARegister wt); 9501cb0ef41Sopenharmony_ci void bneg_b(MSARegister wd, MSARegister ws, MSARegister wt); 9511cb0ef41Sopenharmony_ci void bneg_h(MSARegister wd, MSARegister ws, MSARegister wt); 9521cb0ef41Sopenharmony_ci void bneg_w(MSARegister wd, MSARegister ws, MSARegister wt); 9531cb0ef41Sopenharmony_ci void bneg_d(MSARegister wd, MSARegister ws, MSARegister wt); 9541cb0ef41Sopenharmony_ci void binsl_b(MSARegister wd, MSARegister ws, MSARegister wt); 9551cb0ef41Sopenharmony_ci void binsl_h(MSARegister wd, MSARegister ws, MSARegister wt); 9561cb0ef41Sopenharmony_ci void binsl_w(MSARegister wd, MSARegister ws, MSARegister wt); 9571cb0ef41Sopenharmony_ci void binsl_d(MSARegister wd, MSARegister ws, MSARegister wt); 9581cb0ef41Sopenharmony_ci void binsr_b(MSARegister wd, MSARegister ws, MSARegister wt); 9591cb0ef41Sopenharmony_ci void binsr_h(MSARegister wd, MSARegister ws, MSARegister wt); 9601cb0ef41Sopenharmony_ci void binsr_w(MSARegister wd, MSARegister ws, MSARegister wt); 9611cb0ef41Sopenharmony_ci void binsr_d(MSARegister wd, MSARegister ws, MSARegister wt); 9621cb0ef41Sopenharmony_ci void addv_b(MSARegister wd, MSARegister ws, MSARegister wt); 9631cb0ef41Sopenharmony_ci void addv_h(MSARegister wd, MSARegister ws, MSARegister wt); 9641cb0ef41Sopenharmony_ci void addv_w(MSARegister wd, MSARegister ws, MSARegister wt); 9651cb0ef41Sopenharmony_ci void addv_d(MSARegister wd, MSARegister ws, MSARegister wt); 9661cb0ef41Sopenharmony_ci void subv_b(MSARegister wd, MSARegister ws, MSARegister wt); 9671cb0ef41Sopenharmony_ci void subv_h(MSARegister wd, MSARegister ws, MSARegister wt); 9681cb0ef41Sopenharmony_ci void subv_w(MSARegister wd, MSARegister ws, MSARegister wt); 9691cb0ef41Sopenharmony_ci void subv_d(MSARegister wd, MSARegister ws, MSARegister wt); 9701cb0ef41Sopenharmony_ci void max_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 9711cb0ef41Sopenharmony_ci void max_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 9721cb0ef41Sopenharmony_ci void max_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 9731cb0ef41Sopenharmony_ci void max_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 9741cb0ef41Sopenharmony_ci void max_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 9751cb0ef41Sopenharmony_ci void max_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 9761cb0ef41Sopenharmony_ci void max_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 9771cb0ef41Sopenharmony_ci void max_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 9781cb0ef41Sopenharmony_ci void min_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 9791cb0ef41Sopenharmony_ci void min_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 9801cb0ef41Sopenharmony_ci void min_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 9811cb0ef41Sopenharmony_ci void min_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 9821cb0ef41Sopenharmony_ci void min_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 9831cb0ef41Sopenharmony_ci void min_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 9841cb0ef41Sopenharmony_ci void min_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 9851cb0ef41Sopenharmony_ci void min_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 9861cb0ef41Sopenharmony_ci void max_a_b(MSARegister wd, MSARegister ws, MSARegister wt); 9871cb0ef41Sopenharmony_ci void max_a_h(MSARegister wd, MSARegister ws, MSARegister wt); 9881cb0ef41Sopenharmony_ci void max_a_w(MSARegister wd, MSARegister ws, MSARegister wt); 9891cb0ef41Sopenharmony_ci void max_a_d(MSARegister wd, MSARegister ws, MSARegister wt); 9901cb0ef41Sopenharmony_ci void min_a_b(MSARegister wd, MSARegister ws, MSARegister wt); 9911cb0ef41Sopenharmony_ci void min_a_h(MSARegister wd, MSARegister ws, MSARegister wt); 9921cb0ef41Sopenharmony_ci void min_a_w(MSARegister wd, MSARegister ws, MSARegister wt); 9931cb0ef41Sopenharmony_ci void min_a_d(MSARegister wd, MSARegister ws, MSARegister wt); 9941cb0ef41Sopenharmony_ci void ceq_b(MSARegister wd, MSARegister ws, MSARegister wt); 9951cb0ef41Sopenharmony_ci void ceq_h(MSARegister wd, MSARegister ws, MSARegister wt); 9961cb0ef41Sopenharmony_ci void ceq_w(MSARegister wd, MSARegister ws, MSARegister wt); 9971cb0ef41Sopenharmony_ci void ceq_d(MSARegister wd, MSARegister ws, MSARegister wt); 9981cb0ef41Sopenharmony_ci void clt_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 9991cb0ef41Sopenharmony_ci void clt_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 10001cb0ef41Sopenharmony_ci void clt_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 10011cb0ef41Sopenharmony_ci void clt_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 10021cb0ef41Sopenharmony_ci void clt_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 10031cb0ef41Sopenharmony_ci void clt_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 10041cb0ef41Sopenharmony_ci void clt_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 10051cb0ef41Sopenharmony_ci void clt_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 10061cb0ef41Sopenharmony_ci void cle_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 10071cb0ef41Sopenharmony_ci void cle_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 10081cb0ef41Sopenharmony_ci void cle_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 10091cb0ef41Sopenharmony_ci void cle_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 10101cb0ef41Sopenharmony_ci void cle_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 10111cb0ef41Sopenharmony_ci void cle_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 10121cb0ef41Sopenharmony_ci void cle_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 10131cb0ef41Sopenharmony_ci void cle_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 10141cb0ef41Sopenharmony_ci void add_a_b(MSARegister wd, MSARegister ws, MSARegister wt); 10151cb0ef41Sopenharmony_ci void add_a_h(MSARegister wd, MSARegister ws, MSARegister wt); 10161cb0ef41Sopenharmony_ci void add_a_w(MSARegister wd, MSARegister ws, MSARegister wt); 10171cb0ef41Sopenharmony_ci void add_a_d(MSARegister wd, MSARegister ws, MSARegister wt); 10181cb0ef41Sopenharmony_ci void adds_a_b(MSARegister wd, MSARegister ws, MSARegister wt); 10191cb0ef41Sopenharmony_ci void adds_a_h(MSARegister wd, MSARegister ws, MSARegister wt); 10201cb0ef41Sopenharmony_ci void adds_a_w(MSARegister wd, MSARegister ws, MSARegister wt); 10211cb0ef41Sopenharmony_ci void adds_a_d(MSARegister wd, MSARegister ws, MSARegister wt); 10221cb0ef41Sopenharmony_ci void adds_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 10231cb0ef41Sopenharmony_ci void adds_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 10241cb0ef41Sopenharmony_ci void adds_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 10251cb0ef41Sopenharmony_ci void adds_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 10261cb0ef41Sopenharmony_ci void adds_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 10271cb0ef41Sopenharmony_ci void adds_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 10281cb0ef41Sopenharmony_ci void adds_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 10291cb0ef41Sopenharmony_ci void adds_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 10301cb0ef41Sopenharmony_ci void ave_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 10311cb0ef41Sopenharmony_ci void ave_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 10321cb0ef41Sopenharmony_ci void ave_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 10331cb0ef41Sopenharmony_ci void ave_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 10341cb0ef41Sopenharmony_ci void ave_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 10351cb0ef41Sopenharmony_ci void ave_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 10361cb0ef41Sopenharmony_ci void ave_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 10371cb0ef41Sopenharmony_ci void ave_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 10381cb0ef41Sopenharmony_ci void aver_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 10391cb0ef41Sopenharmony_ci void aver_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 10401cb0ef41Sopenharmony_ci void aver_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 10411cb0ef41Sopenharmony_ci void aver_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 10421cb0ef41Sopenharmony_ci void aver_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 10431cb0ef41Sopenharmony_ci void aver_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 10441cb0ef41Sopenharmony_ci void aver_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 10451cb0ef41Sopenharmony_ci void aver_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 10461cb0ef41Sopenharmony_ci void subs_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 10471cb0ef41Sopenharmony_ci void subs_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 10481cb0ef41Sopenharmony_ci void subs_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 10491cb0ef41Sopenharmony_ci void subs_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 10501cb0ef41Sopenharmony_ci void subs_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 10511cb0ef41Sopenharmony_ci void subs_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 10521cb0ef41Sopenharmony_ci void subs_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 10531cb0ef41Sopenharmony_ci void subs_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 10541cb0ef41Sopenharmony_ci void subsus_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 10551cb0ef41Sopenharmony_ci void subsus_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 10561cb0ef41Sopenharmony_ci void subsus_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 10571cb0ef41Sopenharmony_ci void subsus_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 10581cb0ef41Sopenharmony_ci void subsus_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 10591cb0ef41Sopenharmony_ci void subsus_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 10601cb0ef41Sopenharmony_ci void subsus_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 10611cb0ef41Sopenharmony_ci void subsus_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 10621cb0ef41Sopenharmony_ci void subsuu_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 10631cb0ef41Sopenharmony_ci void subsuu_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 10641cb0ef41Sopenharmony_ci void subsuu_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 10651cb0ef41Sopenharmony_ci void subsuu_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 10661cb0ef41Sopenharmony_ci void subsuu_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 10671cb0ef41Sopenharmony_ci void subsuu_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 10681cb0ef41Sopenharmony_ci void subsuu_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 10691cb0ef41Sopenharmony_ci void subsuu_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 10701cb0ef41Sopenharmony_ci void asub_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 10711cb0ef41Sopenharmony_ci void asub_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 10721cb0ef41Sopenharmony_ci void asub_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 10731cb0ef41Sopenharmony_ci void asub_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 10741cb0ef41Sopenharmony_ci void asub_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 10751cb0ef41Sopenharmony_ci void asub_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 10761cb0ef41Sopenharmony_ci void asub_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 10771cb0ef41Sopenharmony_ci void asub_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 10781cb0ef41Sopenharmony_ci void mulv_b(MSARegister wd, MSARegister ws, MSARegister wt); 10791cb0ef41Sopenharmony_ci void mulv_h(MSARegister wd, MSARegister ws, MSARegister wt); 10801cb0ef41Sopenharmony_ci void mulv_w(MSARegister wd, MSARegister ws, MSARegister wt); 10811cb0ef41Sopenharmony_ci void mulv_d(MSARegister wd, MSARegister ws, MSARegister wt); 10821cb0ef41Sopenharmony_ci void maddv_b(MSARegister wd, MSARegister ws, MSARegister wt); 10831cb0ef41Sopenharmony_ci void maddv_h(MSARegister wd, MSARegister ws, MSARegister wt); 10841cb0ef41Sopenharmony_ci void maddv_w(MSARegister wd, MSARegister ws, MSARegister wt); 10851cb0ef41Sopenharmony_ci void maddv_d(MSARegister wd, MSARegister ws, MSARegister wt); 10861cb0ef41Sopenharmony_ci void msubv_b(MSARegister wd, MSARegister ws, MSARegister wt); 10871cb0ef41Sopenharmony_ci void msubv_h(MSARegister wd, MSARegister ws, MSARegister wt); 10881cb0ef41Sopenharmony_ci void msubv_w(MSARegister wd, MSARegister ws, MSARegister wt); 10891cb0ef41Sopenharmony_ci void msubv_d(MSARegister wd, MSARegister ws, MSARegister wt); 10901cb0ef41Sopenharmony_ci void div_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 10911cb0ef41Sopenharmony_ci void div_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 10921cb0ef41Sopenharmony_ci void div_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 10931cb0ef41Sopenharmony_ci void div_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 10941cb0ef41Sopenharmony_ci void div_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 10951cb0ef41Sopenharmony_ci void div_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 10961cb0ef41Sopenharmony_ci void div_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 10971cb0ef41Sopenharmony_ci void div_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 10981cb0ef41Sopenharmony_ci void mod_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 10991cb0ef41Sopenharmony_ci void mod_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 11001cb0ef41Sopenharmony_ci void mod_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 11011cb0ef41Sopenharmony_ci void mod_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 11021cb0ef41Sopenharmony_ci void mod_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 11031cb0ef41Sopenharmony_ci void mod_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 11041cb0ef41Sopenharmony_ci void mod_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 11051cb0ef41Sopenharmony_ci void mod_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 11061cb0ef41Sopenharmony_ci void dotp_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 11071cb0ef41Sopenharmony_ci void dotp_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 11081cb0ef41Sopenharmony_ci void dotp_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 11091cb0ef41Sopenharmony_ci void dotp_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 11101cb0ef41Sopenharmony_ci void dotp_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 11111cb0ef41Sopenharmony_ci void dotp_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 11121cb0ef41Sopenharmony_ci void dotp_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 11131cb0ef41Sopenharmony_ci void dotp_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 11141cb0ef41Sopenharmony_ci void dpadd_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 11151cb0ef41Sopenharmony_ci void dpadd_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 11161cb0ef41Sopenharmony_ci void dpadd_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 11171cb0ef41Sopenharmony_ci void dpadd_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 11181cb0ef41Sopenharmony_ci void dpadd_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 11191cb0ef41Sopenharmony_ci void dpadd_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 11201cb0ef41Sopenharmony_ci void dpadd_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 11211cb0ef41Sopenharmony_ci void dpadd_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 11221cb0ef41Sopenharmony_ci void dpsub_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 11231cb0ef41Sopenharmony_ci void dpsub_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 11241cb0ef41Sopenharmony_ci void dpsub_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 11251cb0ef41Sopenharmony_ci void dpsub_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 11261cb0ef41Sopenharmony_ci void dpsub_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 11271cb0ef41Sopenharmony_ci void dpsub_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 11281cb0ef41Sopenharmony_ci void dpsub_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 11291cb0ef41Sopenharmony_ci void dpsub_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 11301cb0ef41Sopenharmony_ci void sld_b(MSARegister wd, MSARegister ws, Register rt); 11311cb0ef41Sopenharmony_ci void sld_h(MSARegister wd, MSARegister ws, Register rt); 11321cb0ef41Sopenharmony_ci void sld_w(MSARegister wd, MSARegister ws, Register rt); 11331cb0ef41Sopenharmony_ci void sld_d(MSARegister wd, MSARegister ws, Register rt); 11341cb0ef41Sopenharmony_ci void splat_b(MSARegister wd, MSARegister ws, Register rt); 11351cb0ef41Sopenharmony_ci void splat_h(MSARegister wd, MSARegister ws, Register rt); 11361cb0ef41Sopenharmony_ci void splat_w(MSARegister wd, MSARegister ws, Register rt); 11371cb0ef41Sopenharmony_ci void splat_d(MSARegister wd, MSARegister ws, Register rt); 11381cb0ef41Sopenharmony_ci void pckev_b(MSARegister wd, MSARegister ws, MSARegister wt); 11391cb0ef41Sopenharmony_ci void pckev_h(MSARegister wd, MSARegister ws, MSARegister wt); 11401cb0ef41Sopenharmony_ci void pckev_w(MSARegister wd, MSARegister ws, MSARegister wt); 11411cb0ef41Sopenharmony_ci void pckev_d(MSARegister wd, MSARegister ws, MSARegister wt); 11421cb0ef41Sopenharmony_ci void pckod_b(MSARegister wd, MSARegister ws, MSARegister wt); 11431cb0ef41Sopenharmony_ci void pckod_h(MSARegister wd, MSARegister ws, MSARegister wt); 11441cb0ef41Sopenharmony_ci void pckod_w(MSARegister wd, MSARegister ws, MSARegister wt); 11451cb0ef41Sopenharmony_ci void pckod_d(MSARegister wd, MSARegister ws, MSARegister wt); 11461cb0ef41Sopenharmony_ci void ilvl_b(MSARegister wd, MSARegister ws, MSARegister wt); 11471cb0ef41Sopenharmony_ci void ilvl_h(MSARegister wd, MSARegister ws, MSARegister wt); 11481cb0ef41Sopenharmony_ci void ilvl_w(MSARegister wd, MSARegister ws, MSARegister wt); 11491cb0ef41Sopenharmony_ci void ilvl_d(MSARegister wd, MSARegister ws, MSARegister wt); 11501cb0ef41Sopenharmony_ci void ilvr_b(MSARegister wd, MSARegister ws, MSARegister wt); 11511cb0ef41Sopenharmony_ci void ilvr_h(MSARegister wd, MSARegister ws, MSARegister wt); 11521cb0ef41Sopenharmony_ci void ilvr_w(MSARegister wd, MSARegister ws, MSARegister wt); 11531cb0ef41Sopenharmony_ci void ilvr_d(MSARegister wd, MSARegister ws, MSARegister wt); 11541cb0ef41Sopenharmony_ci void ilvev_b(MSARegister wd, MSARegister ws, MSARegister wt); 11551cb0ef41Sopenharmony_ci void ilvev_h(MSARegister wd, MSARegister ws, MSARegister wt); 11561cb0ef41Sopenharmony_ci void ilvev_w(MSARegister wd, MSARegister ws, MSARegister wt); 11571cb0ef41Sopenharmony_ci void ilvev_d(MSARegister wd, MSARegister ws, MSARegister wt); 11581cb0ef41Sopenharmony_ci void ilvod_b(MSARegister wd, MSARegister ws, MSARegister wt); 11591cb0ef41Sopenharmony_ci void ilvod_h(MSARegister wd, MSARegister ws, MSARegister wt); 11601cb0ef41Sopenharmony_ci void ilvod_w(MSARegister wd, MSARegister ws, MSARegister wt); 11611cb0ef41Sopenharmony_ci void ilvod_d(MSARegister wd, MSARegister ws, MSARegister wt); 11621cb0ef41Sopenharmony_ci void vshf_b(MSARegister wd, MSARegister ws, MSARegister wt); 11631cb0ef41Sopenharmony_ci void vshf_h(MSARegister wd, MSARegister ws, MSARegister wt); 11641cb0ef41Sopenharmony_ci void vshf_w(MSARegister wd, MSARegister ws, MSARegister wt); 11651cb0ef41Sopenharmony_ci void vshf_d(MSARegister wd, MSARegister ws, MSARegister wt); 11661cb0ef41Sopenharmony_ci void srar_b(MSARegister wd, MSARegister ws, MSARegister wt); 11671cb0ef41Sopenharmony_ci void srar_h(MSARegister wd, MSARegister ws, MSARegister wt); 11681cb0ef41Sopenharmony_ci void srar_w(MSARegister wd, MSARegister ws, MSARegister wt); 11691cb0ef41Sopenharmony_ci void srar_d(MSARegister wd, MSARegister ws, MSARegister wt); 11701cb0ef41Sopenharmony_ci void srlr_b(MSARegister wd, MSARegister ws, MSARegister wt); 11711cb0ef41Sopenharmony_ci void srlr_h(MSARegister wd, MSARegister ws, MSARegister wt); 11721cb0ef41Sopenharmony_ci void srlr_w(MSARegister wd, MSARegister ws, MSARegister wt); 11731cb0ef41Sopenharmony_ci void srlr_d(MSARegister wd, MSARegister ws, MSARegister wt); 11741cb0ef41Sopenharmony_ci void hadd_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 11751cb0ef41Sopenharmony_ci void hadd_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 11761cb0ef41Sopenharmony_ci void hadd_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 11771cb0ef41Sopenharmony_ci void hadd_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 11781cb0ef41Sopenharmony_ci void hadd_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 11791cb0ef41Sopenharmony_ci void hadd_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 11801cb0ef41Sopenharmony_ci void hadd_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 11811cb0ef41Sopenharmony_ci void hadd_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 11821cb0ef41Sopenharmony_ci void hsub_s_b(MSARegister wd, MSARegister ws, MSARegister wt); 11831cb0ef41Sopenharmony_ci void hsub_s_h(MSARegister wd, MSARegister ws, MSARegister wt); 11841cb0ef41Sopenharmony_ci void hsub_s_w(MSARegister wd, MSARegister ws, MSARegister wt); 11851cb0ef41Sopenharmony_ci void hsub_s_d(MSARegister wd, MSARegister ws, MSARegister wt); 11861cb0ef41Sopenharmony_ci void hsub_u_b(MSARegister wd, MSARegister ws, MSARegister wt); 11871cb0ef41Sopenharmony_ci void hsub_u_h(MSARegister wd, MSARegister ws, MSARegister wt); 11881cb0ef41Sopenharmony_ci void hsub_u_w(MSARegister wd, MSARegister ws, MSARegister wt); 11891cb0ef41Sopenharmony_ci void hsub_u_d(MSARegister wd, MSARegister ws, MSARegister wt); 11901cb0ef41Sopenharmony_ci 11911cb0ef41Sopenharmony_ci void fcaf_w(MSARegister wd, MSARegister ws, MSARegister wt); 11921cb0ef41Sopenharmony_ci void fcaf_d(MSARegister wd, MSARegister ws, MSARegister wt); 11931cb0ef41Sopenharmony_ci void fcun_w(MSARegister wd, MSARegister ws, MSARegister wt); 11941cb0ef41Sopenharmony_ci void fcun_d(MSARegister wd, MSARegister ws, MSARegister wt); 11951cb0ef41Sopenharmony_ci void fceq_w(MSARegister wd, MSARegister ws, MSARegister wt); 11961cb0ef41Sopenharmony_ci void fceq_d(MSARegister wd, MSARegister ws, MSARegister wt); 11971cb0ef41Sopenharmony_ci void fcueq_w(MSARegister wd, MSARegister ws, MSARegister wt); 11981cb0ef41Sopenharmony_ci void fcueq_d(MSARegister wd, MSARegister ws, MSARegister wt); 11991cb0ef41Sopenharmony_ci void fclt_w(MSARegister wd, MSARegister ws, MSARegister wt); 12001cb0ef41Sopenharmony_ci void fclt_d(MSARegister wd, MSARegister ws, MSARegister wt); 12011cb0ef41Sopenharmony_ci void fcult_w(MSARegister wd, MSARegister ws, MSARegister wt); 12021cb0ef41Sopenharmony_ci void fcult_d(MSARegister wd, MSARegister ws, MSARegister wt); 12031cb0ef41Sopenharmony_ci void fcle_w(MSARegister wd, MSARegister ws, MSARegister wt); 12041cb0ef41Sopenharmony_ci void fcle_d(MSARegister wd, MSARegister ws, MSARegister wt); 12051cb0ef41Sopenharmony_ci void fcule_w(MSARegister wd, MSARegister ws, MSARegister wt); 12061cb0ef41Sopenharmony_ci void fcule_d(MSARegister wd, MSARegister ws, MSARegister wt); 12071cb0ef41Sopenharmony_ci void fsaf_w(MSARegister wd, MSARegister ws, MSARegister wt); 12081cb0ef41Sopenharmony_ci void fsaf_d(MSARegister wd, MSARegister ws, MSARegister wt); 12091cb0ef41Sopenharmony_ci void fsun_w(MSARegister wd, MSARegister ws, MSARegister wt); 12101cb0ef41Sopenharmony_ci void fsun_d(MSARegister wd, MSARegister ws, MSARegister wt); 12111cb0ef41Sopenharmony_ci void fseq_w(MSARegister wd, MSARegister ws, MSARegister wt); 12121cb0ef41Sopenharmony_ci void fseq_d(MSARegister wd, MSARegister ws, MSARegister wt); 12131cb0ef41Sopenharmony_ci void fsueq_w(MSARegister wd, MSARegister ws, MSARegister wt); 12141cb0ef41Sopenharmony_ci void fsueq_d(MSARegister wd, MSARegister ws, MSARegister wt); 12151cb0ef41Sopenharmony_ci void fslt_w(MSARegister wd, MSARegister ws, MSARegister wt); 12161cb0ef41Sopenharmony_ci void fslt_d(MSARegister wd, MSARegister ws, MSARegister wt); 12171cb0ef41Sopenharmony_ci void fsult_w(MSARegister wd, MSARegister ws, MSARegister wt); 12181cb0ef41Sopenharmony_ci void fsult_d(MSARegister wd, MSARegister ws, MSARegister wt); 12191cb0ef41Sopenharmony_ci void fsle_w(MSARegister wd, MSARegister ws, MSARegister wt); 12201cb0ef41Sopenharmony_ci void fsle_d(MSARegister wd, MSARegister ws, MSARegister wt); 12211cb0ef41Sopenharmony_ci void fsule_w(MSARegister wd, MSARegister ws, MSARegister wt); 12221cb0ef41Sopenharmony_ci void fsule_d(MSARegister wd, MSARegister ws, MSARegister wt); 12231cb0ef41Sopenharmony_ci void fadd_w(MSARegister wd, MSARegister ws, MSARegister wt); 12241cb0ef41Sopenharmony_ci void fadd_d(MSARegister wd, MSARegister ws, MSARegister wt); 12251cb0ef41Sopenharmony_ci void fsub_w(MSARegister wd, MSARegister ws, MSARegister wt); 12261cb0ef41Sopenharmony_ci void fsub_d(MSARegister wd, MSARegister ws, MSARegister wt); 12271cb0ef41Sopenharmony_ci void fmul_w(MSARegister wd, MSARegister ws, MSARegister wt); 12281cb0ef41Sopenharmony_ci void fmul_d(MSARegister wd, MSARegister ws, MSARegister wt); 12291cb0ef41Sopenharmony_ci void fdiv_w(MSARegister wd, MSARegister ws, MSARegister wt); 12301cb0ef41Sopenharmony_ci void fdiv_d(MSARegister wd, MSARegister ws, MSARegister wt); 12311cb0ef41Sopenharmony_ci void fmadd_w(MSARegister wd, MSARegister ws, MSARegister wt); 12321cb0ef41Sopenharmony_ci void fmadd_d(MSARegister wd, MSARegister ws, MSARegister wt); 12331cb0ef41Sopenharmony_ci void fmsub_w(MSARegister wd, MSARegister ws, MSARegister wt); 12341cb0ef41Sopenharmony_ci void fmsub_d(MSARegister wd, MSARegister ws, MSARegister wt); 12351cb0ef41Sopenharmony_ci void fexp2_w(MSARegister wd, MSARegister ws, MSARegister wt); 12361cb0ef41Sopenharmony_ci void fexp2_d(MSARegister wd, MSARegister ws, MSARegister wt); 12371cb0ef41Sopenharmony_ci void fexdo_h(MSARegister wd, MSARegister ws, MSARegister wt); 12381cb0ef41Sopenharmony_ci void fexdo_w(MSARegister wd, MSARegister ws, MSARegister wt); 12391cb0ef41Sopenharmony_ci void ftq_h(MSARegister wd, MSARegister ws, MSARegister wt); 12401cb0ef41Sopenharmony_ci void ftq_w(MSARegister wd, MSARegister ws, MSARegister wt); 12411cb0ef41Sopenharmony_ci void fmin_w(MSARegister wd, MSARegister ws, MSARegister wt); 12421cb0ef41Sopenharmony_ci void fmin_d(MSARegister wd, MSARegister ws, MSARegister wt); 12431cb0ef41Sopenharmony_ci void fmin_a_w(MSARegister wd, MSARegister ws, MSARegister wt); 12441cb0ef41Sopenharmony_ci void fmin_a_d(MSARegister wd, MSARegister ws, MSARegister wt); 12451cb0ef41Sopenharmony_ci void fmax_w(MSARegister wd, MSARegister ws, MSARegister wt); 12461cb0ef41Sopenharmony_ci void fmax_d(MSARegister wd, MSARegister ws, MSARegister wt); 12471cb0ef41Sopenharmony_ci void fmax_a_w(MSARegister wd, MSARegister ws, MSARegister wt); 12481cb0ef41Sopenharmony_ci void fmax_a_d(MSARegister wd, MSARegister ws, MSARegister wt); 12491cb0ef41Sopenharmony_ci void fcor_w(MSARegister wd, MSARegister ws, MSARegister wt); 12501cb0ef41Sopenharmony_ci void fcor_d(MSARegister wd, MSARegister ws, MSARegister wt); 12511cb0ef41Sopenharmony_ci void fcune_w(MSARegister wd, MSARegister ws, MSARegister wt); 12521cb0ef41Sopenharmony_ci void fcune_d(MSARegister wd, MSARegister ws, MSARegister wt); 12531cb0ef41Sopenharmony_ci void fcne_w(MSARegister wd, MSARegister ws, MSARegister wt); 12541cb0ef41Sopenharmony_ci void fcne_d(MSARegister wd, MSARegister ws, MSARegister wt); 12551cb0ef41Sopenharmony_ci void mul_q_h(MSARegister wd, MSARegister ws, MSARegister wt); 12561cb0ef41Sopenharmony_ci void mul_q_w(MSARegister wd, MSARegister ws, MSARegister wt); 12571cb0ef41Sopenharmony_ci void madd_q_h(MSARegister wd, MSARegister ws, MSARegister wt); 12581cb0ef41Sopenharmony_ci void madd_q_w(MSARegister wd, MSARegister ws, MSARegister wt); 12591cb0ef41Sopenharmony_ci void msub_q_h(MSARegister wd, MSARegister ws, MSARegister wt); 12601cb0ef41Sopenharmony_ci void msub_q_w(MSARegister wd, MSARegister ws, MSARegister wt); 12611cb0ef41Sopenharmony_ci void fsor_w(MSARegister wd, MSARegister ws, MSARegister wt); 12621cb0ef41Sopenharmony_ci void fsor_d(MSARegister wd, MSARegister ws, MSARegister wt); 12631cb0ef41Sopenharmony_ci void fsune_w(MSARegister wd, MSARegister ws, MSARegister wt); 12641cb0ef41Sopenharmony_ci void fsune_d(MSARegister wd, MSARegister ws, MSARegister wt); 12651cb0ef41Sopenharmony_ci void fsne_w(MSARegister wd, MSARegister ws, MSARegister wt); 12661cb0ef41Sopenharmony_ci void fsne_d(MSARegister wd, MSARegister ws, MSARegister wt); 12671cb0ef41Sopenharmony_ci void mulr_q_h(MSARegister wd, MSARegister ws, MSARegister wt); 12681cb0ef41Sopenharmony_ci void mulr_q_w(MSARegister wd, MSARegister ws, MSARegister wt); 12691cb0ef41Sopenharmony_ci void maddr_q_h(MSARegister wd, MSARegister ws, MSARegister wt); 12701cb0ef41Sopenharmony_ci void maddr_q_w(MSARegister wd, MSARegister ws, MSARegister wt); 12711cb0ef41Sopenharmony_ci void msubr_q_h(MSARegister wd, MSARegister ws, MSARegister wt); 12721cb0ef41Sopenharmony_ci void msubr_q_w(MSARegister wd, MSARegister ws, MSARegister wt); 12731cb0ef41Sopenharmony_ci 12741cb0ef41Sopenharmony_ci void sldi_b(MSARegister wd, MSARegister ws, uint32_t n); 12751cb0ef41Sopenharmony_ci void sldi_h(MSARegister wd, MSARegister ws, uint32_t n); 12761cb0ef41Sopenharmony_ci void sldi_w(MSARegister wd, MSARegister ws, uint32_t n); 12771cb0ef41Sopenharmony_ci void sldi_d(MSARegister wd, MSARegister ws, uint32_t n); 12781cb0ef41Sopenharmony_ci void splati_b(MSARegister wd, MSARegister ws, uint32_t n); 12791cb0ef41Sopenharmony_ci void splati_h(MSARegister wd, MSARegister ws, uint32_t n); 12801cb0ef41Sopenharmony_ci void splati_w(MSARegister wd, MSARegister ws, uint32_t n); 12811cb0ef41Sopenharmony_ci void splati_d(MSARegister wd, MSARegister ws, uint32_t n); 12821cb0ef41Sopenharmony_ci void copy_s_b(Register rd, MSARegister ws, uint32_t n); 12831cb0ef41Sopenharmony_ci void copy_s_h(Register rd, MSARegister ws, uint32_t n); 12841cb0ef41Sopenharmony_ci void copy_s_w(Register rd, MSARegister ws, uint32_t n); 12851cb0ef41Sopenharmony_ci void copy_u_b(Register rd, MSARegister ws, uint32_t n); 12861cb0ef41Sopenharmony_ci void copy_u_h(Register rd, MSARegister ws, uint32_t n); 12871cb0ef41Sopenharmony_ci void copy_u_w(Register rd, MSARegister ws, uint32_t n); 12881cb0ef41Sopenharmony_ci void insert_b(MSARegister wd, uint32_t n, Register rs); 12891cb0ef41Sopenharmony_ci void insert_h(MSARegister wd, uint32_t n, Register rs); 12901cb0ef41Sopenharmony_ci void insert_w(MSARegister wd, uint32_t n, Register rs); 12911cb0ef41Sopenharmony_ci void insve_b(MSARegister wd, uint32_t n, MSARegister ws); 12921cb0ef41Sopenharmony_ci void insve_h(MSARegister wd, uint32_t n, MSARegister ws); 12931cb0ef41Sopenharmony_ci void insve_w(MSARegister wd, uint32_t n, MSARegister ws); 12941cb0ef41Sopenharmony_ci void insve_d(MSARegister wd, uint32_t n, MSARegister ws); 12951cb0ef41Sopenharmony_ci void move_v(MSARegister wd, MSARegister ws); 12961cb0ef41Sopenharmony_ci void ctcmsa(MSAControlRegister cd, Register rs); 12971cb0ef41Sopenharmony_ci void cfcmsa(Register rd, MSAControlRegister cs); 12981cb0ef41Sopenharmony_ci 12991cb0ef41Sopenharmony_ci void slli_b(MSARegister wd, MSARegister ws, uint32_t m); 13001cb0ef41Sopenharmony_ci void slli_h(MSARegister wd, MSARegister ws, uint32_t m); 13011cb0ef41Sopenharmony_ci void slli_w(MSARegister wd, MSARegister ws, uint32_t m); 13021cb0ef41Sopenharmony_ci void slli_d(MSARegister wd, MSARegister ws, uint32_t m); 13031cb0ef41Sopenharmony_ci void srai_b(MSARegister wd, MSARegister ws, uint32_t m); 13041cb0ef41Sopenharmony_ci void srai_h(MSARegister wd, MSARegister ws, uint32_t m); 13051cb0ef41Sopenharmony_ci void srai_w(MSARegister wd, MSARegister ws, uint32_t m); 13061cb0ef41Sopenharmony_ci void srai_d(MSARegister wd, MSARegister ws, uint32_t m); 13071cb0ef41Sopenharmony_ci void srli_b(MSARegister wd, MSARegister ws, uint32_t m); 13081cb0ef41Sopenharmony_ci void srli_h(MSARegister wd, MSARegister ws, uint32_t m); 13091cb0ef41Sopenharmony_ci void srli_w(MSARegister wd, MSARegister ws, uint32_t m); 13101cb0ef41Sopenharmony_ci void srli_d(MSARegister wd, MSARegister ws, uint32_t m); 13111cb0ef41Sopenharmony_ci void bclri_b(MSARegister wd, MSARegister ws, uint32_t m); 13121cb0ef41Sopenharmony_ci void bclri_h(MSARegister wd, MSARegister ws, uint32_t m); 13131cb0ef41Sopenharmony_ci void bclri_w(MSARegister wd, MSARegister ws, uint32_t m); 13141cb0ef41Sopenharmony_ci void bclri_d(MSARegister wd, MSARegister ws, uint32_t m); 13151cb0ef41Sopenharmony_ci void bseti_b(MSARegister wd, MSARegister ws, uint32_t m); 13161cb0ef41Sopenharmony_ci void bseti_h(MSARegister wd, MSARegister ws, uint32_t m); 13171cb0ef41Sopenharmony_ci void bseti_w(MSARegister wd, MSARegister ws, uint32_t m); 13181cb0ef41Sopenharmony_ci void bseti_d(MSARegister wd, MSARegister ws, uint32_t m); 13191cb0ef41Sopenharmony_ci void bnegi_b(MSARegister wd, MSARegister ws, uint32_t m); 13201cb0ef41Sopenharmony_ci void bnegi_h(MSARegister wd, MSARegister ws, uint32_t m); 13211cb0ef41Sopenharmony_ci void bnegi_w(MSARegister wd, MSARegister ws, uint32_t m); 13221cb0ef41Sopenharmony_ci void bnegi_d(MSARegister wd, MSARegister ws, uint32_t m); 13231cb0ef41Sopenharmony_ci void binsli_b(MSARegister wd, MSARegister ws, uint32_t m); 13241cb0ef41Sopenharmony_ci void binsli_h(MSARegister wd, MSARegister ws, uint32_t m); 13251cb0ef41Sopenharmony_ci void binsli_w(MSARegister wd, MSARegister ws, uint32_t m); 13261cb0ef41Sopenharmony_ci void binsli_d(MSARegister wd, MSARegister ws, uint32_t m); 13271cb0ef41Sopenharmony_ci void binsri_b(MSARegister wd, MSARegister ws, uint32_t m); 13281cb0ef41Sopenharmony_ci void binsri_h(MSARegister wd, MSARegister ws, uint32_t m); 13291cb0ef41Sopenharmony_ci void binsri_w(MSARegister wd, MSARegister ws, uint32_t m); 13301cb0ef41Sopenharmony_ci void binsri_d(MSARegister wd, MSARegister ws, uint32_t m); 13311cb0ef41Sopenharmony_ci void sat_s_b(MSARegister wd, MSARegister ws, uint32_t m); 13321cb0ef41Sopenharmony_ci void sat_s_h(MSARegister wd, MSARegister ws, uint32_t m); 13331cb0ef41Sopenharmony_ci void sat_s_w(MSARegister wd, MSARegister ws, uint32_t m); 13341cb0ef41Sopenharmony_ci void sat_s_d(MSARegister wd, MSARegister ws, uint32_t m); 13351cb0ef41Sopenharmony_ci void sat_u_b(MSARegister wd, MSARegister ws, uint32_t m); 13361cb0ef41Sopenharmony_ci void sat_u_h(MSARegister wd, MSARegister ws, uint32_t m); 13371cb0ef41Sopenharmony_ci void sat_u_w(MSARegister wd, MSARegister ws, uint32_t m); 13381cb0ef41Sopenharmony_ci void sat_u_d(MSARegister wd, MSARegister ws, uint32_t m); 13391cb0ef41Sopenharmony_ci void srari_b(MSARegister wd, MSARegister ws, uint32_t m); 13401cb0ef41Sopenharmony_ci void srari_h(MSARegister wd, MSARegister ws, uint32_t m); 13411cb0ef41Sopenharmony_ci void srari_w(MSARegister wd, MSARegister ws, uint32_t m); 13421cb0ef41Sopenharmony_ci void srari_d(MSARegister wd, MSARegister ws, uint32_t m); 13431cb0ef41Sopenharmony_ci void srlri_b(MSARegister wd, MSARegister ws, uint32_t m); 13441cb0ef41Sopenharmony_ci void srlri_h(MSARegister wd, MSARegister ws, uint32_t m); 13451cb0ef41Sopenharmony_ci void srlri_w(MSARegister wd, MSARegister ws, uint32_t m); 13461cb0ef41Sopenharmony_ci void srlri_d(MSARegister wd, MSARegister ws, uint32_t m); 13471cb0ef41Sopenharmony_ci 13481cb0ef41Sopenharmony_ci // Check the code size generated from label to here. 13491cb0ef41Sopenharmony_ci int SizeOfCodeGeneratedSince(Label* label) { 13501cb0ef41Sopenharmony_ci return pc_offset() - label->pos(); 13511cb0ef41Sopenharmony_ci } 13521cb0ef41Sopenharmony_ci 13531cb0ef41Sopenharmony_ci // Check the number of instructions generated from label to here. 13541cb0ef41Sopenharmony_ci int InstructionsGeneratedSince(Label* label) { 13551cb0ef41Sopenharmony_ci return SizeOfCodeGeneratedSince(label) / kInstrSize; 13561cb0ef41Sopenharmony_ci } 13571cb0ef41Sopenharmony_ci 13581cb0ef41Sopenharmony_ci // Class for scoping postponing the trampoline pool generation. 13591cb0ef41Sopenharmony_ci class V8_NODISCARD BlockTrampolinePoolScope { 13601cb0ef41Sopenharmony_ci public: 13611cb0ef41Sopenharmony_ci explicit BlockTrampolinePoolScope(Assembler* assem) : assem_(assem) { 13621cb0ef41Sopenharmony_ci assem_->StartBlockTrampolinePool(); 13631cb0ef41Sopenharmony_ci } 13641cb0ef41Sopenharmony_ci ~BlockTrampolinePoolScope() { assem_->EndBlockTrampolinePool(); } 13651cb0ef41Sopenharmony_ci 13661cb0ef41Sopenharmony_ci private: 13671cb0ef41Sopenharmony_ci Assembler* assem_; 13681cb0ef41Sopenharmony_ci 13691cb0ef41Sopenharmony_ci DISALLOW_IMPLICIT_CONSTRUCTORS(BlockTrampolinePoolScope); 13701cb0ef41Sopenharmony_ci }; 13711cb0ef41Sopenharmony_ci 13721cb0ef41Sopenharmony_ci // Class for postponing the assembly buffer growth. Typically used for 13731cb0ef41Sopenharmony_ci // sequences of instructions that must be emitted as a unit, before 13741cb0ef41Sopenharmony_ci // buffer growth (and relocation) can occur. 13751cb0ef41Sopenharmony_ci // This blocking scope is not nestable. 13761cb0ef41Sopenharmony_ci class V8_NODISCARD BlockGrowBufferScope { 13771cb0ef41Sopenharmony_ci public: 13781cb0ef41Sopenharmony_ci explicit BlockGrowBufferScope(Assembler* assem) : assem_(assem) { 13791cb0ef41Sopenharmony_ci assem_->StartBlockGrowBuffer(); 13801cb0ef41Sopenharmony_ci } 13811cb0ef41Sopenharmony_ci ~BlockGrowBufferScope() { assem_->EndBlockGrowBuffer(); } 13821cb0ef41Sopenharmony_ci 13831cb0ef41Sopenharmony_ci private: 13841cb0ef41Sopenharmony_ci Assembler* assem_; 13851cb0ef41Sopenharmony_ci 13861cb0ef41Sopenharmony_ci DISALLOW_IMPLICIT_CONSTRUCTORS(BlockGrowBufferScope); 13871cb0ef41Sopenharmony_ci }; 13881cb0ef41Sopenharmony_ci 13891cb0ef41Sopenharmony_ci // Record a deoptimization reason that can be used by a log or cpu profiler. 13901cb0ef41Sopenharmony_ci // Use --trace-deopt to enable. 13911cb0ef41Sopenharmony_ci void RecordDeoptReason(DeoptimizeReason reason, uint32_t node_id, 13921cb0ef41Sopenharmony_ci SourcePosition position, int id); 13931cb0ef41Sopenharmony_ci 13941cb0ef41Sopenharmony_ci static int RelocateInternalReference(RelocInfo::Mode rmode, Address pc, 13951cb0ef41Sopenharmony_ci intptr_t pc_delta); 13961cb0ef41Sopenharmony_ci 13971cb0ef41Sopenharmony_ci static void RelocateRelativeReference(RelocInfo::Mode rmode, Address pc, 13981cb0ef41Sopenharmony_ci intptr_t pc_delta); 13991cb0ef41Sopenharmony_ci 14001cb0ef41Sopenharmony_ci // Writes a single byte or word of data in the code stream. Used for 14011cb0ef41Sopenharmony_ci // inline tables, e.g., jump-tables. 14021cb0ef41Sopenharmony_ci void db(uint8_t data); 14031cb0ef41Sopenharmony_ci void dd(uint32_t data, RelocInfo::Mode rmode = RelocInfo::NO_INFO); 14041cb0ef41Sopenharmony_ci void dq(uint64_t data, RelocInfo::Mode rmode = RelocInfo::NO_INFO); 14051cb0ef41Sopenharmony_ci void dp(uintptr_t data, RelocInfo::Mode rmode = RelocInfo::NO_INFO) { 14061cb0ef41Sopenharmony_ci dd(data, rmode); 14071cb0ef41Sopenharmony_ci } 14081cb0ef41Sopenharmony_ci void dd(Label* label); 14091cb0ef41Sopenharmony_ci 14101cb0ef41Sopenharmony_ci // Postpone the generation of the trampoline pool for the specified number of 14111cb0ef41Sopenharmony_ci // instructions. 14121cb0ef41Sopenharmony_ci void BlockTrampolinePoolFor(int instructions); 14131cb0ef41Sopenharmony_ci 14141cb0ef41Sopenharmony_ci // Check if there is less than kGap bytes available in the buffer. 14151cb0ef41Sopenharmony_ci // If this is the case, we need to grow the buffer before emitting 14161cb0ef41Sopenharmony_ci // an instruction or relocation information. 14171cb0ef41Sopenharmony_ci inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; } 14181cb0ef41Sopenharmony_ci 14191cb0ef41Sopenharmony_ci // Get the number of bytes available in the buffer. 14201cb0ef41Sopenharmony_ci inline int available_space() const { return reloc_info_writer.pos() - pc_; } 14211cb0ef41Sopenharmony_ci 14221cb0ef41Sopenharmony_ci // Read/patch instructions. 14231cb0ef41Sopenharmony_ci static Instr instr_at(Address pc) { return *reinterpret_cast<Instr*>(pc); } 14241cb0ef41Sopenharmony_ci static void instr_at_put(Address pc, Instr instr) { 14251cb0ef41Sopenharmony_ci *reinterpret_cast<Instr*>(pc) = instr; 14261cb0ef41Sopenharmony_ci } 14271cb0ef41Sopenharmony_ci Instr instr_at(int pos) { 14281cb0ef41Sopenharmony_ci return *reinterpret_cast<Instr*>(buffer_start_ + pos); 14291cb0ef41Sopenharmony_ci } 14301cb0ef41Sopenharmony_ci void instr_at_put(int pos, Instr instr) { 14311cb0ef41Sopenharmony_ci *reinterpret_cast<Instr*>(buffer_start_ + pos) = instr; 14321cb0ef41Sopenharmony_ci } 14331cb0ef41Sopenharmony_ci 14341cb0ef41Sopenharmony_ci // Check if an instruction is a branch of some kind. 14351cb0ef41Sopenharmony_ci static bool IsBranch(Instr instr); 14361cb0ef41Sopenharmony_ci static bool IsMsaBranch(Instr instr); 14371cb0ef41Sopenharmony_ci static bool IsBc(Instr instr); 14381cb0ef41Sopenharmony_ci static bool IsNal(Instr instr); 14391cb0ef41Sopenharmony_ci static bool IsBzc(Instr instr); 14401cb0ef41Sopenharmony_ci static bool IsBeq(Instr instr); 14411cb0ef41Sopenharmony_ci static bool IsBne(Instr instr); 14421cb0ef41Sopenharmony_ci static bool IsBeqzc(Instr instr); 14431cb0ef41Sopenharmony_ci static bool IsBnezc(Instr instr); 14441cb0ef41Sopenharmony_ci static bool IsBeqc(Instr instr); 14451cb0ef41Sopenharmony_ci static bool IsBnec(Instr instr); 14461cb0ef41Sopenharmony_ci static bool IsJicOrJialc(Instr instr); 14471cb0ef41Sopenharmony_ci static bool IsMov(Instr instr, Register rd, Register rs); 14481cb0ef41Sopenharmony_ci 14491cb0ef41Sopenharmony_ci static bool IsJump(Instr instr); 14501cb0ef41Sopenharmony_ci static bool IsJ(Instr instr); 14511cb0ef41Sopenharmony_ci static bool IsLui(Instr instr); 14521cb0ef41Sopenharmony_ci static bool IsOri(Instr instr); 14531cb0ef41Sopenharmony_ci static bool IsAddu(Instr instr, Register rd, Register rs, Register rt); 14541cb0ef41Sopenharmony_ci 14551cb0ef41Sopenharmony_ci static bool IsJal(Instr instr); 14561cb0ef41Sopenharmony_ci static bool IsJr(Instr instr); 14571cb0ef41Sopenharmony_ci static bool IsJalr(Instr instr); 14581cb0ef41Sopenharmony_ci 14591cb0ef41Sopenharmony_ci static bool IsNop(Instr instr, unsigned int type); 14601cb0ef41Sopenharmony_ci static bool IsPop(Instr instr); 14611cb0ef41Sopenharmony_ci static bool IsPush(Instr instr); 14621cb0ef41Sopenharmony_ci static bool IsLwRegFpOffset(Instr instr); 14631cb0ef41Sopenharmony_ci static bool IsSwRegFpOffset(Instr instr); 14641cb0ef41Sopenharmony_ci static bool IsLwRegFpNegOffset(Instr instr); 14651cb0ef41Sopenharmony_ci static bool IsSwRegFpNegOffset(Instr instr); 14661cb0ef41Sopenharmony_ci 14671cb0ef41Sopenharmony_ci static Register GetRtReg(Instr instr); 14681cb0ef41Sopenharmony_ci static Register GetRsReg(Instr instr); 14691cb0ef41Sopenharmony_ci static Register GetRdReg(Instr instr); 14701cb0ef41Sopenharmony_ci 14711cb0ef41Sopenharmony_ci static uint32_t GetRt(Instr instr); 14721cb0ef41Sopenharmony_ci static uint32_t GetRtField(Instr instr); 14731cb0ef41Sopenharmony_ci static uint32_t GetRs(Instr instr); 14741cb0ef41Sopenharmony_ci static uint32_t GetRsField(Instr instr); 14751cb0ef41Sopenharmony_ci static uint32_t GetRd(Instr instr); 14761cb0ef41Sopenharmony_ci static uint32_t GetRdField(Instr instr); 14771cb0ef41Sopenharmony_ci static uint32_t GetSa(Instr instr); 14781cb0ef41Sopenharmony_ci static uint32_t GetSaField(Instr instr); 14791cb0ef41Sopenharmony_ci static uint32_t GetOpcodeField(Instr instr); 14801cb0ef41Sopenharmony_ci static uint32_t GetFunction(Instr instr); 14811cb0ef41Sopenharmony_ci static uint32_t GetFunctionField(Instr instr); 14821cb0ef41Sopenharmony_ci static uint32_t GetImmediate16(Instr instr); 14831cb0ef41Sopenharmony_ci static uint32_t GetLabelConst(Instr instr); 14841cb0ef41Sopenharmony_ci 14851cb0ef41Sopenharmony_ci static int32_t GetBranchOffset(Instr instr); 14861cb0ef41Sopenharmony_ci static bool IsLw(Instr instr); 14871cb0ef41Sopenharmony_ci static int16_t GetLwOffset(Instr instr); 14881cb0ef41Sopenharmony_ci static int16_t GetJicOrJialcOffset(Instr instr); 14891cb0ef41Sopenharmony_ci static int16_t GetLuiOffset(Instr instr); 14901cb0ef41Sopenharmony_ci static Instr SetLwOffset(Instr instr, int16_t offset); 14911cb0ef41Sopenharmony_ci 14921cb0ef41Sopenharmony_ci static bool IsSw(Instr instr); 14931cb0ef41Sopenharmony_ci static Instr SetSwOffset(Instr instr, int16_t offset); 14941cb0ef41Sopenharmony_ci static bool IsAddImmediate(Instr instr); 14951cb0ef41Sopenharmony_ci static Instr SetAddImmediateOffset(Instr instr, int16_t offset); 14961cb0ef41Sopenharmony_ci static uint32_t CreateTargetAddress(Instr instr_lui, Instr instr_jic); 14971cb0ef41Sopenharmony_ci static void UnpackTargetAddress(uint32_t address, int16_t* lui_offset, 14981cb0ef41Sopenharmony_ci int16_t* jic_offset); 14991cb0ef41Sopenharmony_ci static void UnpackTargetAddressUnsigned(uint32_t address, 15001cb0ef41Sopenharmony_ci uint32_t* lui_offset, 15011cb0ef41Sopenharmony_ci uint32_t* jic_offset); 15021cb0ef41Sopenharmony_ci 15031cb0ef41Sopenharmony_ci static bool IsAndImmediate(Instr instr); 15041cb0ef41Sopenharmony_ci static bool IsEmittedConstant(Instr instr); 15051cb0ef41Sopenharmony_ci 15061cb0ef41Sopenharmony_ci void CheckTrampolinePool(); 15071cb0ef41Sopenharmony_ci 15081cb0ef41Sopenharmony_ci bool IsPrevInstrCompactBranch() { return prev_instr_compact_branch_; } 15091cb0ef41Sopenharmony_ci static bool IsCompactBranchSupported() { 15101cb0ef41Sopenharmony_ci return IsMipsArchVariant(kMips32r6); 15111cb0ef41Sopenharmony_ci } 15121cb0ef41Sopenharmony_ci 15131cb0ef41Sopenharmony_ci // Get the code target object for a pc-relative call or jump. 15141cb0ef41Sopenharmony_ci V8_INLINE Handle<Code> relative_code_target_object_handle_at( 15151cb0ef41Sopenharmony_ci Address pc_) const; 15161cb0ef41Sopenharmony_ci 15171cb0ef41Sopenharmony_ci inline int UnboundLabelsCount() { return unbound_labels_count_; } 15181cb0ef41Sopenharmony_ci 15191cb0ef41Sopenharmony_ci bool is_trampoline_emitted() const { return trampoline_emitted_; } 15201cb0ef41Sopenharmony_ci 15211cb0ef41Sopenharmony_ci protected: 15221cb0ef41Sopenharmony_ci // Load Scaled Address instruction. 15231cb0ef41Sopenharmony_ci void lsa(Register rd, Register rt, Register rs, uint8_t sa); 15241cb0ef41Sopenharmony_ci 15251cb0ef41Sopenharmony_ci // Readable constants for base and offset adjustment helper, these indicate if 15261cb0ef41Sopenharmony_ci // aside from offset, another value like offset + 4 should fit into int16. 15271cb0ef41Sopenharmony_ci enum class OffsetAccessType : bool { 15281cb0ef41Sopenharmony_ci SINGLE_ACCESS = false, 15291cb0ef41Sopenharmony_ci TWO_ACCESSES = true 15301cb0ef41Sopenharmony_ci }; 15311cb0ef41Sopenharmony_ci 15321cb0ef41Sopenharmony_ci // Helper function for memory load/store using base register and offset. 15331cb0ef41Sopenharmony_ci void AdjustBaseAndOffset( 15341cb0ef41Sopenharmony_ci MemOperand* src, 15351cb0ef41Sopenharmony_ci OffsetAccessType access_type = OffsetAccessType::SINGLE_ACCESS, 15361cb0ef41Sopenharmony_ci int second_access_add_to_offset = 4); 15371cb0ef41Sopenharmony_ci 15381cb0ef41Sopenharmony_ci int32_t buffer_space() const { return reloc_info_writer.pos() - pc_; } 15391cb0ef41Sopenharmony_ci 15401cb0ef41Sopenharmony_ci // Decode branch instruction at pos and return branch target pos. 15411cb0ef41Sopenharmony_ci int target_at(int pos, bool is_internal); 15421cb0ef41Sopenharmony_ci 15431cb0ef41Sopenharmony_ci // Patch branch instruction at pos to branch to given branch target pos. 15441cb0ef41Sopenharmony_ci void target_at_put(int pos, int target_pos, bool is_internal); 15451cb0ef41Sopenharmony_ci 15461cb0ef41Sopenharmony_ci // Say if we need to relocate with this mode. 15471cb0ef41Sopenharmony_ci bool MustUseReg(RelocInfo::Mode rmode); 15481cb0ef41Sopenharmony_ci 15491cb0ef41Sopenharmony_ci // Record reloc info for current pc_. 15501cb0ef41Sopenharmony_ci void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); 15511cb0ef41Sopenharmony_ci 15521cb0ef41Sopenharmony_ci // Read 32-bit immediate from lui, ori pair that is used to load immediate. 15531cb0ef41Sopenharmony_ci static int32_t GetLuiOriImmediate(Instr instr1, Instr instr2); 15541cb0ef41Sopenharmony_ci 15551cb0ef41Sopenharmony_ci // Block the emission of the trampoline pool before pc_offset. 15561cb0ef41Sopenharmony_ci void BlockTrampolinePoolBefore(int pc_offset) { 15571cb0ef41Sopenharmony_ci if (no_trampoline_pool_before_ < pc_offset) 15581cb0ef41Sopenharmony_ci no_trampoline_pool_before_ = pc_offset; 15591cb0ef41Sopenharmony_ci } 15601cb0ef41Sopenharmony_ci 15611cb0ef41Sopenharmony_ci void StartBlockTrampolinePool() { trampoline_pool_blocked_nesting_++; } 15621cb0ef41Sopenharmony_ci 15631cb0ef41Sopenharmony_ci void EndBlockTrampolinePool() { 15641cb0ef41Sopenharmony_ci trampoline_pool_blocked_nesting_--; 15651cb0ef41Sopenharmony_ci if (trampoline_pool_blocked_nesting_ == 0) { 15661cb0ef41Sopenharmony_ci CheckTrampolinePoolQuick(1); 15671cb0ef41Sopenharmony_ci } 15681cb0ef41Sopenharmony_ci } 15691cb0ef41Sopenharmony_ci 15701cb0ef41Sopenharmony_ci bool is_trampoline_pool_blocked() const { 15711cb0ef41Sopenharmony_ci return trampoline_pool_blocked_nesting_ > 0; 15721cb0ef41Sopenharmony_ci } 15731cb0ef41Sopenharmony_ci 15741cb0ef41Sopenharmony_ci bool has_exception() const { return internal_trampoline_exception_; } 15751cb0ef41Sopenharmony_ci 15761cb0ef41Sopenharmony_ci // Temporarily block automatic assembly buffer growth. 15771cb0ef41Sopenharmony_ci void StartBlockGrowBuffer() { 15781cb0ef41Sopenharmony_ci DCHECK(!block_buffer_growth_); 15791cb0ef41Sopenharmony_ci block_buffer_growth_ = true; 15801cb0ef41Sopenharmony_ci } 15811cb0ef41Sopenharmony_ci 15821cb0ef41Sopenharmony_ci void EndBlockGrowBuffer() { 15831cb0ef41Sopenharmony_ci DCHECK(block_buffer_growth_); 15841cb0ef41Sopenharmony_ci block_buffer_growth_ = false; 15851cb0ef41Sopenharmony_ci } 15861cb0ef41Sopenharmony_ci 15871cb0ef41Sopenharmony_ci bool is_buffer_growth_blocked() const { return block_buffer_growth_; } 15881cb0ef41Sopenharmony_ci 15891cb0ef41Sopenharmony_ci void EmitForbiddenSlotInstruction() { 15901cb0ef41Sopenharmony_ci if (IsPrevInstrCompactBranch()) { 15911cb0ef41Sopenharmony_ci nop(); 15921cb0ef41Sopenharmony_ci } 15931cb0ef41Sopenharmony_ci } 15941cb0ef41Sopenharmony_ci 15951cb0ef41Sopenharmony_ci inline void CheckTrampolinePoolQuick(int extra_instructions = 0) { 15961cb0ef41Sopenharmony_ci if (pc_offset() >= next_buffer_check_ - extra_instructions * kInstrSize) { 15971cb0ef41Sopenharmony_ci CheckTrampolinePool(); 15981cb0ef41Sopenharmony_ci } 15991cb0ef41Sopenharmony_ci } 16001cb0ef41Sopenharmony_ci 16011cb0ef41Sopenharmony_ci inline void CheckBuffer(); 16021cb0ef41Sopenharmony_ci 16031cb0ef41Sopenharmony_ci RegList scratch_register_list_; 16041cb0ef41Sopenharmony_ci 16051cb0ef41Sopenharmony_ci // Generate common instruction sequence. 16061cb0ef41Sopenharmony_ci void GenPCRelativeJump(Register tf, Register ts, int32_t imm32, 16071cb0ef41Sopenharmony_ci RelocInfo::Mode rmode, BranchDelaySlot bdslot); 16081cb0ef41Sopenharmony_ci void GenPCRelativeJumpAndLink(Register t, int32_t imm32, 16091cb0ef41Sopenharmony_ci RelocInfo::Mode rmode, BranchDelaySlot bdslot); 16101cb0ef41Sopenharmony_ci 16111cb0ef41Sopenharmony_ci void set_pc_for_safepoint() { pc_for_safepoint_ = pc_; } 16121cb0ef41Sopenharmony_ci 16131cb0ef41Sopenharmony_ci private: 16141cb0ef41Sopenharmony_ci // Avoid overflows for displacements etc. 16151cb0ef41Sopenharmony_ci static const int kMaximalBufferSize = 512 * MB; 16161cb0ef41Sopenharmony_ci 16171cb0ef41Sopenharmony_ci inline static void set_target_internal_reference_encoded_at(Address pc, 16181cb0ef41Sopenharmony_ci Address target); 16191cb0ef41Sopenharmony_ci 16201cb0ef41Sopenharmony_ci // Buffer size and constant pool distance are checked together at regular 16211cb0ef41Sopenharmony_ci // intervals of kBufferCheckInterval emitted bytes. 16221cb0ef41Sopenharmony_ci static constexpr int kBufferCheckInterval = 1 * KB / 2; 16231cb0ef41Sopenharmony_ci 16241cb0ef41Sopenharmony_ci // Code generation. 16251cb0ef41Sopenharmony_ci // The relocation writer's position is at least kGap bytes below the end of 16261cb0ef41Sopenharmony_ci // the generated instructions. This is so that multi-instruction sequences do 16271cb0ef41Sopenharmony_ci // not have to check for overflow. The same is true for writes of large 16281cb0ef41Sopenharmony_ci // relocation info entries. 16291cb0ef41Sopenharmony_ci static constexpr int kGap = 32; 16301cb0ef41Sopenharmony_ci STATIC_ASSERT(AssemblerBase::kMinimalBufferSize >= 2 * kGap); 16311cb0ef41Sopenharmony_ci 16321cb0ef41Sopenharmony_ci // Repeated checking whether the trampoline pool should be emitted is rather 16331cb0ef41Sopenharmony_ci // expensive. By default we only check again once a number of instructions 16341cb0ef41Sopenharmony_ci // has been generated. 16351cb0ef41Sopenharmony_ci static constexpr int kCheckConstIntervalInst = 32; 16361cb0ef41Sopenharmony_ci static constexpr int kCheckConstInterval = 16371cb0ef41Sopenharmony_ci kCheckConstIntervalInst * kInstrSize; 16381cb0ef41Sopenharmony_ci 16391cb0ef41Sopenharmony_ci int next_buffer_check_; // pc offset of next buffer check. 16401cb0ef41Sopenharmony_ci 16411cb0ef41Sopenharmony_ci // Emission of the trampoline pool may be blocked in some code sequences. 16421cb0ef41Sopenharmony_ci int trampoline_pool_blocked_nesting_; // Block emission if this is not zero. 16431cb0ef41Sopenharmony_ci int no_trampoline_pool_before_; // Block emission before this pc offset. 16441cb0ef41Sopenharmony_ci 16451cb0ef41Sopenharmony_ci // Keep track of the last emitted pool to guarantee a maximal distance. 16461cb0ef41Sopenharmony_ci int last_trampoline_pool_end_; // pc offset of the end of the last pool. 16471cb0ef41Sopenharmony_ci 16481cb0ef41Sopenharmony_ci // Automatic growth of the assembly buffer may be blocked for some sequences. 16491cb0ef41Sopenharmony_ci bool block_buffer_growth_; // Block growth when true. 16501cb0ef41Sopenharmony_ci 16511cb0ef41Sopenharmony_ci // Relocation information generation. 16521cb0ef41Sopenharmony_ci // Each relocation is encoded as a variable size value. 16531cb0ef41Sopenharmony_ci static constexpr int kMaxRelocSize = RelocInfoWriter::kMaxSize; 16541cb0ef41Sopenharmony_ci RelocInfoWriter reloc_info_writer; 16551cb0ef41Sopenharmony_ci 16561cb0ef41Sopenharmony_ci // The bound position, before this we cannot do instruction elimination. 16571cb0ef41Sopenharmony_ci int last_bound_pos_; 16581cb0ef41Sopenharmony_ci 16591cb0ef41Sopenharmony_ci // Readable constants for compact branch handling in emit() 16601cb0ef41Sopenharmony_ci enum class CompactBranchType : bool { NO = false, COMPACT_BRANCH = true }; 16611cb0ef41Sopenharmony_ci 16621cb0ef41Sopenharmony_ci // Code emission. 16631cb0ef41Sopenharmony_ci void GrowBuffer(); 16641cb0ef41Sopenharmony_ci inline void emit(Instr x, 16651cb0ef41Sopenharmony_ci CompactBranchType is_compact_branch = CompactBranchType::NO); 16661cb0ef41Sopenharmony_ci inline void emit(uint64_t x); 16671cb0ef41Sopenharmony_ci inline void CheckForEmitInForbiddenSlot(); 16681cb0ef41Sopenharmony_ci template <typename T> 16691cb0ef41Sopenharmony_ci inline void EmitHelper(T x); 16701cb0ef41Sopenharmony_ci inline void EmitHelper(Instr x, CompactBranchType is_compact_branch); 16711cb0ef41Sopenharmony_ci 16721cb0ef41Sopenharmony_ci // Instruction generation. 16731cb0ef41Sopenharmony_ci // We have 3 different kind of encoding layout on MIPS. 16741cb0ef41Sopenharmony_ci // However due to many different types of objects encoded in the same fields 16751cb0ef41Sopenharmony_ci // we have quite a few aliases for each mode. 16761cb0ef41Sopenharmony_ci // Using the same structure to refer to Register and FPURegister would spare a 16771cb0ef41Sopenharmony_ci // few aliases, but mixing both does not look clean to me. 16781cb0ef41Sopenharmony_ci // Anyway we could surely implement this differently. 16791cb0ef41Sopenharmony_ci 16801cb0ef41Sopenharmony_ci void GenInstrRegister(Opcode opcode, Register rs, Register rt, Register rd, 16811cb0ef41Sopenharmony_ci uint16_t sa = 0, SecondaryField func = nullptrSF); 16821cb0ef41Sopenharmony_ci 16831cb0ef41Sopenharmony_ci void GenInstrRegister(Opcode opcode, Register rs, Register rt, uint16_t msb, 16841cb0ef41Sopenharmony_ci uint16_t lsb, SecondaryField func); 16851cb0ef41Sopenharmony_ci 16861cb0ef41Sopenharmony_ci void GenInstrRegister(Opcode opcode, SecondaryField fmt, FPURegister ft, 16871cb0ef41Sopenharmony_ci FPURegister fs, FPURegister fd, 16881cb0ef41Sopenharmony_ci SecondaryField func = nullptrSF); 16891cb0ef41Sopenharmony_ci 16901cb0ef41Sopenharmony_ci void GenInstrRegister(Opcode opcode, FPURegister fr, FPURegister ft, 16911cb0ef41Sopenharmony_ci FPURegister fs, FPURegister fd, 16921cb0ef41Sopenharmony_ci SecondaryField func = nullptrSF); 16931cb0ef41Sopenharmony_ci 16941cb0ef41Sopenharmony_ci void GenInstrRegister(Opcode opcode, SecondaryField fmt, Register rt, 16951cb0ef41Sopenharmony_ci FPURegister fs, FPURegister fd, 16961cb0ef41Sopenharmony_ci SecondaryField func = nullptrSF); 16971cb0ef41Sopenharmony_ci 16981cb0ef41Sopenharmony_ci void GenInstrRegister(Opcode opcode, SecondaryField fmt, Register rt, 16991cb0ef41Sopenharmony_ci FPUControlRegister fs, SecondaryField func = nullptrSF); 17001cb0ef41Sopenharmony_ci 17011cb0ef41Sopenharmony_ci void GenInstrImmediate( 17021cb0ef41Sopenharmony_ci Opcode opcode, Register rs, Register rt, int32_t j, 17031cb0ef41Sopenharmony_ci CompactBranchType is_compact_branch = CompactBranchType::NO); 17041cb0ef41Sopenharmony_ci void GenInstrImmediate( 17051cb0ef41Sopenharmony_ci Opcode opcode, Register rs, SecondaryField SF, int32_t j, 17061cb0ef41Sopenharmony_ci CompactBranchType is_compact_branch = CompactBranchType::NO); 17071cb0ef41Sopenharmony_ci void GenInstrImmediate( 17081cb0ef41Sopenharmony_ci Opcode opcode, Register r1, FPURegister r2, int32_t j, 17091cb0ef41Sopenharmony_ci CompactBranchType is_compact_branch = CompactBranchType::NO); 17101cb0ef41Sopenharmony_ci void GenInstrImmediate(Opcode opcode, Register base, Register rt, 17111cb0ef41Sopenharmony_ci int32_t offset9, int bit6, SecondaryField func); 17121cb0ef41Sopenharmony_ci void GenInstrImmediate( 17131cb0ef41Sopenharmony_ci Opcode opcode, Register rs, int32_t offset21, 17141cb0ef41Sopenharmony_ci CompactBranchType is_compact_branch = CompactBranchType::NO); 17151cb0ef41Sopenharmony_ci void GenInstrImmediate(Opcode opcode, Register rs, uint32_t offset21); 17161cb0ef41Sopenharmony_ci void GenInstrImmediate( 17171cb0ef41Sopenharmony_ci Opcode opcode, int32_t offset26, 17181cb0ef41Sopenharmony_ci CompactBranchType is_compact_branch = CompactBranchType::NO); 17191cb0ef41Sopenharmony_ci 17201cb0ef41Sopenharmony_ci void GenInstrJump(Opcode opcode, uint32_t address); 17211cb0ef41Sopenharmony_ci 17221cb0ef41Sopenharmony_ci // MSA 17231cb0ef41Sopenharmony_ci void GenInstrMsaI8(SecondaryField operation, uint32_t imm8, MSARegister ws, 17241cb0ef41Sopenharmony_ci MSARegister wd); 17251cb0ef41Sopenharmony_ci 17261cb0ef41Sopenharmony_ci void GenInstrMsaI5(SecondaryField operation, SecondaryField df, int32_t imm5, 17271cb0ef41Sopenharmony_ci MSARegister ws, MSARegister wd); 17281cb0ef41Sopenharmony_ci 17291cb0ef41Sopenharmony_ci void GenInstrMsaBit(SecondaryField operation, SecondaryField df, uint32_t m, 17301cb0ef41Sopenharmony_ci MSARegister ws, MSARegister wd); 17311cb0ef41Sopenharmony_ci 17321cb0ef41Sopenharmony_ci void GenInstrMsaI10(SecondaryField operation, SecondaryField df, 17331cb0ef41Sopenharmony_ci int32_t imm10, MSARegister wd); 17341cb0ef41Sopenharmony_ci 17351cb0ef41Sopenharmony_ci template <typename RegType> 17361cb0ef41Sopenharmony_ci void GenInstrMsa3R(SecondaryField operation, SecondaryField df, RegType t, 17371cb0ef41Sopenharmony_ci MSARegister ws, MSARegister wd); 17381cb0ef41Sopenharmony_ci 17391cb0ef41Sopenharmony_ci template <typename DstType, typename SrcType> 17401cb0ef41Sopenharmony_ci void GenInstrMsaElm(SecondaryField operation, SecondaryField df, uint32_t n, 17411cb0ef41Sopenharmony_ci SrcType src, DstType dst); 17421cb0ef41Sopenharmony_ci 17431cb0ef41Sopenharmony_ci void GenInstrMsa3RF(SecondaryField operation, uint32_t df, MSARegister wt, 17441cb0ef41Sopenharmony_ci MSARegister ws, MSARegister wd); 17451cb0ef41Sopenharmony_ci 17461cb0ef41Sopenharmony_ci void GenInstrMsaVec(SecondaryField operation, MSARegister wt, MSARegister ws, 17471cb0ef41Sopenharmony_ci MSARegister wd); 17481cb0ef41Sopenharmony_ci 17491cb0ef41Sopenharmony_ci void GenInstrMsaMI10(SecondaryField operation, int32_t s10, Register rs, 17501cb0ef41Sopenharmony_ci MSARegister wd); 17511cb0ef41Sopenharmony_ci 17521cb0ef41Sopenharmony_ci void GenInstrMsa2R(SecondaryField operation, SecondaryField df, 17531cb0ef41Sopenharmony_ci MSARegister ws, MSARegister wd); 17541cb0ef41Sopenharmony_ci 17551cb0ef41Sopenharmony_ci void GenInstrMsa2RF(SecondaryField operation, SecondaryField df, 17561cb0ef41Sopenharmony_ci MSARegister ws, MSARegister wd); 17571cb0ef41Sopenharmony_ci 17581cb0ef41Sopenharmony_ci void GenInstrMsaBranch(SecondaryField operation, MSARegister wt, 17591cb0ef41Sopenharmony_ci int32_t offset16); 17601cb0ef41Sopenharmony_ci 17611cb0ef41Sopenharmony_ci inline bool is_valid_msa_df_m(SecondaryField bit_df, uint32_t m) { 17621cb0ef41Sopenharmony_ci switch (bit_df) { 17631cb0ef41Sopenharmony_ci case BIT_DF_b: 17641cb0ef41Sopenharmony_ci return is_uint3(m); 17651cb0ef41Sopenharmony_ci case BIT_DF_h: 17661cb0ef41Sopenharmony_ci return is_uint4(m); 17671cb0ef41Sopenharmony_ci case BIT_DF_w: 17681cb0ef41Sopenharmony_ci return is_uint5(m); 17691cb0ef41Sopenharmony_ci case BIT_DF_d: 17701cb0ef41Sopenharmony_ci return is_uint6(m); 17711cb0ef41Sopenharmony_ci default: 17721cb0ef41Sopenharmony_ci return false; 17731cb0ef41Sopenharmony_ci } 17741cb0ef41Sopenharmony_ci } 17751cb0ef41Sopenharmony_ci 17761cb0ef41Sopenharmony_ci inline bool is_valid_msa_df_n(SecondaryField elm_df, uint32_t n) { 17771cb0ef41Sopenharmony_ci switch (elm_df) { 17781cb0ef41Sopenharmony_ci case ELM_DF_B: 17791cb0ef41Sopenharmony_ci return is_uint4(n); 17801cb0ef41Sopenharmony_ci case ELM_DF_H: 17811cb0ef41Sopenharmony_ci return is_uint3(n); 17821cb0ef41Sopenharmony_ci case ELM_DF_W: 17831cb0ef41Sopenharmony_ci return is_uint2(n); 17841cb0ef41Sopenharmony_ci case ELM_DF_D: 17851cb0ef41Sopenharmony_ci return is_uint1(n); 17861cb0ef41Sopenharmony_ci default: 17871cb0ef41Sopenharmony_ci return false; 17881cb0ef41Sopenharmony_ci } 17891cb0ef41Sopenharmony_ci } 17901cb0ef41Sopenharmony_ci 17911cb0ef41Sopenharmony_ci // Labels. 17921cb0ef41Sopenharmony_ci void print(const Label* L); 17931cb0ef41Sopenharmony_ci void bind_to(Label* L, int pos); 17941cb0ef41Sopenharmony_ci void next(Label* L, bool is_internal); 17951cb0ef41Sopenharmony_ci 17961cb0ef41Sopenharmony_ci // Patching lui/ori pair which is commonly used for loading constants. 17971cb0ef41Sopenharmony_ci static void PatchLuiOriImmediate(Address pc, int32_t imm, Instr instr1, 17981cb0ef41Sopenharmony_ci Address offset_lui, Instr instr2, 17991cb0ef41Sopenharmony_ci Address offset_ori); 18001cb0ef41Sopenharmony_ci void PatchLuiOriImmediate(int pc, int32_t imm, Instr instr1, 18011cb0ef41Sopenharmony_ci Address offset_lui, Instr instr2, 18021cb0ef41Sopenharmony_ci Address offset_ori); 18031cb0ef41Sopenharmony_ci 18041cb0ef41Sopenharmony_ci // One trampoline consists of: 18051cb0ef41Sopenharmony_ci // - space for trampoline slots, 18061cb0ef41Sopenharmony_ci // - space for labels. 18071cb0ef41Sopenharmony_ci // 18081cb0ef41Sopenharmony_ci // Space for trampoline slots is equal to slot_count * 2 * kInstrSize. 18091cb0ef41Sopenharmony_ci // Space for trampoline slots precedes space for labels. Each label is of one 18101cb0ef41Sopenharmony_ci // instruction size, so total amount for labels is equal to 18111cb0ef41Sopenharmony_ci // label_count * kInstrSize. 18121cb0ef41Sopenharmony_ci class Trampoline { 18131cb0ef41Sopenharmony_ci public: 18141cb0ef41Sopenharmony_ci Trampoline() { 18151cb0ef41Sopenharmony_ci start_ = 0; 18161cb0ef41Sopenharmony_ci next_slot_ = 0; 18171cb0ef41Sopenharmony_ci free_slot_count_ = 0; 18181cb0ef41Sopenharmony_ci end_ = 0; 18191cb0ef41Sopenharmony_ci } 18201cb0ef41Sopenharmony_ci Trampoline(int start, int slot_count) { 18211cb0ef41Sopenharmony_ci start_ = start; 18221cb0ef41Sopenharmony_ci next_slot_ = start; 18231cb0ef41Sopenharmony_ci free_slot_count_ = slot_count; 18241cb0ef41Sopenharmony_ci end_ = start + slot_count * kTrampolineSlotsSize; 18251cb0ef41Sopenharmony_ci } 18261cb0ef41Sopenharmony_ci int start() { return start_; } 18271cb0ef41Sopenharmony_ci int end() { return end_; } 18281cb0ef41Sopenharmony_ci int take_slot() { 18291cb0ef41Sopenharmony_ci int trampoline_slot = kInvalidSlotPos; 18301cb0ef41Sopenharmony_ci if (free_slot_count_ <= 0) { 18311cb0ef41Sopenharmony_ci // We have run out of space on trampolines. 18321cb0ef41Sopenharmony_ci // Make sure we fail in debug mode, so we become aware of each case 18331cb0ef41Sopenharmony_ci // when this happens. 18341cb0ef41Sopenharmony_ci DCHECK(0); 18351cb0ef41Sopenharmony_ci // Internal exception will be caught. 18361cb0ef41Sopenharmony_ci } else { 18371cb0ef41Sopenharmony_ci trampoline_slot = next_slot_; 18381cb0ef41Sopenharmony_ci free_slot_count_--; 18391cb0ef41Sopenharmony_ci next_slot_ += kTrampolineSlotsSize; 18401cb0ef41Sopenharmony_ci } 18411cb0ef41Sopenharmony_ci return trampoline_slot; 18421cb0ef41Sopenharmony_ci } 18431cb0ef41Sopenharmony_ci 18441cb0ef41Sopenharmony_ci private: 18451cb0ef41Sopenharmony_ci int start_; 18461cb0ef41Sopenharmony_ci int end_; 18471cb0ef41Sopenharmony_ci int next_slot_; 18481cb0ef41Sopenharmony_ci int free_slot_count_; 18491cb0ef41Sopenharmony_ci }; 18501cb0ef41Sopenharmony_ci 18511cb0ef41Sopenharmony_ci int32_t get_trampoline_entry(int32_t pos); 18521cb0ef41Sopenharmony_ci int unbound_labels_count_; 18531cb0ef41Sopenharmony_ci // If trampoline is emitted, generated code is becoming large. As this is 18541cb0ef41Sopenharmony_ci // already a slow case which can possibly break our code generation for the 18551cb0ef41Sopenharmony_ci // extreme case, we use this information to trigger different mode of 18561cb0ef41Sopenharmony_ci // branch instruction generation, where we use jump instructions rather 18571cb0ef41Sopenharmony_ci // than regular branch instructions. 18581cb0ef41Sopenharmony_ci bool trampoline_emitted_; 18591cb0ef41Sopenharmony_ci static constexpr int kInvalidSlotPos = -1; 18601cb0ef41Sopenharmony_ci 18611cb0ef41Sopenharmony_ci // Internal reference positions, required for unbounded internal reference 18621cb0ef41Sopenharmony_ci // labels. 18631cb0ef41Sopenharmony_ci std::set<int> internal_reference_positions_; 18641cb0ef41Sopenharmony_ci bool is_internal_reference(Label* L) { 18651cb0ef41Sopenharmony_ci return internal_reference_positions_.find(L->pos()) != 18661cb0ef41Sopenharmony_ci internal_reference_positions_.end(); 18671cb0ef41Sopenharmony_ci } 18681cb0ef41Sopenharmony_ci 18691cb0ef41Sopenharmony_ci void EmittedCompactBranchInstruction() { prev_instr_compact_branch_ = true; } 18701cb0ef41Sopenharmony_ci void ClearCompactBranchState() { prev_instr_compact_branch_ = false; } 18711cb0ef41Sopenharmony_ci bool prev_instr_compact_branch_ = false; 18721cb0ef41Sopenharmony_ci 18731cb0ef41Sopenharmony_ci Trampoline trampoline_; 18741cb0ef41Sopenharmony_ci bool internal_trampoline_exception_; 18751cb0ef41Sopenharmony_ci 18761cb0ef41Sopenharmony_ci // Keep track of the last Call's position to ensure that safepoint can get the 18771cb0ef41Sopenharmony_ci // correct information even if there is a trampoline immediately after the 18781cb0ef41Sopenharmony_ci // Call. 18791cb0ef41Sopenharmony_ci byte* pc_for_safepoint_; 18801cb0ef41Sopenharmony_ci 18811cb0ef41Sopenharmony_ci private: 18821cb0ef41Sopenharmony_ci void AllocateAndInstallRequestedHeapObjects(Isolate* isolate); 18831cb0ef41Sopenharmony_ci 18841cb0ef41Sopenharmony_ci int WriteCodeComments(); 18851cb0ef41Sopenharmony_ci 18861cb0ef41Sopenharmony_ci friend class RegExpMacroAssemblerMIPS; 18871cb0ef41Sopenharmony_ci friend class RelocInfo; 18881cb0ef41Sopenharmony_ci friend class BlockTrampolinePoolScope; 18891cb0ef41Sopenharmony_ci friend class EnsureSpace; 18901cb0ef41Sopenharmony_ci}; 18911cb0ef41Sopenharmony_ci 18921cb0ef41Sopenharmony_ciclass EnsureSpace { 18931cb0ef41Sopenharmony_ci public: 18941cb0ef41Sopenharmony_ci explicit V8_INLINE EnsureSpace(Assembler* assembler); 18951cb0ef41Sopenharmony_ci}; 18961cb0ef41Sopenharmony_ci 18971cb0ef41Sopenharmony_ciclass V8_EXPORT_PRIVATE V8_NODISCARD UseScratchRegisterScope { 18981cb0ef41Sopenharmony_ci public: 18991cb0ef41Sopenharmony_ci explicit UseScratchRegisterScope(Assembler* assembler); 19001cb0ef41Sopenharmony_ci ~UseScratchRegisterScope(); 19011cb0ef41Sopenharmony_ci 19021cb0ef41Sopenharmony_ci Register Acquire(); 19031cb0ef41Sopenharmony_ci bool hasAvailable() const; 19041cb0ef41Sopenharmony_ci 19051cb0ef41Sopenharmony_ci void Include(const RegList& list) { *available_ |= list; } 19061cb0ef41Sopenharmony_ci void Exclude(const RegList& list) { available_->clear(list); } 19071cb0ef41Sopenharmony_ci void Include(const Register& reg1, const Register& reg2 = no_reg) { 19081cb0ef41Sopenharmony_ci RegList list({reg1, reg2}); 19091cb0ef41Sopenharmony_ci Include(list); 19101cb0ef41Sopenharmony_ci } 19111cb0ef41Sopenharmony_ci void Exclude(const Register& reg1, const Register& reg2 = no_reg) { 19121cb0ef41Sopenharmony_ci RegList list({reg1, reg2}); 19131cb0ef41Sopenharmony_ci Exclude(list); 19141cb0ef41Sopenharmony_ci } 19151cb0ef41Sopenharmony_ci 19161cb0ef41Sopenharmony_ci private: 19171cb0ef41Sopenharmony_ci RegList* available_; 19181cb0ef41Sopenharmony_ci RegList old_available_; 19191cb0ef41Sopenharmony_ci}; 19201cb0ef41Sopenharmony_ci 19211cb0ef41Sopenharmony_ci} // namespace internal 19221cb0ef41Sopenharmony_ci} // namespace v8 19231cb0ef41Sopenharmony_ci 19241cb0ef41Sopenharmony_ci#endif // V8_CODEGEN_MIPS_ASSEMBLER_MIPS_H_ 1925