V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
assembler-mips64.h
1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 //
11 // - Redistribution in binary form must reproduce the above copyright
12 // notice, this list of conditions and the following disclaimer in the
13 // documentation and/or other materials provided with the distribution.
14 //
15 // - Neither the name of Sun Microsystems or the names of contributors may
16 // be used to endorse or promote products derived from this software without
17 // specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // The original source code covered by the above license above has been
32 // modified significantly by Google Inc.
33 // Copyright 2012 the V8 project authors. All rights reserved.
34 
35 #ifndef V8_MIPS64_ASSEMBLER_MIPS64_H_
36 #define V8_MIPS64_ASSEMBLER_MIPS64_H_
37 
38 #include <stdio.h>
39 
40 #include <set>
41 
42 #include "src/assembler.h"
43 #include "src/contexts.h"
44 #include "src/external-reference.h"
45 #include "src/label.h"
46 #include "src/mips64/constants-mips64.h"
47 #include "src/objects/smi.h"
48 
49 namespace v8 {
50 namespace internal {
51 
52 // clang-format off
53 #define GENERAL_REGISTERS(V) \
54  V(zero_reg) V(at) V(v0) V(v1) V(a0) V(a1) V(a2) V(a3) \
55  V(a4) V(a5) V(a6) V(a7) V(t0) V(t1) V(t2) V(t3) \
56  V(s0) V(s1) V(s2) V(s3) V(s4) V(s5) V(s6) V(s7) V(t8) V(t9) \
57  V(k0) V(k1) V(gp) V(sp) V(fp) V(ra)
58 
59 #define ALLOCATABLE_GENERAL_REGISTERS(V) \
60  V(a0) V(a1) V(a2) V(a3) \
61  V(a4) V(a5) V(a6) V(a7) V(t0) V(t1) V(t2) V(s7) \
62  V(v0) V(v1)
63 
64 #define DOUBLE_REGISTERS(V) \
65  V(f0) V(f1) V(f2) V(f3) V(f4) V(f5) V(f6) V(f7) \
66  V(f8) V(f9) V(f10) V(f11) V(f12) V(f13) V(f14) V(f15) \
67  V(f16) V(f17) V(f18) V(f19) V(f20) V(f21) V(f22) V(f23) \
68  V(f24) V(f25) V(f26) V(f27) V(f28) V(f29) V(f30) V(f31)
69 
70 #define FLOAT_REGISTERS DOUBLE_REGISTERS
71 #define SIMD128_REGISTERS(V) \
72  V(w0) V(w1) V(w2) V(w3) V(w4) V(w5) V(w6) V(w7) \
73  V(w8) V(w9) V(w10) V(w11) V(w12) V(w13) V(w14) V(w15) \
74  V(w16) V(w17) V(w18) V(w19) V(w20) V(w21) V(w22) V(w23) \
75  V(w24) V(w25) V(w26) V(w27) V(w28) V(w29) V(w30) V(w31)
76 
77 #define ALLOCATABLE_DOUBLE_REGISTERS(V) \
78  V(f0) V(f2) V(f4) V(f6) V(f8) V(f10) V(f12) V(f14) \
79  V(f16) V(f18) V(f20) V(f22) V(f24) V(f26)
80 // clang-format on
81 
82 // Note that the bit values must match those used in actual instruction
83 // encoding.
84 const int kNumRegs = 32;
85 
86 const RegList kJSCallerSaved = 1 << 2 | // v0
87  1 << 3 | // v1
88  1 << 4 | // a0
89  1 << 5 | // a1
90  1 << 6 | // a2
91  1 << 7 | // a3
92  1 << 8 | // a4
93  1 << 9 | // a5
94  1 << 10 | // a6
95  1 << 11 | // a7
96  1 << 12 | // t0
97  1 << 13 | // t1
98  1 << 14 | // t2
99  1 << 15; // t3
100 
101 const int kNumJSCallerSaved = 14;
102 
103 // Callee-saved registers preserved when switching from C to JavaScript.
104 const RegList kCalleeSaved = 1 << 16 | // s0
105  1 << 17 | // s1
106  1 << 18 | // s2
107  1 << 19 | // s3
108  1 << 20 | // s4
109  1 << 21 | // s5
110  1 << 22 | // s6 (roots in Javascript code)
111  1 << 23 | // s7 (cp in Javascript code)
112  1 << 30; // fp/s8
113 
114 const int kNumCalleeSaved = 9;
115 
116 const RegList kCalleeSavedFPU = 1 << 20 | // f20
117  1 << 22 | // f22
118  1 << 24 | // f24
119  1 << 26 | // f26
120  1 << 28 | // f28
121  1 << 30; // f30
122 
123 const int kNumCalleeSavedFPU = 6;
124 
125 const RegList kCallerSavedFPU = 1 << 0 | // f0
126  1 << 2 | // f2
127  1 << 4 | // f4
128  1 << 6 | // f6
129  1 << 8 | // f8
130  1 << 10 | // f10
131  1 << 12 | // f12
132  1 << 14 | // f14
133  1 << 16 | // f16
134  1 << 18; // f18
135 
136 // Number of registers for which space is reserved in safepoints. Must be a
137 // multiple of 8.
138 const int kNumSafepointRegisters = 24;
139 
140 // Define the list of registers actually saved at safepoints.
141 // Note that the number of saved registers may be smaller than the reserved
142 // space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
143 const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved;
144 const int kNumSafepointSavedRegisters = kNumJSCallerSaved + kNumCalleeSaved;
145 
146 const int kUndefIndex = -1;
147 // Map with indexes on stack that corresponds to codes of saved registers.
148 const int kSafepointRegisterStackIndexMap[kNumRegs] = {kUndefIndex, // zero_reg
149  kUndefIndex, // at
150  0, // v0
151  1, // v1
152  2, // a0
153  3, // a1
154  4, // a2
155  5, // a3
156  6, // a4
157  7, // a5
158  8, // a6
159  9, // a7
160  10, // t0
161  11, // t1
162  12, // t2
163  13, // t3
164  14, // s0
165  15, // s1
166  16, // s2
167  17, // s3
168  18, // s4
169  19, // s5
170  20, // s6
171  21, // s7
172  kUndefIndex, // t8
173  kUndefIndex, // t9
174  kUndefIndex, // k0
175  kUndefIndex, // k1
176  kUndefIndex, // gp
177  kUndefIndex, // sp
178  22, // fp
179  kUndefIndex};
180 
181 // CPU Registers.
182 //
183 // 1) We would prefer to use an enum, but enum values are assignment-
184 // compatible with int, which has caused code-generation bugs.
185 //
186 // 2) We would prefer to use a class instead of a struct but we don't like
187 // the register initialization to depend on the particular initialization
188 // order (which appears to be different on OS X, Linux, and Windows for the
189 // installed versions of C++ we tried). Using a struct permits C-style
190 // "initialization". Also, the Register objects cannot be const as this
191 // forces initialization stubs in MSVC, making us dependent on initialization
192 // order.
193 //
194 // 3) By not using an enum, we are possibly preventing the compiler from
195 // doing certain constant folds, which may significantly reduce the
196 // code generated for some assembly instructions (because they boil down
197 // to a few constants). If this is a problem, we could change the code
198 // such that we use an enum in optimized mode, and the struct in debug
199 // mode. This way we get the compile-time error checking in debug mode
200 // and best performance in optimized code.
201 
202 
203 // -----------------------------------------------------------------------------
204 // Implementation of Register and FPURegister.
205 
206 enum RegisterCode {
207 #define REGISTER_CODE(R) kRegCode_##R,
208  GENERAL_REGISTERS(REGISTER_CODE)
209 #undef REGISTER_CODE
210  kRegAfterLast
211 };
212 
213 class Register : public RegisterBase<Register, kRegAfterLast> {
214  public:
215 #if defined(V8_TARGET_LITTLE_ENDIAN)
216  static constexpr int kMantissaOffset = 0;
217  static constexpr int kExponentOffset = 4;
218 #elif defined(V8_TARGET_BIG_ENDIAN)
219  static constexpr int kMantissaOffset = 4;
220  static constexpr int kExponentOffset = 0;
221 #else
222 #error Unknown endianness
223 #endif
224 
225  private:
226  friend class RegisterBase;
227  explicit constexpr Register(int code) : RegisterBase(code) {}
228 };
229 
230 // s7: context register
231 // s3: scratch register
232 // s4: scratch register 2
233 #define DECLARE_REGISTER(R) \
234  constexpr Register R = Register::from_code<kRegCode_##R>();
235 GENERAL_REGISTERS(DECLARE_REGISTER)
236 #undef DECLARE_REGISTER
237 
238 constexpr Register no_reg = Register::no_reg();
239 
240 int ToNumber(Register reg);
241 
242 Register ToRegister(int num);
243 
244 constexpr bool kPadArguments = false;
245 constexpr bool kSimpleFPAliasing = true;
246 constexpr bool kSimdMaskRegisters = false;
247 
248 enum DoubleRegisterCode {
249 #define REGISTER_CODE(R) kDoubleCode_##R,
250  DOUBLE_REGISTERS(REGISTER_CODE)
251 #undef REGISTER_CODE
252  kDoubleAfterLast
253 };
254 
255 // Coprocessor register.
256 class FPURegister : public RegisterBase<FPURegister, kDoubleAfterLast> {
257  public:
258  // TODO(plind): Warning, inconsistent numbering here. kNumFPURegisters refers
259  // to number of 32-bit FPU regs, but kNumAllocatableRegisters refers to
260  // number of Double regs (64-bit regs, or FPU-reg-pairs).
261 
262  FPURegister low() const {
263  // TODO(plind): Create DCHECK for FR=0 mode. This usage suspect for FR=1.
264  // Find low reg of a Double-reg pair, which is the reg itself.
265  DCHECK_EQ(code() % 2, 0); // Specified Double reg must be even.
266  return FPURegister::from_code(code());
267  }
268  FPURegister high() const {
269  // TODO(plind): Create DCHECK for FR=0 mode. This usage illegal in FR=1.
270  // Find high reg of a Doubel-reg pair, which is reg + 1.
271  DCHECK_EQ(code() % 2, 0); // Specified Double reg must be even.
272  return FPURegister::from_code(code() + 1);
273  }
274 
275  private:
276  friend class RegisterBase;
277  explicit constexpr FPURegister(int code) : RegisterBase(code) {}
278 };
279 
280 enum MSARegisterCode {
281 #define REGISTER_CODE(R) kMsaCode_##R,
282  SIMD128_REGISTERS(REGISTER_CODE)
283 #undef REGISTER_CODE
284  kMsaAfterLast
285 };
286 
287 // MIPS SIMD (MSA) register
288 class MSARegister : public RegisterBase<MSARegister, kMsaAfterLast> {
289  friend class RegisterBase;
290  explicit constexpr MSARegister(int code) : RegisterBase(code) {}
291 };
292 
293 // A few double registers are reserved: one as a scratch register and one to
294 // hold 0.0.
295 // f28: 0.0
296 // f30: scratch register.
297 
298 // V8 now supports the O32 ABI, and the FPU Registers are organized as 32
299 // 32-bit registers, f0 through f31. When used as 'double' they are used
300 // in pairs, starting with the even numbered register. So a double operation
301 // on f0 really uses f0 and f1.
302 // (Modern mips hardware also supports 32 64-bit registers, via setting
303 // (privileged) Status Register FR bit to 1. This is used by the N32 ABI,
304 // but it is not in common use. Someday we will want to support this in v8.)
305 
306 // For O32 ABI, Floats and Doubles refer to same set of 32 32-bit registers.
307 typedef FPURegister FloatRegister;
308 
309 typedef FPURegister DoubleRegister;
310 
311 #define DECLARE_DOUBLE_REGISTER(R) \
312  constexpr DoubleRegister R = DoubleRegister::from_code<kDoubleCode_##R>();
313 DOUBLE_REGISTERS(DECLARE_DOUBLE_REGISTER)
314 #undef DECLARE_DOUBLE_REGISTER
315 
316 constexpr DoubleRegister no_dreg = DoubleRegister::no_reg();
317 
318 // SIMD registers.
319 typedef MSARegister Simd128Register;
320 
321 #define DECLARE_SIMD128_REGISTER(R) \
322  constexpr Simd128Register R = Simd128Register::from_code<kMsaCode_##R>();
323 SIMD128_REGISTERS(DECLARE_SIMD128_REGISTER)
324 #undef DECLARE_SIMD128_REGISTER
325 
326 const Simd128Register no_msareg = Simd128Register::no_reg();
327 
328 // Register aliases.
329 // cp is assumed to be a callee saved register.
330 constexpr Register kRootRegister = s6;
331 constexpr Register cp = s7;
332 constexpr Register kScratchReg = s3;
333 constexpr Register kScratchReg2 = s4;
334 constexpr DoubleRegister kScratchDoubleReg = f30;
335 constexpr DoubleRegister kDoubleRegZero = f28;
336 // Used on mips64r6 for compare operations.
337 // We use the last non-callee saved odd register for N64 ABI
338 constexpr DoubleRegister kDoubleCompareReg = f23;
339 // MSA zero and scratch regs must have the same numbers as FPU zero and scratch
340 constexpr Simd128Register kSimd128RegZero = w28;
341 constexpr Simd128Register kSimd128ScratchReg = w30;
342 
343 // FPU (coprocessor 1) control registers.
344 // Currently only FCSR (#31) is implemented.
345 struct FPUControlRegister {
346  bool is_valid() const { return reg_code == kFCSRRegister; }
347  bool is(FPUControlRegister creg) const { return reg_code == creg.reg_code; }
348  int code() const {
349  DCHECK(is_valid());
350  return reg_code;
351  }
352  int bit() const {
353  DCHECK(is_valid());
354  return 1 << reg_code;
355  }
356  void setcode(int f) {
357  reg_code = f;
358  DCHECK(is_valid());
359  }
360  // Unfortunately we can't make this private in a struct.
361  int reg_code;
362 };
363 
364 constexpr FPUControlRegister no_fpucreg = {kInvalidFPUControlRegister};
365 constexpr FPUControlRegister FCSR = {kFCSRRegister};
366 
367 // MSA control registers
368 struct MSAControlRegister {
369  bool is_valid() const {
370  return (reg_code == kMSAIRRegister) || (reg_code == kMSACSRRegister);
371  }
372  bool is(MSAControlRegister creg) const { return reg_code == creg.reg_code; }
373  int code() const {
374  DCHECK(is_valid());
375  return reg_code;
376  }
377  int bit() const {
378  DCHECK(is_valid());
379  return 1 << reg_code;
380  }
381  void setcode(int f) {
382  reg_code = f;
383  DCHECK(is_valid());
384  }
385  // Unfortunately we can't make this private in a struct.
386  int reg_code;
387 };
388 
389 constexpr MSAControlRegister no_msacreg = {kInvalidMSAControlRegister};
390 constexpr MSAControlRegister MSAIR = {kMSAIRRegister};
391 constexpr MSAControlRegister MSACSR = {kMSACSRRegister};
392 
393 // -----------------------------------------------------------------------------
394 // Machine instruction Operands.
395 constexpr int kSmiShift = kSmiTagSize + kSmiShiftSize;
396 constexpr uint64_t kSmiShiftMask = (1UL << kSmiShift) - 1;
397 // Class Operand represents a shifter operand in data processing instructions.
398 class Operand {
399  public:
400  // Immediate.
401  V8_INLINE explicit Operand(int64_t immediate,
402  RelocInfo::Mode rmode = RelocInfo::NONE)
403  : rm_(no_reg), rmode_(rmode) {
404  value_.immediate = immediate;
405  }
406  V8_INLINE explicit Operand(const ExternalReference& f)
407  : rm_(no_reg), rmode_(RelocInfo::EXTERNAL_REFERENCE) {
408  value_.immediate = static_cast<int64_t>(f.address());
409  }
410  V8_INLINE explicit Operand(const char* s);
411  explicit Operand(Handle<HeapObject> handle);
412  V8_INLINE explicit Operand(Smi value) : rm_(no_reg), rmode_(RelocInfo::NONE) {
413  value_.immediate = static_cast<intptr_t>(value.ptr());
414  }
415 
416  static Operand EmbeddedNumber(double number); // Smi or HeapNumber.
417  static Operand EmbeddedCode(CodeStub* stub);
418  static Operand EmbeddedStringConstant(const StringConstantBase* str);
419 
420  // Register.
421  V8_INLINE explicit Operand(Register rm) : rm_(rm) {}
422 
423  // Return true if this is a register operand.
424  V8_INLINE bool is_reg() const;
425 
426  inline int64_t immediate() const;
427 
428  bool IsImmediate() const { return !rm_.is_valid(); }
429 
430  HeapObjectRequest heap_object_request() const {
431  DCHECK(IsHeapObjectRequest());
432  return value_.heap_object_request;
433  }
434 
435  bool IsHeapObjectRequest() const {
436  DCHECK_IMPLIES(is_heap_object_request_, IsImmediate());
437  DCHECK_IMPLIES(is_heap_object_request_,
438  rmode_ == RelocInfo::EMBEDDED_OBJECT ||
439  rmode_ == RelocInfo::CODE_TARGET);
440  return is_heap_object_request_;
441  }
442 
443  Register rm() const { return rm_; }
444 
445  RelocInfo::Mode rmode() const { return rmode_; }
446 
447  private:
448  Register rm_;
449  union Value {
450  Value() {}
451  HeapObjectRequest heap_object_request; // if is_heap_object_request_
452  int64_t immediate; // otherwise
453  } value_; // valid if rm_ == no_reg
454  bool is_heap_object_request_ = false;
455  RelocInfo::Mode rmode_;
456 
457  friend class Assembler;
458  friend class MacroAssembler;
459 };
460 
461 
462 // On MIPS we have only one addressing mode with base_reg + offset.
463 // Class MemOperand represents a memory operand in load and store instructions.
464 class MemOperand : public Operand {
465  public:
466  // Immediate value attached to offset.
467  enum OffsetAddend {
468  offset_minus_one = -1,
469  offset_zero = 0
470  };
471 
472  explicit MemOperand(Register rn, int32_t offset = 0);
473  explicit MemOperand(Register rn, int32_t unit, int32_t multiplier,
474  OffsetAddend offset_addend = offset_zero);
475  int32_t offset() const { return offset_; }
476 
477  bool OffsetIsInt16Encodable() const {
478  return is_int16(offset_);
479  }
480 
481  private:
482  int32_t offset_;
483 
484  friend class Assembler;
485 };
486 
487 class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
488  public:
489  // Create an assembler. Instructions and relocation information are emitted
490  // into a buffer, with the instructions starting from the beginning and the
491  // relocation information starting from the end of the buffer. See CodeDesc
492  // for a detailed comment on the layout (globals.h).
493  //
494  // If the provided buffer is nullptr, the assembler allocates and grows its
495  // own buffer, and buffer_size determines the initial buffer size. The buffer
496  // is owned by the assembler and deallocated upon destruction of the
497  // assembler.
498  //
499  // If the provided buffer is not nullptr, the assembler uses the provided
500  // buffer for code generation and assumes its size to be buffer_size. If the
501  // buffer is too small, a fatal error occurs. No deallocation of the buffer is
502  // done upon destruction of the assembler.
503  Assembler(const AssemblerOptions& options, void* buffer, int buffer_size);
504  virtual ~Assembler() { }
505 
506  // GetCode emits any pending (non-emitted) code and fills the descriptor
507  // desc. GetCode() is idempotent; it returns the same result if no other
508  // Assembler functions are invoked in between GetCode() calls.
509  void GetCode(Isolate* isolate, CodeDesc* desc);
510 
511  // Label operations & relative jumps (PPUM Appendix D).
512  //
513  // Takes a branch opcode (cc) and a label (L) and generates
514  // either a backward branch or a forward branch and links it
515  // to the label fixup chain. Usage:
516  //
517  // Label L; // unbound label
518  // j(cc, &L); // forward branch to unbound label
519  // bind(&L); // bind label to the current pc
520  // j(cc, &L); // backward branch to bound label
521  // bind(&L); // illegal: a label may be bound only once
522  //
523  // Note: The same Label can be used for forward and backward branches
524  // but it may be bound only once.
525  void bind(Label* L); // Binds an unbound label L to current code position.
526 
527  enum OffsetSize : int { kOffset26 = 26, kOffset21 = 21, kOffset16 = 16 };
528 
529  // Determines if Label is bound and near enough so that branch instruction
530  // can be used to reach it, instead of jump instruction.
531  bool is_near(Label* L);
532  bool is_near(Label* L, OffsetSize bits);
533  bool is_near_branch(Label* L);
534  inline bool is_near_pre_r6(Label* L) {
535  DCHECK(!(kArchVariant == kMips64r6));
536  return pc_offset() - L->pos() < kMaxBranchOffset - 4 * kInstrSize;
537  }
538  inline bool is_near_r6(Label* L) {
539  DCHECK_EQ(kArchVariant, kMips64r6);
540  return pc_offset() - L->pos() < kMaxCompactBranchOffset - 4 * kInstrSize;
541  }
542 
543  int BranchOffset(Instr instr);
544 
545  // Returns the branch offset to the given label from the current code
546  // position. Links the label to the current position if it is still unbound.
547  // Manages the jump elimination optimization if the second parameter is true.
548  int32_t branch_offset_helper(Label* L, OffsetSize bits);
549  inline int32_t branch_offset(Label* L) {
550  return branch_offset_helper(L, OffsetSize::kOffset16);
551  }
552  inline int32_t branch_offset21(Label* L) {
553  return branch_offset_helper(L, OffsetSize::kOffset21);
554  }
555  inline int32_t branch_offset26(Label* L) {
556  return branch_offset_helper(L, OffsetSize::kOffset26);
557  }
558  inline int32_t shifted_branch_offset(Label* L) {
559  return branch_offset(L) >> 2;
560  }
561  inline int32_t shifted_branch_offset21(Label* L) {
562  return branch_offset21(L) >> 2;
563  }
564  inline int32_t shifted_branch_offset26(Label* L) {
565  return branch_offset26(L) >> 2;
566  }
567  uint64_t jump_address(Label* L);
568  uint64_t jump_offset(Label* L);
569  uint64_t branch_long_offset(Label* L);
570 
571  // Puts a labels target address at the given position.
572  // The high 8 bits are set to zero.
573  void label_at_put(Label* L, int at_offset);
574 
575  // Read/Modify the code target address in the branch/call instruction at pc.
576  // The isolate argument is unused (and may be nullptr) when skipping flushing.
577  static Address target_address_at(Address pc);
578  V8_INLINE static void set_target_address_at(
579  Address pc, Address target,
580  ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED) {
581  set_target_value_at(pc, target, icache_flush_mode);
582  }
583  // On MIPS there is no Constant Pool so we skip that parameter.
584  V8_INLINE static Address target_address_at(Address pc,
585  Address constant_pool) {
586  return target_address_at(pc);
587  }
588  V8_INLINE static void set_target_address_at(
589  Address pc, Address constant_pool, Address target,
590  ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED) {
591  set_target_address_at(pc, target, icache_flush_mode);
592  }
593 
594  static void set_target_value_at(
595  Address pc, uint64_t target,
596  ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
597 
598  // Return the code target address at a call site from the return address
599  // of that call in the instruction stream.
600  inline static Address target_address_from_return_address(Address pc);
601 
602  static void JumpLabelToJumpRegister(Address pc);
603 
604  static void QuietNaN(HeapObject* nan);
605 
606  // This sets the branch destination (which gets loaded at the call address).
607  // This is for calls and branches within generated code. The serializer
608  // has already deserialized the lui/ori instructions etc.
609  inline static void deserialization_set_special_target_at(
610  Address instruction_payload, Code code, Address target);
611 
612  // Get the size of the special target encoded at 'instruction_payload'.
613  inline static int deserialization_special_target_size(
614  Address instruction_payload);
615 
616  // This sets the internal reference at the pc.
617  inline static void deserialization_set_target_internal_reference_at(
618  Address pc, Address target,
619  RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE);
620 
621  // Difference between address of current opcode and target address offset.
622  static constexpr int kBranchPCOffset = kInstrSize;
623 
624  // Difference between address of current opcode and target address offset,
625  // when we are generatinga sequence of instructions for long relative PC
626  // branches
627  static constexpr int kLongBranchPCOffset = 3 * kInstrSize;
628 
629  // Adjust ra register in branch delay slot of bal instruction so to skip
630  // instructions not needed after optimization of PIC in
631  // TurboAssembler::BranchAndLink method.
632 
633  static constexpr int kOptimizedBranchAndLinkLongReturnOffset = 4 * kInstrSize;
634 
635  // Here we are patching the address in the LUI/ORI instruction pair.
636  // These values are used in the serialization process and must be zero for
637  // MIPS platform, as Code, Embedded Object or External-reference pointers
638  // are split across two consecutive instructions and don't exist separately
639  // in the code, so the serializer should not step forwards in memory after
640  // a target is resolved and written.
641  static constexpr int kSpecialTargetSize = 0;
642 
643  // Number of consecutive instructions used to store 32bit/64bit constant.
644  // This constant was used in RelocInfo::target_address_address() function
645  // to tell serializer address of the instruction that follows
646  // LUI/ORI instruction pair.
647  static constexpr int kInstructionsFor32BitConstant = 2;
648  static constexpr int kInstructionsFor64BitConstant = 4;
649 
650  // Distance between the instruction referring to the address of the call
651  // target and the return address.
652 #ifdef _MIPS_ARCH_MIPS64R6
653  static constexpr int kCallTargetAddressOffset = 5 * kInstrSize;
654 #else
655  static constexpr int kCallTargetAddressOffset = 6 * kInstrSize;
656 #endif
657 
658  // Difference between address of current opcode and value read from pc
659  // register.
660  static constexpr int kPcLoadDelta = 4;
661 
662  // Max offset for instructions with 16-bit offset field
663  static constexpr int kMaxBranchOffset = (1 << (18 - 1)) - 1;
664 
665  // Max offset for compact branch instructions with 26-bit offset field
666  static constexpr int kMaxCompactBranchOffset = (1 << (28 - 1)) - 1;
667 
668  static constexpr int kTrampolineSlotsSize =
669  kArchVariant == kMips64r6 ? 2 * kInstrSize : 7 * kInstrSize;
670 
671  RegList* GetScratchRegisterList() { return &scratch_register_list_; }
672 
673  // ---------------------------------------------------------------------------
674  // Code generation.
675 
676  // Insert the smallest number of nop instructions
677  // possible to align the pc offset to a multiple
678  // of m. m must be a power of 2 (>= 4).
679  void Align(int m);
680  // Insert the smallest number of zero bytes possible to align the pc offset
681  // to a mulitple of m. m must be a power of 2 (>= 2).
682  void DataAlign(int m);
683  // Aligns code to something that's optimal for a jump target for the platform.
684  void CodeTargetAlign();
685 
686  // Different nop operations are used by the code generator to detect certain
687  // states of the generated code.
688  enum NopMarkerTypes {
689  NON_MARKING_NOP = 0,
690  DEBUG_BREAK_NOP,
691  // IC markers.
692  PROPERTY_ACCESS_INLINED,
693  PROPERTY_ACCESS_INLINED_CONTEXT,
694  PROPERTY_ACCESS_INLINED_CONTEXT_DONT_DELETE,
695  // Helper values.
696  LAST_CODE_MARKER,
697  FIRST_IC_MARKER = PROPERTY_ACCESS_INLINED,
698  };
699 
700  // Type == 0 is the default non-marking nop. For mips this is a
701  // sll(zero_reg, zero_reg, 0). We use rt_reg == at for non-zero
702  // marking, to avoid conflict with ssnop and ehb instructions.
703  void nop(unsigned int type = 0) {
704  DCHECK_LT(type, 32);
705  Register nop_rt_reg = (type == 0) ? zero_reg : at;
706  sll(zero_reg, nop_rt_reg, type, true);
707  }
708 
709 
710  // --------Branch-and-jump-instructions----------
711  // We don't use likely variant of instructions.
712  void b(int16_t offset);
713  inline void b(Label* L) { b(shifted_branch_offset(L)); }
714  void bal(int16_t offset);
715  inline void bal(Label* L) { bal(shifted_branch_offset(L)); }
716  void bc(int32_t offset);
717  inline void bc(Label* L) { bc(shifted_branch_offset26(L)); }
718  void balc(int32_t offset);
719  inline void balc(Label* L) { balc(shifted_branch_offset26(L)); }
720 
721  void beq(Register rs, Register rt, int16_t offset);
722  inline void beq(Register rs, Register rt, Label* L) {
723  beq(rs, rt, shifted_branch_offset(L));
724  }
725  void bgez(Register rs, int16_t offset);
726  void bgezc(Register rt, int16_t offset);
727  inline void bgezc(Register rt, Label* L) {
728  bgezc(rt, shifted_branch_offset(L));
729  }
730  void bgeuc(Register rs, Register rt, int16_t offset);
731  inline void bgeuc(Register rs, Register rt, Label* L) {
732  bgeuc(rs, rt, shifted_branch_offset(L));
733  }
734  void bgec(Register rs, Register rt, int16_t offset);
735  inline void bgec(Register rs, Register rt, Label* L) {
736  bgec(rs, rt, shifted_branch_offset(L));
737  }
738  void bgezal(Register rs, int16_t offset);
739  void bgezalc(Register rt, int16_t offset);
740  inline void bgezalc(Register rt, Label* L) {
741  bgezalc(rt, shifted_branch_offset(L));
742  }
743  void bgezall(Register rs, int16_t offset);
744  inline void bgezall(Register rs, Label* L) {
745  bgezall(rs, branch_offset(L) >> 2);
746  }
747  void bgtz(Register rs, int16_t offset);
748  void bgtzc(Register rt, int16_t offset);
749  inline void bgtzc(Register rt, Label* L) {
750  bgtzc(rt, shifted_branch_offset(L));
751  }
752  void blez(Register rs, int16_t offset);
753  void blezc(Register rt, int16_t offset);
754  inline void blezc(Register rt, Label* L) {
755  blezc(rt, shifted_branch_offset(L));
756  }
757  void bltz(Register rs, int16_t offset);
758  void bltzc(Register rt, int16_t offset);
759  inline void bltzc(Register rt, Label* L) {
760  bltzc(rt, shifted_branch_offset(L));
761  }
762  void bltuc(Register rs, Register rt, int16_t offset);
763  inline void bltuc(Register rs, Register rt, Label* L) {
764  bltuc(rs, rt, shifted_branch_offset(L));
765  }
766  void bltc(Register rs, Register rt, int16_t offset);
767  inline void bltc(Register rs, Register rt, Label* L) {
768  bltc(rs, rt, shifted_branch_offset(L));
769  }
770  void bltzal(Register rs, int16_t offset);
771  void nal() { bltzal(zero_reg, 0); }
772  void blezalc(Register rt, int16_t offset);
773  inline void blezalc(Register rt, Label* L) {
774  blezalc(rt, shifted_branch_offset(L));
775  }
776  void bltzalc(Register rt, int16_t offset);
777  inline void bltzalc(Register rt, Label* L) {
778  bltzalc(rt, shifted_branch_offset(L));
779  }
780  void bgtzalc(Register rt, int16_t offset);
781  inline void bgtzalc(Register rt, Label* L) {
782  bgtzalc(rt, shifted_branch_offset(L));
783  }
784  void beqzalc(Register rt, int16_t offset);
785  inline void beqzalc(Register rt, Label* L) {
786  beqzalc(rt, shifted_branch_offset(L));
787  }
788  void beqc(Register rs, Register rt, int16_t offset);
789  inline void beqc(Register rs, Register rt, Label* L) {
790  beqc(rs, rt, shifted_branch_offset(L));
791  }
792  void beqzc(Register rs, int32_t offset);
793  inline void beqzc(Register rs, Label* L) {
794  beqzc(rs, shifted_branch_offset21(L));
795  }
796  void bnezalc(Register rt, int16_t offset);
797  inline void bnezalc(Register rt, Label* L) {
798  bnezalc(rt, shifted_branch_offset(L));
799  }
800  void bnec(Register rs, Register rt, int16_t offset);
801  inline void bnec(Register rs, Register rt, Label* L) {
802  bnec(rs, rt, shifted_branch_offset(L));
803  }
804  void bnezc(Register rt, int32_t offset);
805  inline void bnezc(Register rt, Label* L) {
806  bnezc(rt, shifted_branch_offset21(L));
807  }
808  void bne(Register rs, Register rt, int16_t offset);
809  inline void bne(Register rs, Register rt, Label* L) {
810  bne(rs, rt, shifted_branch_offset(L));
811  }
812  void bovc(Register rs, Register rt, int16_t offset);
813  inline void bovc(Register rs, Register rt, Label* L) {
814  bovc(rs, rt, shifted_branch_offset(L));
815  }
816  void bnvc(Register rs, Register rt, int16_t offset);
817  inline void bnvc(Register rs, Register rt, Label* L) {
818  bnvc(rs, rt, shifted_branch_offset(L));
819  }
820 
821  // Never use the int16_t b(l)cond version with a branch offset
822  // instead of using the Label* version.
823 
824  void jalr(Register rs, Register rd = ra);
825  void jr(Register target);
826  void jic(Register rt, int16_t offset);
827  void jialc(Register rt, int16_t offset);
828 
829  // Following instructions are deprecated and require 256 MB
830  // code alignment. Use PC-relative instructions instead.
831  void j(int64_t target);
832  void jal(int64_t target);
833  void j(Label* target);
834  void jal(Label* target);
835 
836  // -------Data-processing-instructions---------
837 
838  // Arithmetic.
839  void addu(Register rd, Register rs, Register rt);
840  void subu(Register rd, Register rs, Register rt);
841 
842  void div(Register rs, Register rt);
843  void divu(Register rs, Register rt);
844  void ddiv(Register rs, Register rt);
845  void ddivu(Register rs, Register rt);
846  void div(Register rd, Register rs, Register rt);
847  void divu(Register rd, Register rs, Register rt);
848  void ddiv(Register rd, Register rs, Register rt);
849  void ddivu(Register rd, Register rs, Register rt);
850  void mod(Register rd, Register rs, Register rt);
851  void modu(Register rd, Register rs, Register rt);
852  void dmod(Register rd, Register rs, Register rt);
853  void dmodu(Register rd, Register rs, Register rt);
854 
855  void mul(Register rd, Register rs, Register rt);
856  void muh(Register rd, Register rs, Register rt);
857  void mulu(Register rd, Register rs, Register rt);
858  void muhu(Register rd, Register rs, Register rt);
859  void mult(Register rs, Register rt);
860  void multu(Register rs, Register rt);
861  void dmul(Register rd, Register rs, Register rt);
862  void dmuh(Register rd, Register rs, Register rt);
863  void dmulu(Register rd, Register rs, Register rt);
864  void dmuhu(Register rd, Register rs, Register rt);
865  void daddu(Register rd, Register rs, Register rt);
866  void dsubu(Register rd, Register rs, Register rt);
867  void dmult(Register rs, Register rt);
868  void dmultu(Register rs, Register rt);
869 
870  void addiu(Register rd, Register rs, int32_t j);
871  void daddiu(Register rd, Register rs, int32_t j);
872 
873  // Logical.
874  void and_(Register rd, Register rs, Register rt);
875  void or_(Register rd, Register rs, Register rt);
876  void xor_(Register rd, Register rs, Register rt);
877  void nor(Register rd, Register rs, Register rt);
878 
879  void andi(Register rd, Register rs, int32_t j);
880  void ori(Register rd, Register rs, int32_t j);
881  void xori(Register rd, Register rs, int32_t j);
882  void lui(Register rd, int32_t j);
883  void aui(Register rt, Register rs, int32_t j);
884  void daui(Register rt, Register rs, int32_t j);
885  void dahi(Register rs, int32_t j);
886  void dati(Register rs, int32_t j);
887 
888  // Shifts.
889  // Please note: sll(zero_reg, zero_reg, x) instructions are reserved as nop
890  // and may cause problems in normal code. coming_from_nop makes sure this
891  // doesn't happen.
892  void sll(Register rd, Register rt, uint16_t sa, bool coming_from_nop = false);
893  void sllv(Register rd, Register rt, Register rs);
894  void srl(Register rd, Register rt, uint16_t sa);
895  void srlv(Register rd, Register rt, Register rs);
896  void sra(Register rt, Register rd, uint16_t sa);
897  void srav(Register rt, Register rd, Register rs);
898  void rotr(Register rd, Register rt, uint16_t sa);
899  void rotrv(Register rd, Register rt, Register rs);
900  void dsll(Register rd, Register rt, uint16_t sa);
901  void dsllv(Register rd, Register rt, Register rs);
902  void dsrl(Register rd, Register rt, uint16_t sa);
903  void dsrlv(Register rd, Register rt, Register rs);
904  void drotr(Register rd, Register rt, uint16_t sa);
905  void drotr32(Register rd, Register rt, uint16_t sa);
906  void drotrv(Register rd, Register rt, Register rs);
907  void dsra(Register rt, Register rd, uint16_t sa);
908  void dsrav(Register rd, Register rt, Register rs);
909  void dsll32(Register rt, Register rd, uint16_t sa);
910  void dsrl32(Register rt, Register rd, uint16_t sa);
911  void dsra32(Register rt, Register rd, uint16_t sa);
912 
913  // ------------Memory-instructions-------------
914 
915  void lb(Register rd, const MemOperand& rs);
916  void lbu(Register rd, const MemOperand& rs);
917  void lh(Register rd, const MemOperand& rs);
918  void lhu(Register rd, const MemOperand& rs);
919  void lw(Register rd, const MemOperand& rs);
920  void lwu(Register rd, const MemOperand& rs);
921  void lwl(Register rd, const MemOperand& rs);
922  void lwr(Register rd, const MemOperand& rs);
923  void sb(Register rd, const MemOperand& rs);
924  void sh(Register rd, const MemOperand& rs);
925  void sw(Register rd, const MemOperand& rs);
926  void swl(Register rd, const MemOperand& rs);
927  void swr(Register rd, const MemOperand& rs);
928  void ldl(Register rd, const MemOperand& rs);
929  void ldr(Register rd, const MemOperand& rs);
930  void sdl(Register rd, const MemOperand& rs);
931  void sdr(Register rd, const MemOperand& rs);
932  void ld(Register rd, const MemOperand& rs);
933  void sd(Register rd, const MemOperand& rs);
934 
935  // ----------Atomic instructions--------------
936 
937  void ll(Register rd, const MemOperand& rs);
938  void sc(Register rd, const MemOperand& rs);
939  void lld(Register rd, const MemOperand& rs);
940  void scd(Register rd, const MemOperand& rs);
941 
942  // ---------PC-Relative-instructions-----------
943 
944  void addiupc(Register rs, int32_t imm19);
945  void lwpc(Register rs, int32_t offset19);
946  void lwupc(Register rs, int32_t offset19);
947  void ldpc(Register rs, int32_t offset18);
948  void auipc(Register rs, int16_t imm16);
949  void aluipc(Register rs, int16_t imm16);
950 
951 
952  // ----------------Prefetch--------------------
953 
954  void pref(int32_t hint, const MemOperand& rs);
955 
956 
957  // -------------Misc-instructions--------------
958 
959  // Break / Trap instructions.
960  void break_(uint32_t code, bool break_as_stop = false);
961  void stop(const char* msg, uint32_t code = kMaxStopCode);
962  void tge(Register rs, Register rt, uint16_t code);
963  void tgeu(Register rs, Register rt, uint16_t code);
964  void tlt(Register rs, Register rt, uint16_t code);
965  void tltu(Register rs, Register rt, uint16_t code);
966  void teq(Register rs, Register rt, uint16_t code);
967  void tne(Register rs, Register rt, uint16_t code);
968 
969  // Memory barrier instruction.
970  void sync();
971 
972  // Move from HI/LO register.
973  void mfhi(Register rd);
974  void mflo(Register rd);
975 
976  // Set on less than.
977  void slt(Register rd, Register rs, Register rt);
978  void sltu(Register rd, Register rs, Register rt);
979  void slti(Register rd, Register rs, int32_t j);
980  void sltiu(Register rd, Register rs, int32_t j);
981 
982  // Conditional move.
983  void movz(Register rd, Register rs, Register rt);
984  void movn(Register rd, Register rs, Register rt);
985  void movt(Register rd, Register rs, uint16_t cc = 0);
986  void movf(Register rd, Register rs, uint16_t cc = 0);
987 
988  void sel(SecondaryField fmt, FPURegister fd, FPURegister fs, FPURegister ft);
989  void sel_s(FPURegister fd, FPURegister fs, FPURegister ft);
990  void sel_d(FPURegister fd, FPURegister fs, FPURegister ft);
991  void seleqz(Register rd, Register rs, Register rt);
992  void seleqz(SecondaryField fmt, FPURegister fd, FPURegister fs,
993  FPURegister ft);
994  void selnez(Register rs, Register rt, Register rd);
995  void selnez(SecondaryField fmt, FPURegister fd, FPURegister fs,
996  FPURegister ft);
997  void seleqz_d(FPURegister fd, FPURegister fs, FPURegister ft);
998  void seleqz_s(FPURegister fd, FPURegister fs, FPURegister ft);
999  void selnez_d(FPURegister fd, FPURegister fs, FPURegister ft);
1000  void selnez_s(FPURegister fd, FPURegister fs, FPURegister ft);
1001 
1002  void movz_s(FPURegister fd, FPURegister fs, Register rt);
1003  void movz_d(FPURegister fd, FPURegister fs, Register rt);
1004  void movt_s(FPURegister fd, FPURegister fs, uint16_t cc = 0);
1005  void movt_d(FPURegister fd, FPURegister fs, uint16_t cc = 0);
1006  void movf_s(FPURegister fd, FPURegister fs, uint16_t cc = 0);
1007  void movf_d(FPURegister fd, FPURegister fs, uint16_t cc = 0);
1008  void movn_s(FPURegister fd, FPURegister fs, Register rt);
1009  void movn_d(FPURegister fd, FPURegister fs, Register rt);
1010  // Bit twiddling.
1011  void clz(Register rd, Register rs);
1012  void dclz(Register rd, Register rs);
1013  void ins_(Register rt, Register rs, uint16_t pos, uint16_t size);
1014  void ext_(Register rt, Register rs, uint16_t pos, uint16_t size);
1015  void dext_(Register rt, Register rs, uint16_t pos, uint16_t size);
1016  void dextm_(Register rt, Register rs, uint16_t pos, uint16_t size);
1017  void dextu_(Register rt, Register rs, uint16_t pos, uint16_t size);
1018  void dins_(Register rt, Register rs, uint16_t pos, uint16_t size);
1019  void dinsm_(Register rt, Register rs, uint16_t pos, uint16_t size);
1020  void dinsu_(Register rt, Register rs, uint16_t pos, uint16_t size);
1021  void bitswap(Register rd, Register rt);
1022  void dbitswap(Register rd, Register rt);
1023  void align(Register rd, Register rs, Register rt, uint8_t bp);
1024  void dalign(Register rd, Register rs, Register rt, uint8_t bp);
1025 
1026  void wsbh(Register rd, Register rt);
1027  void dsbh(Register rd, Register rt);
1028  void dshd(Register rd, Register rt);
1029  void seh(Register rd, Register rt);
1030  void seb(Register rd, Register rt);
1031 
1032  // --------Coprocessor-instructions----------------
1033 
1034  // Load, store, and move.
1035  void lwc1(FPURegister fd, const MemOperand& src);
1036  void ldc1(FPURegister fd, const MemOperand& src);
1037 
1038  void swc1(FPURegister fs, const MemOperand& dst);
1039  void sdc1(FPURegister fs, const MemOperand& dst);
1040 
1041  void mtc1(Register rt, FPURegister fs);
1042  void mthc1(Register rt, FPURegister fs);
1043  void dmtc1(Register rt, FPURegister fs);
1044 
1045  void mfc1(Register rt, FPURegister fs);
1046  void mfhc1(Register rt, FPURegister fs);
1047  void dmfc1(Register rt, FPURegister fs);
1048 
1049  void ctc1(Register rt, FPUControlRegister fs);
1050  void cfc1(Register rt, FPUControlRegister fs);
1051 
1052  // Arithmetic.
1053  void add_s(FPURegister fd, FPURegister fs, FPURegister ft);
1054  void add_d(FPURegister fd, FPURegister fs, FPURegister ft);
1055  void sub_s(FPURegister fd, FPURegister fs, FPURegister ft);
1056  void sub_d(FPURegister fd, FPURegister fs, FPURegister ft);
1057  void mul_s(FPURegister fd, FPURegister fs, FPURegister ft);
1058  void mul_d(FPURegister fd, FPURegister fs, FPURegister ft);
1059  void madd_s(FPURegister fd, FPURegister fr, FPURegister fs, FPURegister ft);
1060  void madd_d(FPURegister fd, FPURegister fr, FPURegister fs, FPURegister ft);
1061  void msub_s(FPURegister fd, FPURegister fr, FPURegister fs, FPURegister ft);
1062  void msub_d(FPURegister fd, FPURegister fr, FPURegister fs, FPURegister ft);
1063  void maddf_s(FPURegister fd, FPURegister fs, FPURegister ft);
1064  void maddf_d(FPURegister fd, FPURegister fs, FPURegister ft);
1065  void msubf_s(FPURegister fd, FPURegister fs, FPURegister ft);
1066  void msubf_d(FPURegister fd, FPURegister fs, FPURegister ft);
1067  void div_s(FPURegister fd, FPURegister fs, FPURegister ft);
1068  void div_d(FPURegister fd, FPURegister fs, FPURegister ft);
1069  void abs_s(FPURegister fd, FPURegister fs);
1070  void abs_d(FPURegister fd, FPURegister fs);
1071  void mov_d(FPURegister fd, FPURegister fs);
1072  void mov_s(FPURegister fd, FPURegister fs);
1073  void neg_s(FPURegister fd, FPURegister fs);
1074  void neg_d(FPURegister fd, FPURegister fs);
1075  void sqrt_s(FPURegister fd, FPURegister fs);
1076  void sqrt_d(FPURegister fd, FPURegister fs);
1077  void rsqrt_s(FPURegister fd, FPURegister fs);
1078  void rsqrt_d(FPURegister fd, FPURegister fs);
1079  void recip_d(FPURegister fd, FPURegister fs);
1080  void recip_s(FPURegister fd, FPURegister fs);
1081 
1082  // Conversion.
1083  void cvt_w_s(FPURegister fd, FPURegister fs);
1084  void cvt_w_d(FPURegister fd, FPURegister fs);
1085  void trunc_w_s(FPURegister fd, FPURegister fs);
1086  void trunc_w_d(FPURegister fd, FPURegister fs);
1087  void round_w_s(FPURegister fd, FPURegister fs);
1088  void round_w_d(FPURegister fd, FPURegister fs);
1089  void floor_w_s(FPURegister fd, FPURegister fs);
1090  void floor_w_d(FPURegister fd, FPURegister fs);
1091  void ceil_w_s(FPURegister fd, FPURegister fs);
1092  void ceil_w_d(FPURegister fd, FPURegister fs);
1093  void rint_s(FPURegister fd, FPURegister fs);
1094  void rint_d(FPURegister fd, FPURegister fs);
1095  void rint(SecondaryField fmt, FPURegister fd, FPURegister fs);
1096 
1097 
1098  void cvt_l_s(FPURegister fd, FPURegister fs);
1099  void cvt_l_d(FPURegister fd, FPURegister fs);
1100  void trunc_l_s(FPURegister fd, FPURegister fs);
1101  void trunc_l_d(FPURegister fd, FPURegister fs);
1102  void round_l_s(FPURegister fd, FPURegister fs);
1103  void round_l_d(FPURegister fd, FPURegister fs);
1104  void floor_l_s(FPURegister fd, FPURegister fs);
1105  void floor_l_d(FPURegister fd, FPURegister fs);
1106  void ceil_l_s(FPURegister fd, FPURegister fs);
1107  void ceil_l_d(FPURegister fd, FPURegister fs);
1108 
1109  void class_s(FPURegister fd, FPURegister fs);
1110  void class_d(FPURegister fd, FPURegister fs);
1111 
1112  void min(SecondaryField fmt, FPURegister fd, FPURegister fs, FPURegister ft);
1113  void mina(SecondaryField fmt, FPURegister fd, FPURegister fs, FPURegister ft);
1114  void max(SecondaryField fmt, FPURegister fd, FPURegister fs, FPURegister ft);
1115  void maxa(SecondaryField fmt, FPURegister fd, FPURegister fs, FPURegister ft);
1116  void min_s(FPURegister fd, FPURegister fs, FPURegister ft);
1117  void min_d(FPURegister fd, FPURegister fs, FPURegister ft);
1118  void max_s(FPURegister fd, FPURegister fs, FPURegister ft);
1119  void max_d(FPURegister fd, FPURegister fs, FPURegister ft);
1120  void mina_s(FPURegister fd, FPURegister fs, FPURegister ft);
1121  void mina_d(FPURegister fd, FPURegister fs, FPURegister ft);
1122  void maxa_s(FPURegister fd, FPURegister fs, FPURegister ft);
1123  void maxa_d(FPURegister fd, FPURegister fs, FPURegister ft);
1124 
1125  void cvt_s_w(FPURegister fd, FPURegister fs);
1126  void cvt_s_l(FPURegister fd, FPURegister fs);
1127  void cvt_s_d(FPURegister fd, FPURegister fs);
1128 
1129  void cvt_d_w(FPURegister fd, FPURegister fs);
1130  void cvt_d_l(FPURegister fd, FPURegister fs);
1131  void cvt_d_s(FPURegister fd, FPURegister fs);
1132 
1133  // Conditions and branches for MIPSr6.
1134  void cmp(FPUCondition cond, SecondaryField fmt,
1135  FPURegister fd, FPURegister ft, FPURegister fs);
1136  void cmp_s(FPUCondition cond, FPURegister fd, FPURegister fs, FPURegister ft);
1137  void cmp_d(FPUCondition cond, FPURegister fd, FPURegister fs, FPURegister ft);
1138 
1139  void bc1eqz(int16_t offset, FPURegister ft);
1140  inline void bc1eqz(Label* L, FPURegister ft) {
1141  bc1eqz(shifted_branch_offset(L), ft);
1142  }
1143  void bc1nez(int16_t offset, FPURegister ft);
1144  inline void bc1nez(Label* L, FPURegister ft) {
1145  bc1nez(shifted_branch_offset(L), ft);
1146  }
1147 
1148  // Conditions and branches for non MIPSr6.
1149  void c(FPUCondition cond, SecondaryField fmt,
1150  FPURegister ft, FPURegister fs, uint16_t cc = 0);
1151  void c_s(FPUCondition cond, FPURegister ft, FPURegister fs, uint16_t cc = 0);
1152  void c_d(FPUCondition cond, FPURegister ft, FPURegister fs, uint16_t cc = 0);
1153 
1154  void bc1f(int16_t offset, uint16_t cc = 0);
1155  inline void bc1f(Label* L, uint16_t cc = 0) {
1156  bc1f(shifted_branch_offset(L), cc);
1157  }
1158  void bc1t(int16_t offset, uint16_t cc = 0);
1159  inline void bc1t(Label* L, uint16_t cc = 0) {
1160  bc1t(shifted_branch_offset(L), cc);
1161  }
1162  void fcmp(FPURegister src1, const double src2, FPUCondition cond);
1163 
1164  // MSA instructions
1165  void bz_v(MSARegister wt, int16_t offset);
1166  inline void bz_v(MSARegister wt, Label* L) {
1167  bz_v(wt, shifted_branch_offset(L));
1168  }
1169  void bz_b(MSARegister wt, int16_t offset);
1170  inline void bz_b(MSARegister wt, Label* L) {
1171  bz_b(wt, shifted_branch_offset(L));
1172  }
1173  void bz_h(MSARegister wt, int16_t offset);
1174  inline void bz_h(MSARegister wt, Label* L) {
1175  bz_h(wt, shifted_branch_offset(L));
1176  }
1177  void bz_w(MSARegister wt, int16_t offset);
1178  inline void bz_w(MSARegister wt, Label* L) {
1179  bz_w(wt, shifted_branch_offset(L));
1180  }
1181  void bz_d(MSARegister wt, int16_t offset);
1182  inline void bz_d(MSARegister wt, Label* L) {
1183  bz_d(wt, shifted_branch_offset(L));
1184  }
1185  void bnz_v(MSARegister wt, int16_t offset);
1186  inline void bnz_v(MSARegister wt, Label* L) {
1187  bnz_v(wt, shifted_branch_offset(L));
1188  }
1189  void bnz_b(MSARegister wt, int16_t offset);
1190  inline void bnz_b(MSARegister wt, Label* L) {
1191  bnz_b(wt, shifted_branch_offset(L));
1192  }
1193  void bnz_h(MSARegister wt, int16_t offset);
1194  inline void bnz_h(MSARegister wt, Label* L) {
1195  bnz_h(wt, shifted_branch_offset(L));
1196  }
1197  void bnz_w(MSARegister wt, int16_t offset);
1198  inline void bnz_w(MSARegister wt, Label* L) {
1199  bnz_w(wt, shifted_branch_offset(L));
1200  }
1201  void bnz_d(MSARegister wt, int16_t offset);
1202  inline void bnz_d(MSARegister wt, Label* L) {
1203  bnz_d(wt, shifted_branch_offset(L));
1204  }
1205 
1206  void ld_b(MSARegister wd, const MemOperand& rs);
1207  void ld_h(MSARegister wd, const MemOperand& rs);
1208  void ld_w(MSARegister wd, const MemOperand& rs);
1209  void ld_d(MSARegister wd, const MemOperand& rs);
1210  void st_b(MSARegister wd, const MemOperand& rs);
1211  void st_h(MSARegister wd, const MemOperand& rs);
1212  void st_w(MSARegister wd, const MemOperand& rs);
1213  void st_d(MSARegister wd, const MemOperand& rs);
1214 
1215  void ldi_b(MSARegister wd, int32_t imm10);
1216  void ldi_h(MSARegister wd, int32_t imm10);
1217  void ldi_w(MSARegister wd, int32_t imm10);
1218  void ldi_d(MSARegister wd, int32_t imm10);
1219 
1220  void addvi_b(MSARegister wd, MSARegister ws, uint32_t imm5);
1221  void addvi_h(MSARegister wd, MSARegister ws, uint32_t imm5);
1222  void addvi_w(MSARegister wd, MSARegister ws, uint32_t imm5);
1223  void addvi_d(MSARegister wd, MSARegister ws, uint32_t imm5);
1224  void subvi_b(MSARegister wd, MSARegister ws, uint32_t imm5);
1225  void subvi_h(MSARegister wd, MSARegister ws, uint32_t imm5);
1226  void subvi_w(MSARegister wd, MSARegister ws, uint32_t imm5);
1227  void subvi_d(MSARegister wd, MSARegister ws, uint32_t imm5);
1228  void maxi_s_b(MSARegister wd, MSARegister ws, uint32_t imm5);
1229  void maxi_s_h(MSARegister wd, MSARegister ws, uint32_t imm5);
1230  void maxi_s_w(MSARegister wd, MSARegister ws, uint32_t imm5);
1231  void maxi_s_d(MSARegister wd, MSARegister ws, uint32_t imm5);
1232  void maxi_u_b(MSARegister wd, MSARegister ws, uint32_t imm5);
1233  void maxi_u_h(MSARegister wd, MSARegister ws, uint32_t imm5);
1234  void maxi_u_w(MSARegister wd, MSARegister ws, uint32_t imm5);
1235  void maxi_u_d(MSARegister wd, MSARegister ws, uint32_t imm5);
1236  void mini_s_b(MSARegister wd, MSARegister ws, uint32_t imm5);
1237  void mini_s_h(MSARegister wd, MSARegister ws, uint32_t imm5);
1238  void mini_s_w(MSARegister wd, MSARegister ws, uint32_t imm5);
1239  void mini_s_d(MSARegister wd, MSARegister ws, uint32_t imm5);
1240  void mini_u_b(MSARegister wd, MSARegister ws, uint32_t imm5);
1241  void mini_u_h(MSARegister wd, MSARegister ws, uint32_t imm5);
1242  void mini_u_w(MSARegister wd, MSARegister ws, uint32_t imm5);
1243  void mini_u_d(MSARegister wd, MSARegister ws, uint32_t imm5);
1244  void ceqi_b(MSARegister wd, MSARegister ws, uint32_t imm5);
1245  void ceqi_h(MSARegister wd, MSARegister ws, uint32_t imm5);
1246  void ceqi_w(MSARegister wd, MSARegister ws, uint32_t imm5);
1247  void ceqi_d(MSARegister wd, MSARegister ws, uint32_t imm5);
1248  void clti_s_b(MSARegister wd, MSARegister ws, uint32_t imm5);
1249  void clti_s_h(MSARegister wd, MSARegister ws, uint32_t imm5);
1250  void clti_s_w(MSARegister wd, MSARegister ws, uint32_t imm5);
1251  void clti_s_d(MSARegister wd, MSARegister ws, uint32_t imm5);
1252  void clti_u_b(MSARegister wd, MSARegister ws, uint32_t imm5);
1253  void clti_u_h(MSARegister wd, MSARegister ws, uint32_t imm5);
1254  void clti_u_w(MSARegister wd, MSARegister ws, uint32_t imm5);
1255  void clti_u_d(MSARegister wd, MSARegister ws, uint32_t imm5);
1256  void clei_s_b(MSARegister wd, MSARegister ws, uint32_t imm5);
1257  void clei_s_h(MSARegister wd, MSARegister ws, uint32_t imm5);
1258  void clei_s_w(MSARegister wd, MSARegister ws, uint32_t imm5);
1259  void clei_s_d(MSARegister wd, MSARegister ws, uint32_t imm5);
1260  void clei_u_b(MSARegister wd, MSARegister ws, uint32_t imm5);
1261  void clei_u_h(MSARegister wd, MSARegister ws, uint32_t imm5);
1262  void clei_u_w(MSARegister wd, MSARegister ws, uint32_t imm5);
1263  void clei_u_d(MSARegister wd, MSARegister ws, uint32_t imm5);
1264 
1265  void andi_b(MSARegister wd, MSARegister ws, uint32_t imm8);
1266  void ori_b(MSARegister wd, MSARegister ws, uint32_t imm8);
1267  void nori_b(MSARegister wd, MSARegister ws, uint32_t imm8);
1268  void xori_b(MSARegister wd, MSARegister ws, uint32_t imm8);
1269  void bmnzi_b(MSARegister wd, MSARegister ws, uint32_t imm8);
1270  void bmzi_b(MSARegister wd, MSARegister ws, uint32_t imm8);
1271  void bseli_b(MSARegister wd, MSARegister ws, uint32_t imm8);
1272  void shf_b(MSARegister wd, MSARegister ws, uint32_t imm8);
1273  void shf_h(MSARegister wd, MSARegister ws, uint32_t imm8);
1274  void shf_w(MSARegister wd, MSARegister ws, uint32_t imm8);
1275 
1276  void and_v(MSARegister wd, MSARegister ws, MSARegister wt);
1277  void or_v(MSARegister wd, MSARegister ws, MSARegister wt);
1278  void nor_v(MSARegister wd, MSARegister ws, MSARegister wt);
1279  void xor_v(MSARegister wd, MSARegister ws, MSARegister wt);
1280  void bmnz_v(MSARegister wd, MSARegister ws, MSARegister wt);
1281  void bmz_v(MSARegister wd, MSARegister ws, MSARegister wt);
1282  void bsel_v(MSARegister wd, MSARegister ws, MSARegister wt);
1283 
1284  void fill_b(MSARegister wd, Register rs);
1285  void fill_h(MSARegister wd, Register rs);
1286  void fill_w(MSARegister wd, Register rs);
1287  void fill_d(MSARegister wd, Register rs);
1288  void pcnt_b(MSARegister wd, MSARegister ws);
1289  void pcnt_h(MSARegister wd, MSARegister ws);
1290  void pcnt_w(MSARegister wd, MSARegister ws);
1291  void pcnt_d(MSARegister wd, MSARegister ws);
1292  void nloc_b(MSARegister wd, MSARegister ws);
1293  void nloc_h(MSARegister wd, MSARegister ws);
1294  void nloc_w(MSARegister wd, MSARegister ws);
1295  void nloc_d(MSARegister wd, MSARegister ws);
1296  void nlzc_b(MSARegister wd, MSARegister ws);
1297  void nlzc_h(MSARegister wd, MSARegister ws);
1298  void nlzc_w(MSARegister wd, MSARegister ws);
1299  void nlzc_d(MSARegister wd, MSARegister ws);
1300 
1301  void fclass_w(MSARegister wd, MSARegister ws);
1302  void fclass_d(MSARegister wd, MSARegister ws);
1303  void ftrunc_s_w(MSARegister wd, MSARegister ws);
1304  void ftrunc_s_d(MSARegister wd, MSARegister ws);
1305  void ftrunc_u_w(MSARegister wd, MSARegister ws);
1306  void ftrunc_u_d(MSARegister wd, MSARegister ws);
1307  void fsqrt_w(MSARegister wd, MSARegister ws);
1308  void fsqrt_d(MSARegister wd, MSARegister ws);
1309  void frsqrt_w(MSARegister wd, MSARegister ws);
1310  void frsqrt_d(MSARegister wd, MSARegister ws);
1311  void frcp_w(MSARegister wd, MSARegister ws);
1312  void frcp_d(MSARegister wd, MSARegister ws);
1313  void frint_w(MSARegister wd, MSARegister ws);
1314  void frint_d(MSARegister wd, MSARegister ws);
1315  void flog2_w(MSARegister wd, MSARegister ws);
1316  void flog2_d(MSARegister wd, MSARegister ws);
1317  void fexupl_w(MSARegister wd, MSARegister ws);
1318  void fexupl_d(MSARegister wd, MSARegister ws);
1319  void fexupr_w(MSARegister wd, MSARegister ws);
1320  void fexupr_d(MSARegister wd, MSARegister ws);
1321  void ffql_w(MSARegister wd, MSARegister ws);
1322  void ffql_d(MSARegister wd, MSARegister ws);
1323  void ffqr_w(MSARegister wd, MSARegister ws);
1324  void ffqr_d(MSARegister wd, MSARegister ws);
1325  void ftint_s_w(MSARegister wd, MSARegister ws);
1326  void ftint_s_d(MSARegister wd, MSARegister ws);
1327  void ftint_u_w(MSARegister wd, MSARegister ws);
1328  void ftint_u_d(MSARegister wd, MSARegister ws);
1329  void ffint_s_w(MSARegister wd, MSARegister ws);
1330  void ffint_s_d(MSARegister wd, MSARegister ws);
1331  void ffint_u_w(MSARegister wd, MSARegister ws);
1332  void ffint_u_d(MSARegister wd, MSARegister ws);
1333 
1334  void sll_b(MSARegister wd, MSARegister ws, MSARegister wt);
1335  void sll_h(MSARegister wd, MSARegister ws, MSARegister wt);
1336  void sll_w(MSARegister wd, MSARegister ws, MSARegister wt);
1337  void sll_d(MSARegister wd, MSARegister ws, MSARegister wt);
1338  void sra_b(MSARegister wd, MSARegister ws, MSARegister wt);
1339  void sra_h(MSARegister wd, MSARegister ws, MSARegister wt);
1340  void sra_w(MSARegister wd, MSARegister ws, MSARegister wt);
1341  void sra_d(MSARegister wd, MSARegister ws, MSARegister wt);
1342  void srl_b(MSARegister wd, MSARegister ws, MSARegister wt);
1343  void srl_h(MSARegister wd, MSARegister ws, MSARegister wt);
1344  void srl_w(MSARegister wd, MSARegister ws, MSARegister wt);
1345  void srl_d(MSARegister wd, MSARegister ws, MSARegister wt);
1346  void bclr_b(MSARegister wd, MSARegister ws, MSARegister wt);
1347  void bclr_h(MSARegister wd, MSARegister ws, MSARegister wt);
1348  void bclr_w(MSARegister wd, MSARegister ws, MSARegister wt);
1349  void bclr_d(MSARegister wd, MSARegister ws, MSARegister wt);
1350  void bset_b(MSARegister wd, MSARegister ws, MSARegister wt);
1351  void bset_h(MSARegister wd, MSARegister ws, MSARegister wt);
1352  void bset_w(MSARegister wd, MSARegister ws, MSARegister wt);
1353  void bset_d(MSARegister wd, MSARegister ws, MSARegister wt);
1354  void bneg_b(MSARegister wd, MSARegister ws, MSARegister wt);
1355  void bneg_h(MSARegister wd, MSARegister ws, MSARegister wt);
1356  void bneg_w(MSARegister wd, MSARegister ws, MSARegister wt);
1357  void bneg_d(MSARegister wd, MSARegister ws, MSARegister wt);
1358  void binsl_b(MSARegister wd, MSARegister ws, MSARegister wt);
1359  void binsl_h(MSARegister wd, MSARegister ws, MSARegister wt);
1360  void binsl_w(MSARegister wd, MSARegister ws, MSARegister wt);
1361  void binsl_d(MSARegister wd, MSARegister ws, MSARegister wt);
1362  void binsr_b(MSARegister wd, MSARegister ws, MSARegister wt);
1363  void binsr_h(MSARegister wd, MSARegister ws, MSARegister wt);
1364  void binsr_w(MSARegister wd, MSARegister ws, MSARegister wt);
1365  void binsr_d(MSARegister wd, MSARegister ws, MSARegister wt);
1366  void addv_b(MSARegister wd, MSARegister ws, MSARegister wt);
1367  void addv_h(MSARegister wd, MSARegister ws, MSARegister wt);
1368  void addv_w(MSARegister wd, MSARegister ws, MSARegister wt);
1369  void addv_d(MSARegister wd, MSARegister ws, MSARegister wt);
1370  void subv_b(MSARegister wd, MSARegister ws, MSARegister wt);
1371  void subv_h(MSARegister wd, MSARegister ws, MSARegister wt);
1372  void subv_w(MSARegister wd, MSARegister ws, MSARegister wt);
1373  void subv_d(MSARegister wd, MSARegister ws, MSARegister wt);
1374  void max_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1375  void max_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1376  void max_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1377  void max_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1378  void max_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1379  void max_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1380  void max_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1381  void max_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1382  void min_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1383  void min_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1384  void min_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1385  void min_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1386  void min_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1387  void min_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1388  void min_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1389  void min_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1390  void max_a_b(MSARegister wd, MSARegister ws, MSARegister wt);
1391  void max_a_h(MSARegister wd, MSARegister ws, MSARegister wt);
1392  void max_a_w(MSARegister wd, MSARegister ws, MSARegister wt);
1393  void max_a_d(MSARegister wd, MSARegister ws, MSARegister wt);
1394  void min_a_b(MSARegister wd, MSARegister ws, MSARegister wt);
1395  void min_a_h(MSARegister wd, MSARegister ws, MSARegister wt);
1396  void min_a_w(MSARegister wd, MSARegister ws, MSARegister wt);
1397  void min_a_d(MSARegister wd, MSARegister ws, MSARegister wt);
1398  void ceq_b(MSARegister wd, MSARegister ws, MSARegister wt);
1399  void ceq_h(MSARegister wd, MSARegister ws, MSARegister wt);
1400  void ceq_w(MSARegister wd, MSARegister ws, MSARegister wt);
1401  void ceq_d(MSARegister wd, MSARegister ws, MSARegister wt);
1402  void clt_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1403  void clt_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1404  void clt_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1405  void clt_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1406  void clt_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1407  void clt_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1408  void clt_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1409  void clt_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1410  void cle_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1411  void cle_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1412  void cle_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1413  void cle_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1414  void cle_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1415  void cle_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1416  void cle_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1417  void cle_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1418  void add_a_b(MSARegister wd, MSARegister ws, MSARegister wt);
1419  void add_a_h(MSARegister wd, MSARegister ws, MSARegister wt);
1420  void add_a_w(MSARegister wd, MSARegister ws, MSARegister wt);
1421  void add_a_d(MSARegister wd, MSARegister ws, MSARegister wt);
1422  void adds_a_b(MSARegister wd, MSARegister ws, MSARegister wt);
1423  void adds_a_h(MSARegister wd, MSARegister ws, MSARegister wt);
1424  void adds_a_w(MSARegister wd, MSARegister ws, MSARegister wt);
1425  void adds_a_d(MSARegister wd, MSARegister ws, MSARegister wt);
1426  void adds_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1427  void adds_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1428  void adds_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1429  void adds_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1430  void adds_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1431  void adds_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1432  void adds_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1433  void adds_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1434  void ave_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1435  void ave_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1436  void ave_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1437  void ave_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1438  void ave_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1439  void ave_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1440  void ave_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1441  void ave_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1442  void aver_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1443  void aver_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1444  void aver_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1445  void aver_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1446  void aver_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1447  void aver_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1448  void aver_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1449  void aver_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1450  void subs_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1451  void subs_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1452  void subs_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1453  void subs_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1454  void subs_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1455  void subs_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1456  void subs_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1457  void subs_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1458  void subsus_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1459  void subsus_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1460  void subsus_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1461  void subsus_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1462  void subsus_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1463  void subsus_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1464  void subsus_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1465  void subsus_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1466  void subsuu_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1467  void subsuu_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1468  void subsuu_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1469  void subsuu_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1470  void subsuu_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1471  void subsuu_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1472  void subsuu_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1473  void subsuu_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1474  void asub_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1475  void asub_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1476  void asub_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1477  void asub_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1478  void asub_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1479  void asub_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1480  void asub_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1481  void asub_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1482  void mulv_b(MSARegister wd, MSARegister ws, MSARegister wt);
1483  void mulv_h(MSARegister wd, MSARegister ws, MSARegister wt);
1484  void mulv_w(MSARegister wd, MSARegister ws, MSARegister wt);
1485  void mulv_d(MSARegister wd, MSARegister ws, MSARegister wt);
1486  void maddv_b(MSARegister wd, MSARegister ws, MSARegister wt);
1487  void maddv_h(MSARegister wd, MSARegister ws, MSARegister wt);
1488  void maddv_w(MSARegister wd, MSARegister ws, MSARegister wt);
1489  void maddv_d(MSARegister wd, MSARegister ws, MSARegister wt);
1490  void msubv_b(MSARegister wd, MSARegister ws, MSARegister wt);
1491  void msubv_h(MSARegister wd, MSARegister ws, MSARegister wt);
1492  void msubv_w(MSARegister wd, MSARegister ws, MSARegister wt);
1493  void msubv_d(MSARegister wd, MSARegister ws, MSARegister wt);
1494  void div_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1495  void div_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1496  void div_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1497  void div_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1498  void div_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1499  void div_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1500  void div_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1501  void div_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1502  void mod_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1503  void mod_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1504  void mod_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1505  void mod_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1506  void mod_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1507  void mod_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1508  void mod_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1509  void mod_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1510  void dotp_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1511  void dotp_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1512  void dotp_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1513  void dotp_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1514  void dotp_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1515  void dotp_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1516  void dotp_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1517  void dotp_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1518  void dpadd_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1519  void dpadd_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1520  void dpadd_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1521  void dpadd_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1522  void dpadd_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1523  void dpadd_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1524  void dpadd_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1525  void dpadd_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1526  void dpsub_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1527  void dpsub_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1528  void dpsub_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1529  void dpsub_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1530  void dpsub_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1531  void dpsub_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1532  void dpsub_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1533  void dpsub_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1534  void sld_b(MSARegister wd, MSARegister ws, Register rt);
1535  void sld_h(MSARegister wd, MSARegister ws, Register rt);
1536  void sld_w(MSARegister wd, MSARegister ws, Register rt);
1537  void sld_d(MSARegister wd, MSARegister ws, Register rt);
1538  void splat_b(MSARegister wd, MSARegister ws, Register rt);
1539  void splat_h(MSARegister wd, MSARegister ws, Register rt);
1540  void splat_w(MSARegister wd, MSARegister ws, Register rt);
1541  void splat_d(MSARegister wd, MSARegister ws, Register rt);
1542  void pckev_b(MSARegister wd, MSARegister ws, MSARegister wt);
1543  void pckev_h(MSARegister wd, MSARegister ws, MSARegister wt);
1544  void pckev_w(MSARegister wd, MSARegister ws, MSARegister wt);
1545  void pckev_d(MSARegister wd, MSARegister ws, MSARegister wt);
1546  void pckod_b(MSARegister wd, MSARegister ws, MSARegister wt);
1547  void pckod_h(MSARegister wd, MSARegister ws, MSARegister wt);
1548  void pckod_w(MSARegister wd, MSARegister ws, MSARegister wt);
1549  void pckod_d(MSARegister wd, MSARegister ws, MSARegister wt);
1550  void ilvl_b(MSARegister wd, MSARegister ws, MSARegister wt);
1551  void ilvl_h(MSARegister wd, MSARegister ws, MSARegister wt);
1552  void ilvl_w(MSARegister wd, MSARegister ws, MSARegister wt);
1553  void ilvl_d(MSARegister wd, MSARegister ws, MSARegister wt);
1554  void ilvr_b(MSARegister wd, MSARegister ws, MSARegister wt);
1555  void ilvr_h(MSARegister wd, MSARegister ws, MSARegister wt);
1556  void ilvr_w(MSARegister wd, MSARegister ws, MSARegister wt);
1557  void ilvr_d(MSARegister wd, MSARegister ws, MSARegister wt);
1558  void ilvev_b(MSARegister wd, MSARegister ws, MSARegister wt);
1559  void ilvev_h(MSARegister wd, MSARegister ws, MSARegister wt);
1560  void ilvev_w(MSARegister wd, MSARegister ws, MSARegister wt);
1561  void ilvev_d(MSARegister wd, MSARegister ws, MSARegister wt);
1562  void ilvod_b(MSARegister wd, MSARegister ws, MSARegister wt);
1563  void ilvod_h(MSARegister wd, MSARegister ws, MSARegister wt);
1564  void ilvod_w(MSARegister wd, MSARegister ws, MSARegister wt);
1565  void ilvod_d(MSARegister wd, MSARegister ws, MSARegister wt);
1566  void vshf_b(MSARegister wd, MSARegister ws, MSARegister wt);
1567  void vshf_h(MSARegister wd, MSARegister ws, MSARegister wt);
1568  void vshf_w(MSARegister wd, MSARegister ws, MSARegister wt);
1569  void vshf_d(MSARegister wd, MSARegister ws, MSARegister wt);
1570  void srar_b(MSARegister wd, MSARegister ws, MSARegister wt);
1571  void srar_h(MSARegister wd, MSARegister ws, MSARegister wt);
1572  void srar_w(MSARegister wd, MSARegister ws, MSARegister wt);
1573  void srar_d(MSARegister wd, MSARegister ws, MSARegister wt);
1574  void srlr_b(MSARegister wd, MSARegister ws, MSARegister wt);
1575  void srlr_h(MSARegister wd, MSARegister ws, MSARegister wt);
1576  void srlr_w(MSARegister wd, MSARegister ws, MSARegister wt);
1577  void srlr_d(MSARegister wd, MSARegister ws, MSARegister wt);
1578  void hadd_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1579  void hadd_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1580  void hadd_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1581  void hadd_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1582  void hadd_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1583  void hadd_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1584  void hadd_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1585  void hadd_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1586  void hsub_s_b(MSARegister wd, MSARegister ws, MSARegister wt);
1587  void hsub_s_h(MSARegister wd, MSARegister ws, MSARegister wt);
1588  void hsub_s_w(MSARegister wd, MSARegister ws, MSARegister wt);
1589  void hsub_s_d(MSARegister wd, MSARegister ws, MSARegister wt);
1590  void hsub_u_b(MSARegister wd, MSARegister ws, MSARegister wt);
1591  void hsub_u_h(MSARegister wd, MSARegister ws, MSARegister wt);
1592  void hsub_u_w(MSARegister wd, MSARegister ws, MSARegister wt);
1593  void hsub_u_d(MSARegister wd, MSARegister ws, MSARegister wt);
1594 
1595  void fcaf_w(MSARegister wd, MSARegister ws, MSARegister wt);
1596  void fcaf_d(MSARegister wd, MSARegister ws, MSARegister wt);
1597  void fcun_w(MSARegister wd, MSARegister ws, MSARegister wt);
1598  void fcun_d(MSARegister wd, MSARegister ws, MSARegister wt);
1599  void fceq_w(MSARegister wd, MSARegister ws, MSARegister wt);
1600  void fceq_d(MSARegister wd, MSARegister ws, MSARegister wt);
1601  void fcueq_w(MSARegister wd, MSARegister ws, MSARegister wt);
1602  void fcueq_d(MSARegister wd, MSARegister ws, MSARegister wt);
1603  void fclt_w(MSARegister wd, MSARegister ws, MSARegister wt);
1604  void fclt_d(MSARegister wd, MSARegister ws, MSARegister wt);
1605  void fcult_w(MSARegister wd, MSARegister ws, MSARegister wt);
1606  void fcult_d(MSARegister wd, MSARegister ws, MSARegister wt);
1607  void fcle_w(MSARegister wd, MSARegister ws, MSARegister wt);
1608  void fcle_d(MSARegister wd, MSARegister ws, MSARegister wt);
1609  void fcule_w(MSARegister wd, MSARegister ws, MSARegister wt);
1610  void fcule_d(MSARegister wd, MSARegister ws, MSARegister wt);
1611  void fsaf_w(MSARegister wd, MSARegister ws, MSARegister wt);
1612  void fsaf_d(MSARegister wd, MSARegister ws, MSARegister wt);
1613  void fsun_w(MSARegister wd, MSARegister ws, MSARegister wt);
1614  void fsun_d(MSARegister wd, MSARegister ws, MSARegister wt);
1615  void fseq_w(MSARegister wd, MSARegister ws, MSARegister wt);
1616  void fseq_d(MSARegister wd, MSARegister ws, MSARegister wt);
1617  void fsueq_w(MSARegister wd, MSARegister ws, MSARegister wt);
1618  void fsueq_d(MSARegister wd, MSARegister ws, MSARegister wt);
1619  void fslt_w(MSARegister wd, MSARegister ws, MSARegister wt);
1620  void fslt_d(MSARegister wd, MSARegister ws, MSARegister wt);
1621  void fsult_w(MSARegister wd, MSARegister ws, MSARegister wt);
1622  void fsult_d(MSARegister wd, MSARegister ws, MSARegister wt);
1623  void fsle_w(MSARegister wd, MSARegister ws, MSARegister wt);
1624  void fsle_d(MSARegister wd, MSARegister ws, MSARegister wt);
1625  void fsule_w(MSARegister wd, MSARegister ws, MSARegister wt);
1626  void fsule_d(MSARegister wd, MSARegister ws, MSARegister wt);
1627  void fadd_w(MSARegister wd, MSARegister ws, MSARegister wt);
1628  void fadd_d(MSARegister wd, MSARegister ws, MSARegister wt);
1629  void fsub_w(MSARegister wd, MSARegister ws, MSARegister wt);
1630  void fsub_d(MSARegister wd, MSARegister ws, MSARegister wt);
1631  void fmul_w(MSARegister wd, MSARegister ws, MSARegister wt);
1632  void fmul_d(MSARegister wd, MSARegister ws, MSARegister wt);
1633  void fdiv_w(MSARegister wd, MSARegister ws, MSARegister wt);
1634  void fdiv_d(MSARegister wd, MSARegister ws, MSARegister wt);
1635  void fmadd_w(MSARegister wd, MSARegister ws, MSARegister wt);
1636  void fmadd_d(MSARegister wd, MSARegister ws, MSARegister wt);
1637  void fmsub_w(MSARegister wd, MSARegister ws, MSARegister wt);
1638  void fmsub_d(MSARegister wd, MSARegister ws, MSARegister wt);
1639  void fexp2_w(MSARegister wd, MSARegister ws, MSARegister wt);
1640  void fexp2_d(MSARegister wd, MSARegister ws, MSARegister wt);
1641  void fexdo_h(MSARegister wd, MSARegister ws, MSARegister wt);
1642  void fexdo_w(MSARegister wd, MSARegister ws, MSARegister wt);
1643  void ftq_h(MSARegister wd, MSARegister ws, MSARegister wt);
1644  void ftq_w(MSARegister wd, MSARegister ws, MSARegister wt);
1645  void fmin_w(MSARegister wd, MSARegister ws, MSARegister wt);
1646  void fmin_d(MSARegister wd, MSARegister ws, MSARegister wt);
1647  void fmin_a_w(MSARegister wd, MSARegister ws, MSARegister wt);
1648  void fmin_a_d(MSARegister wd, MSARegister ws, MSARegister wt);
1649  void fmax_w(MSARegister wd, MSARegister ws, MSARegister wt);
1650  void fmax_d(MSARegister wd, MSARegister ws, MSARegister wt);
1651  void fmax_a_w(MSARegister wd, MSARegister ws, MSARegister wt);
1652  void fmax_a_d(MSARegister wd, MSARegister ws, MSARegister wt);
1653  void fcor_w(MSARegister wd, MSARegister ws, MSARegister wt);
1654  void fcor_d(MSARegister wd, MSARegister ws, MSARegister wt);
1655  void fcune_w(MSARegister wd, MSARegister ws, MSARegister wt);
1656  void fcune_d(MSARegister wd, MSARegister ws, MSARegister wt);
1657  void fcne_w(MSARegister wd, MSARegister ws, MSARegister wt);
1658  void fcne_d(MSARegister wd, MSARegister ws, MSARegister wt);
1659  void mul_q_h(MSARegister wd, MSARegister ws, MSARegister wt);
1660  void mul_q_w(MSARegister wd, MSARegister ws, MSARegister wt);
1661  void madd_q_h(MSARegister wd, MSARegister ws, MSARegister wt);
1662  void madd_q_w(MSARegister wd, MSARegister ws, MSARegister wt);
1663  void msub_q_h(MSARegister wd, MSARegister ws, MSARegister wt);
1664  void msub_q_w(MSARegister wd, MSARegister ws, MSARegister wt);
1665  void fsor_w(MSARegister wd, MSARegister ws, MSARegister wt);
1666  void fsor_d(MSARegister wd, MSARegister ws, MSARegister wt);
1667  void fsune_w(MSARegister wd, MSARegister ws, MSARegister wt);
1668  void fsune_d(MSARegister wd, MSARegister ws, MSARegister wt);
1669  void fsne_w(MSARegister wd, MSARegister ws, MSARegister wt);
1670  void fsne_d(MSARegister wd, MSARegister ws, MSARegister wt);
1671  void mulr_q_h(MSARegister wd, MSARegister ws, MSARegister wt);
1672  void mulr_q_w(MSARegister wd, MSARegister ws, MSARegister wt);
1673  void maddr_q_h(MSARegister wd, MSARegister ws, MSARegister wt);
1674  void maddr_q_w(MSARegister wd, MSARegister ws, MSARegister wt);
1675  void msubr_q_h(MSARegister wd, MSARegister ws, MSARegister wt);
1676  void msubr_q_w(MSARegister wd, MSARegister ws, MSARegister wt);
1677 
1678  void sldi_b(MSARegister wd, MSARegister ws, uint32_t n);
1679  void sldi_h(MSARegister wd, MSARegister ws, uint32_t n);
1680  void sldi_w(MSARegister wd, MSARegister ws, uint32_t n);
1681  void sldi_d(MSARegister wd, MSARegister ws, uint32_t n);
1682  void splati_b(MSARegister wd, MSARegister ws, uint32_t n);
1683  void splati_h(MSARegister wd, MSARegister ws, uint32_t n);
1684  void splati_w(MSARegister wd, MSARegister ws, uint32_t n);
1685  void splati_d(MSARegister wd, MSARegister ws, uint32_t n);
1686  void copy_s_b(Register rd, MSARegister ws, uint32_t n);
1687  void copy_s_h(Register rd, MSARegister ws, uint32_t n);
1688  void copy_s_w(Register rd, MSARegister ws, uint32_t n);
1689  void copy_s_d(Register rd, MSARegister ws, uint32_t n);
1690  void copy_u_b(Register rd, MSARegister ws, uint32_t n);
1691  void copy_u_h(Register rd, MSARegister ws, uint32_t n);
1692  void copy_u_w(Register rd, MSARegister ws, uint32_t n);
1693  void insert_b(MSARegister wd, uint32_t n, Register rs);
1694  void insert_h(MSARegister wd, uint32_t n, Register rs);
1695  void insert_w(MSARegister wd, uint32_t n, Register rs);
1696  void insert_d(MSARegister wd, uint32_t n, Register rs);
1697  void insve_b(MSARegister wd, uint32_t n, MSARegister ws);
1698  void insve_h(MSARegister wd, uint32_t n, MSARegister ws);
1699  void insve_w(MSARegister wd, uint32_t n, MSARegister ws);
1700  void insve_d(MSARegister wd, uint32_t n, MSARegister ws);
1701  void move_v(MSARegister wd, MSARegister ws);
1702  void ctcmsa(MSAControlRegister cd, Register rs);
1703  void cfcmsa(Register rd, MSAControlRegister cs);
1704 
1705  void slli_b(MSARegister wd, MSARegister ws, uint32_t m);
1706  void slli_h(MSARegister wd, MSARegister ws, uint32_t m);
1707  void slli_w(MSARegister wd, MSARegister ws, uint32_t m);
1708  void slli_d(MSARegister wd, MSARegister ws, uint32_t m);
1709  void srai_b(MSARegister wd, MSARegister ws, uint32_t m);
1710  void srai_h(MSARegister wd, MSARegister ws, uint32_t m);
1711  void srai_w(MSARegister wd, MSARegister ws, uint32_t m);
1712  void srai_d(MSARegister wd, MSARegister ws, uint32_t m);
1713  void srli_b(MSARegister wd, MSARegister ws, uint32_t m);
1714  void srli_h(MSARegister wd, MSARegister ws, uint32_t m);
1715  void srli_w(MSARegister wd, MSARegister ws, uint32_t m);
1716  void srli_d(MSARegister wd, MSARegister ws, uint32_t m);
1717  void bclri_b(MSARegister wd, MSARegister ws, uint32_t m);
1718  void bclri_h(MSARegister wd, MSARegister ws, uint32_t m);
1719  void bclri_w(MSARegister wd, MSARegister ws, uint32_t m);
1720  void bclri_d(MSARegister wd, MSARegister ws, uint32_t m);
1721  void bseti_b(MSARegister wd, MSARegister ws, uint32_t m);
1722  void bseti_h(MSARegister wd, MSARegister ws, uint32_t m);
1723  void bseti_w(MSARegister wd, MSARegister ws, uint32_t m);
1724  void bseti_d(MSARegister wd, MSARegister ws, uint32_t m);
1725  void bnegi_b(MSARegister wd, MSARegister ws, uint32_t m);
1726  void bnegi_h(MSARegister wd, MSARegister ws, uint32_t m);
1727  void bnegi_w(MSARegister wd, MSARegister ws, uint32_t m);
1728  void bnegi_d(MSARegister wd, MSARegister ws, uint32_t m);
1729  void binsli_b(MSARegister wd, MSARegister ws, uint32_t m);
1730  void binsli_h(MSARegister wd, MSARegister ws, uint32_t m);
1731  void binsli_w(MSARegister wd, MSARegister ws, uint32_t m);
1732  void binsli_d(MSARegister wd, MSARegister ws, uint32_t m);
1733  void binsri_b(MSARegister wd, MSARegister ws, uint32_t m);
1734  void binsri_h(MSARegister wd, MSARegister ws, uint32_t m);
1735  void binsri_w(MSARegister wd, MSARegister ws, uint32_t m);
1736  void binsri_d(MSARegister wd, MSARegister ws, uint32_t m);
1737  void sat_s_b(MSARegister wd, MSARegister ws, uint32_t m);
1738  void sat_s_h(MSARegister wd, MSARegister ws, uint32_t m);
1739  void sat_s_w(MSARegister wd, MSARegister ws, uint32_t m);
1740  void sat_s_d(MSARegister wd, MSARegister ws, uint32_t m);
1741  void sat_u_b(MSARegister wd, MSARegister ws, uint32_t m);
1742  void sat_u_h(MSARegister wd, MSARegister ws, uint32_t m);
1743  void sat_u_w(MSARegister wd, MSARegister ws, uint32_t m);
1744  void sat_u_d(MSARegister wd, MSARegister ws, uint32_t m);
1745  void srari_b(MSARegister wd, MSARegister ws, uint32_t m);
1746  void srari_h(MSARegister wd, MSARegister ws, uint32_t m);
1747  void srari_w(MSARegister wd, MSARegister ws, uint32_t m);
1748  void srari_d(MSARegister wd, MSARegister ws, uint32_t m);
1749  void srlri_b(MSARegister wd, MSARegister ws, uint32_t m);
1750  void srlri_h(MSARegister wd, MSARegister ws, uint32_t m);
1751  void srlri_w(MSARegister wd, MSARegister ws, uint32_t m);
1752  void srlri_d(MSARegister wd, MSARegister ws, uint32_t m);
1753 
1754  // Check the code size generated from label to here.
1755  int SizeOfCodeGeneratedSince(Label* label) {
1756  return pc_offset() - label->pos();
1757  }
1758 
1759  // Check the number of instructions generated from label to here.
1760  int InstructionsGeneratedSince(Label* label) {
1761  return SizeOfCodeGeneratedSince(label) / kInstrSize;
1762  }
1763 
1764  // Class for scoping postponing the trampoline pool generation.
1765  class BlockTrampolinePoolScope {
1766  public:
1767  explicit BlockTrampolinePoolScope(Assembler* assem) : assem_(assem) {
1768  assem_->StartBlockTrampolinePool();
1769  }
1770  ~BlockTrampolinePoolScope() {
1771  assem_->EndBlockTrampolinePool();
1772  }
1773 
1774  private:
1775  Assembler* assem_;
1776 
1777  DISALLOW_IMPLICIT_CONSTRUCTORS(BlockTrampolinePoolScope);
1778  };
1779 
1780  // Class for postponing the assembly buffer growth. Typically used for
1781  // sequences of instructions that must be emitted as a unit, before
1782  // buffer growth (and relocation) can occur.
1783  // This blocking scope is not nestable.
1784  class BlockGrowBufferScope {
1785  public:
1786  explicit BlockGrowBufferScope(Assembler* assem) : assem_(assem) {
1787  assem_->StartBlockGrowBuffer();
1788  }
1789  ~BlockGrowBufferScope() {
1790  assem_->EndBlockGrowBuffer();
1791  }
1792 
1793  private:
1794  Assembler* assem_;
1795 
1796  DISALLOW_IMPLICIT_CONSTRUCTORS(BlockGrowBufferScope);
1797  };
1798 
1799  // Record a comment relocation entry that can be used by a disassembler.
1800  // Use --code-comments to enable.
1801  void RecordComment(const char* msg);
1802 
1803  // Record a deoptimization reason that can be used by a log or cpu profiler.
1804  // Use --trace-deopt to enable.
1805  void RecordDeoptReason(DeoptimizeReason reason, SourcePosition position,
1806  int id);
1807 
1808  static int RelocateInternalReference(RelocInfo::Mode rmode, Address pc,
1809  intptr_t pc_delta);
1810 
1811  // Writes a single byte or word of data in the code stream. Used for
1812  // inline tables, e.g., jump-tables.
1813  void db(uint8_t data);
1814  void dd(uint32_t data);
1815  void dq(uint64_t data);
1816  void dp(uintptr_t data) { dq(data); }
1817  void dd(Label* label);
1818 
1819  // Postpone the generation of the trampoline pool for the specified number of
1820  // instructions.
1821  void BlockTrampolinePoolFor(int instructions);
1822 
1823  // Check if there is less than kGap bytes available in the buffer.
1824  // If this is the case, we need to grow the buffer before emitting
1825  // an instruction or relocation information.
1826  inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; }
1827 
1828  // Get the number of bytes available in the buffer.
1829  inline intptr_t available_space() const {
1830  return reloc_info_writer.pos() - pc_;
1831  }
1832 
1833  // Read/patch instructions.
1834  static Instr instr_at(Address pc) { return *reinterpret_cast<Instr*>(pc); }
1835  static void instr_at_put(Address pc, Instr instr) {
1836  *reinterpret_cast<Instr*>(pc) = instr;
1837  }
1838  Instr instr_at(int pos) { return *reinterpret_cast<Instr*>(buffer_ + pos); }
1839  void instr_at_put(int pos, Instr instr) {
1840  *reinterpret_cast<Instr*>(buffer_ + pos) = instr;
1841  }
1842 
1843  // Check if an instruction is a branch of some kind.
1844  static bool IsBranch(Instr instr);
1845  static bool IsMsaBranch(Instr instr);
1846  static bool IsBc(Instr instr);
1847  static bool IsNal(Instr instr);
1848  static bool IsBzc(Instr instr);
1849 
1850  static bool IsBeq(Instr instr);
1851  static bool IsBne(Instr instr);
1852  static bool IsBeqzc(Instr instr);
1853  static bool IsBnezc(Instr instr);
1854  static bool IsBeqc(Instr instr);
1855  static bool IsBnec(Instr instr);
1856 
1857 
1858  static bool IsJump(Instr instr);
1859  static bool IsJ(Instr instr);
1860  static bool IsLui(Instr instr);
1861  static bool IsOri(Instr instr);
1862  static bool IsMov(Instr instr, Register rd, Register rs);
1863 
1864  static bool IsJal(Instr instr);
1865  static bool IsJr(Instr instr);
1866  static bool IsJalr(Instr instr);
1867 
1868  static bool IsNop(Instr instr, unsigned int type);
1869  static bool IsPop(Instr instr);
1870  static bool IsPush(Instr instr);
1871  static bool IsLwRegFpOffset(Instr instr);
1872  static bool IsSwRegFpOffset(Instr instr);
1873  static bool IsLwRegFpNegOffset(Instr instr);
1874  static bool IsSwRegFpNegOffset(Instr instr);
1875 
1876  static Register GetRtReg(Instr instr);
1877  static Register GetRsReg(Instr instr);
1878  static Register GetRdReg(Instr instr);
1879 
1880  static uint32_t GetRt(Instr instr);
1881  static uint32_t GetRtField(Instr instr);
1882  static uint32_t GetRs(Instr instr);
1883  static uint32_t GetRsField(Instr instr);
1884  static uint32_t GetRd(Instr instr);
1885  static uint32_t GetRdField(Instr instr);
1886  static uint32_t GetSa(Instr instr);
1887  static uint32_t GetSaField(Instr instr);
1888  static uint32_t GetOpcodeField(Instr instr);
1889  static uint32_t GetFunction(Instr instr);
1890  static uint32_t GetFunctionField(Instr instr);
1891  static uint32_t GetImmediate16(Instr instr);
1892  static uint32_t GetLabelConst(Instr instr);
1893 
1894  static int32_t GetBranchOffset(Instr instr);
1895  static bool IsLw(Instr instr);
1896  static int16_t GetLwOffset(Instr instr);
1897  static Instr SetLwOffset(Instr instr, int16_t offset);
1898 
1899  static bool IsSw(Instr instr);
1900  static Instr SetSwOffset(Instr instr, int16_t offset);
1901  static bool IsAddImmediate(Instr instr);
1902  static Instr SetAddImmediateOffset(Instr instr, int16_t offset);
1903 
1904  static bool IsAndImmediate(Instr instr);
1905  static bool IsEmittedConstant(Instr instr);
1906 
1907  void CheckTrampolinePool();
1908 
1909  bool IsPrevInstrCompactBranch() { return prev_instr_compact_branch_; }
1910  static bool IsCompactBranchSupported() { return kArchVariant == kMips64r6; }
1911 
1912  inline int UnboundLabelsCount() { return unbound_labels_count_; }
1913 
1914  protected:
1915  // Load Scaled Address instructions.
1916  void lsa(Register rd, Register rt, Register rs, uint8_t sa);
1917  void dlsa(Register rd, Register rt, Register rs, uint8_t sa);
1918 
1919  // Readable constants for base and offset adjustment helper, these indicate if
1920  // aside from offset, another value like offset + 4 should fit into int16.
1921  enum class OffsetAccessType : bool {
1922  SINGLE_ACCESS = false,
1923  TWO_ACCESSES = true
1924  };
1925 
1926  // Helper function for memory load/store using base register and offset.
1927  void AdjustBaseAndOffset(
1928  MemOperand& src,
1929  OffsetAccessType access_type = OffsetAccessType::SINGLE_ACCESS,
1930  int second_access_add_to_offset = 4);
1931 
1932  inline static void set_target_internal_reference_encoded_at(Address pc,
1933  Address target);
1934 
1935  int64_t buffer_space() const { return reloc_info_writer.pos() - pc_; }
1936 
1937  // Decode branch instruction at pos and return branch target pos.
1938  int target_at(int pos, bool is_internal);
1939 
1940  // Patch branch instruction at pos to branch to given branch target pos.
1941  void target_at_put(int pos, int target_pos, bool is_internal);
1942 
1943  // Say if we need to relocate with this mode.
1944  bool MustUseReg(RelocInfo::Mode rmode);
1945 
1946  // Record reloc info for current pc_.
1947  void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0);
1948 
1949  // Block the emission of the trampoline pool before pc_offset.
1950  void BlockTrampolinePoolBefore(int pc_offset) {
1951  if (no_trampoline_pool_before_ < pc_offset)
1952  no_trampoline_pool_before_ = pc_offset;
1953  }
1954 
1955  void StartBlockTrampolinePool() {
1956  trampoline_pool_blocked_nesting_++;
1957  }
1958 
1959  void EndBlockTrampolinePool() {
1960  trampoline_pool_blocked_nesting_--;
1961  if (trampoline_pool_blocked_nesting_ == 0) {
1962  CheckTrampolinePoolQuick(1);
1963  }
1964  }
1965 
1966  bool is_trampoline_pool_blocked() const {
1967  return trampoline_pool_blocked_nesting_ > 0;
1968  }
1969 
1970  bool has_exception() const {
1971  return internal_trampoline_exception_;
1972  }
1973 
1974  bool is_trampoline_emitted() const {
1975  return trampoline_emitted_;
1976  }
1977 
1978  // Temporarily block automatic assembly buffer growth.
1979  void StartBlockGrowBuffer() {
1980  DCHECK(!block_buffer_growth_);
1981  block_buffer_growth_ = true;
1982  }
1983 
1984  void EndBlockGrowBuffer() {
1985  DCHECK(block_buffer_growth_);
1986  block_buffer_growth_ = false;
1987  }
1988 
1989  bool is_buffer_growth_blocked() const {
1990  return block_buffer_growth_;
1991  }
1992 
1993  void EmitForbiddenSlotInstruction() {
1994  if (IsPrevInstrCompactBranch()) {
1995  nop();
1996  }
1997  }
1998 
1999  void CheckTrampolinePoolQuick(int extra_instructions = 0) {
2000  if (pc_offset() >= next_buffer_check_ - extra_instructions * kInstrSize) {
2001  CheckTrampolinePool();
2002  }
2003  }
2004 
2005  private:
2006  // Avoid overflows for displacements etc.
2007  static const int kMaximalBufferSize = 512 * MB;
2008 
2009  // Buffer size and constant pool distance are checked together at regular
2010  // intervals of kBufferCheckInterval emitted bytes.
2011  static constexpr int kBufferCheckInterval = 1 * KB / 2;
2012 
2013  // Code generation.
2014  // The relocation writer's position is at least kGap bytes below the end of
2015  // the generated instructions. This is so that multi-instruction sequences do
2016  // not have to check for overflow. The same is true for writes of large
2017  // relocation info entries.
2018  static constexpr int kGap = 128;
2019 
2020  // Repeated checking whether the trampoline pool should be emitted is rather
2021  // expensive. By default we only check again once a number of instructions
2022  // has been generated.
2023  static constexpr int kCheckConstIntervalInst = 32;
2024  static constexpr int kCheckConstInterval =
2025  kCheckConstIntervalInst * kInstrSize;
2026 
2027  int next_buffer_check_; // pc offset of next buffer check.
2028 
2029  // Emission of the trampoline pool may be blocked in some code sequences.
2030  int trampoline_pool_blocked_nesting_; // Block emission if this is not zero.
2031  int no_trampoline_pool_before_; // Block emission before this pc offset.
2032 
2033  // Keep track of the last emitted pool to guarantee a maximal distance.
2034  int last_trampoline_pool_end_; // pc offset of the end of the last pool.
2035 
2036  // Automatic growth of the assembly buffer may be blocked for some sequences.
2037  bool block_buffer_growth_; // Block growth when true.
2038 
2039  // Relocation information generation.
2040  // Each relocation is encoded as a variable size value.
2041  static constexpr int kMaxRelocSize = RelocInfoWriter::kMaxSize;
2042  RelocInfoWriter reloc_info_writer;
2043 
2044  // The bound position, before this we cannot do instruction elimination.
2045  int last_bound_pos_;
2046 
2047  // Readable constants for compact branch handling in emit()
2048  enum class CompactBranchType : bool { NO = false, COMPACT_BRANCH = true };
2049 
2050  // Code emission.
2051  inline void CheckBuffer();
2052  void GrowBuffer();
2053  inline void emit(Instr x,
2054  CompactBranchType is_compact_branch = CompactBranchType::NO);
2055  inline void emit(uint64_t x);
2056  inline void CheckForEmitInForbiddenSlot();
2057  template <typename T>
2058  inline void EmitHelper(T x);
2059  inline void EmitHelper(Instr x, CompactBranchType is_compact_branch);
2060 
2061  // Instruction generation.
2062  // We have 3 different kind of encoding layout on MIPS.
2063  // However due to many different types of objects encoded in the same fields
2064  // we have quite a few aliases for each mode.
2065  // Using the same structure to refer to Register and FPURegister would spare a
2066  // few aliases, but mixing both does not look clean to me.
2067  // Anyway we could surely implement this differently.
2068 
2069  void GenInstrRegister(Opcode opcode, Register rs, Register rt, Register rd,
2070  uint16_t sa = 0, SecondaryField func = nullptrSF);
2071 
2072  void GenInstrRegister(Opcode opcode,
2073  Register rs,
2074  Register rt,
2075  uint16_t msb,
2076  uint16_t lsb,
2077  SecondaryField func);
2078 
2079  void GenInstrRegister(Opcode opcode, SecondaryField fmt, FPURegister ft,
2080  FPURegister fs, FPURegister fd,
2081  SecondaryField func = nullptrSF);
2082 
2083  void GenInstrRegister(Opcode opcode, FPURegister fr, FPURegister ft,
2084  FPURegister fs, FPURegister fd,
2085  SecondaryField func = nullptrSF);
2086 
2087  void GenInstrRegister(Opcode opcode, SecondaryField fmt, Register rt,
2088  FPURegister fs, FPURegister fd,
2089  SecondaryField func = nullptrSF);
2090 
2091  void GenInstrRegister(Opcode opcode, SecondaryField fmt, Register rt,
2092  FPUControlRegister fs, SecondaryField func = nullptrSF);
2093 
2094  void GenInstrImmediate(
2095  Opcode opcode, Register rs, Register rt, int32_t j,
2096  CompactBranchType is_compact_branch = CompactBranchType::NO);
2097  void GenInstrImmediate(
2098  Opcode opcode, Register rs, SecondaryField SF, int32_t j,
2099  CompactBranchType is_compact_branch = CompactBranchType::NO);
2100  void GenInstrImmediate(
2101  Opcode opcode, Register r1, FPURegister r2, int32_t j,
2102  CompactBranchType is_compact_branch = CompactBranchType::NO);
2103  void GenInstrImmediate(Opcode opcode, Register base, Register rt,
2104  int32_t offset9, int bit6, SecondaryField func);
2105  void GenInstrImmediate(
2106  Opcode opcode, Register rs, int32_t offset21,
2107  CompactBranchType is_compact_branch = CompactBranchType::NO);
2108  void GenInstrImmediate(Opcode opcode, Register rs, uint32_t offset21);
2109  void GenInstrImmediate(
2110  Opcode opcode, int32_t offset26,
2111  CompactBranchType is_compact_branch = CompactBranchType::NO);
2112 
2113  void GenInstrJump(Opcode opcode,
2114  uint32_t address);
2115 
2116  // MSA
2117  void GenInstrMsaI8(SecondaryField operation, uint32_t imm8, MSARegister ws,
2118  MSARegister wd);
2119 
2120  void GenInstrMsaI5(SecondaryField operation, SecondaryField df, int32_t imm5,
2121  MSARegister ws, MSARegister wd);
2122 
2123  void GenInstrMsaBit(SecondaryField operation, SecondaryField df, uint32_t m,
2124  MSARegister ws, MSARegister wd);
2125 
2126  void GenInstrMsaI10(SecondaryField operation, SecondaryField df,
2127  int32_t imm10, MSARegister wd);
2128 
2129  template <typename RegType>
2130  void GenInstrMsa3R(SecondaryField operation, SecondaryField df, RegType t,
2131  MSARegister ws, MSARegister wd);
2132 
2133  template <typename DstType, typename SrcType>
2134  void GenInstrMsaElm(SecondaryField operation, SecondaryField df, uint32_t n,
2135  SrcType src, DstType dst);
2136 
2137  void GenInstrMsa3RF(SecondaryField operation, uint32_t df, MSARegister wt,
2138  MSARegister ws, MSARegister wd);
2139 
2140  void GenInstrMsaVec(SecondaryField operation, MSARegister wt, MSARegister ws,
2141  MSARegister wd);
2142 
2143  void GenInstrMsaMI10(SecondaryField operation, int32_t s10, Register rs,
2144  MSARegister wd);
2145 
2146  void GenInstrMsa2R(SecondaryField operation, SecondaryField df,
2147  MSARegister ws, MSARegister wd);
2148 
2149  void GenInstrMsa2RF(SecondaryField operation, SecondaryField df,
2150  MSARegister ws, MSARegister wd);
2151 
2152  void GenInstrMsaBranch(SecondaryField operation, MSARegister wt,
2153  int32_t offset16);
2154 
2155  inline bool is_valid_msa_df_m(SecondaryField bit_df, uint32_t m) {
2156  switch (bit_df) {
2157  case BIT_DF_b:
2158  return is_uint3(m);
2159  case BIT_DF_h:
2160  return is_uint4(m);
2161  case BIT_DF_w:
2162  return is_uint5(m);
2163  case BIT_DF_d:
2164  return is_uint6(m);
2165  default:
2166  return false;
2167  }
2168  }
2169 
2170  inline bool is_valid_msa_df_n(SecondaryField elm_df, uint32_t n) {
2171  switch (elm_df) {
2172  case ELM_DF_B:
2173  return is_uint4(n);
2174  case ELM_DF_H:
2175  return is_uint3(n);
2176  case ELM_DF_W:
2177  return is_uint2(n);
2178  case ELM_DF_D:
2179  return is_uint1(n);
2180  default:
2181  return false;
2182  }
2183  }
2184 
2185  // Labels.
2186  void print(const Label* L);
2187  void bind_to(Label* L, int pos);
2188  void next(Label* L, bool is_internal);
2189 
2190  // One trampoline consists of:
2191  // - space for trampoline slots,
2192  // - space for labels.
2193  //
2194  // Space for trampoline slots is equal to slot_count * 2 * kInstrSize.
2195  // Space for trampoline slots precedes space for labels. Each label is of one
2196  // instruction size, so total amount for labels is equal to
2197  // label_count * kInstrSize.
2198  class Trampoline {
2199  public:
2200  Trampoline() {
2201  start_ = 0;
2202  next_slot_ = 0;
2203  free_slot_count_ = 0;
2204  end_ = 0;
2205  }
2206  Trampoline(int start, int slot_count) {
2207  start_ = start;
2208  next_slot_ = start;
2209  free_slot_count_ = slot_count;
2210  end_ = start + slot_count * kTrampolineSlotsSize;
2211  }
2212  int start() {
2213  return start_;
2214  }
2215  int end() {
2216  return end_;
2217  }
2218  int take_slot() {
2219  int trampoline_slot = kInvalidSlotPos;
2220  if (free_slot_count_ <= 0) {
2221  // We have run out of space on trampolines.
2222  // Make sure we fail in debug mode, so we become aware of each case
2223  // when this happens.
2224  DCHECK(0);
2225  // Internal exception will be caught.
2226  } else {
2227  trampoline_slot = next_slot_;
2228  free_slot_count_--;
2229  next_slot_ += kTrampolineSlotsSize;
2230  }
2231  return trampoline_slot;
2232  }
2233 
2234  private:
2235  int start_;
2236  int end_;
2237  int next_slot_;
2238  int free_slot_count_;
2239  };
2240 
2241  int32_t get_trampoline_entry(int32_t pos);
2242  int unbound_labels_count_;
2243  // After trampoline is emitted, long branches are used in generated code for
2244  // the forward branches whose target offsets could be beyond reach of branch
2245  // instruction. We use this information to trigger different mode of
2246  // branch instruction generation, where we use jump instructions rather
2247  // than regular branch instructions.
2248  bool trampoline_emitted_;
2249  static constexpr int kInvalidSlotPos = -1;
2250 
2251  // Internal reference positions, required for unbounded internal reference
2252  // labels.
2253  std::set<int64_t> internal_reference_positions_;
2254  bool is_internal_reference(Label* L) {
2255  return internal_reference_positions_.find(L->pos()) !=
2256  internal_reference_positions_.end();
2257  }
2258 
2259  void EmittedCompactBranchInstruction() { prev_instr_compact_branch_ = true; }
2260  void ClearCompactBranchState() { prev_instr_compact_branch_ = false; }
2261  bool prev_instr_compact_branch_ = false;
2262 
2263  Trampoline trampoline_;
2264  bool internal_trampoline_exception_;
2265 
2266  RegList scratch_register_list_;
2267 
2268  private:
2269  void AllocateAndInstallRequestedHeapObjects(Isolate* isolate);
2270 
2271  friend class RegExpMacroAssemblerMIPS;
2272  friend class RelocInfo;
2273  friend class BlockTrampolinePoolScope;
2274  friend class EnsureSpace;
2275 };
2276 
2277 class EnsureSpace {
2278  public:
2279  explicit inline EnsureSpace(Assembler* assembler);
2280 };
2281 
2282 class UseScratchRegisterScope {
2283  public:
2284  explicit UseScratchRegisterScope(Assembler* assembler);
2285  ~UseScratchRegisterScope();
2286 
2287  Register Acquire();
2288  bool hasAvailable() const;
2289 
2290  private:
2291  RegList* available_;
2292  RegList old_available_;
2293 };
2294 
2295 // Define {RegisterName} methods for the register types.
2296 DEFINE_REGISTER_NAMES(Register, GENERAL_REGISTERS)
2297 DEFINE_REGISTER_NAMES(FPURegister, DOUBLE_REGISTERS)
2298 DEFINE_REGISTER_NAMES(MSARegister, SIMD128_REGISTERS)
2299 
2300 } // namespace internal
2301 } // namespace v8
2302 
2303 #endif // V8_MIPS64_ASSEMBLER_MIPS64_H_
Definition: libplatform.h:13