11cb0ef41Sopenharmony_ci// Copyright 2021 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_WASM_BASELINE_LOONG64_LIFTOFF_ASSEMBLER_LOONG64_H_
61cb0ef41Sopenharmony_ci#define V8_WASM_BASELINE_LOONG64_LIFTOFF_ASSEMBLER_LOONG64_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "src/base/platform/wrappers.h"
91cb0ef41Sopenharmony_ci#include "src/codegen/machine-type.h"
101cb0ef41Sopenharmony_ci#include "src/heap/memory-chunk.h"
111cb0ef41Sopenharmony_ci#include "src/wasm/baseline/liftoff-assembler.h"
121cb0ef41Sopenharmony_ci#include "src/wasm/wasm-objects.h"
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_cinamespace v8 {
151cb0ef41Sopenharmony_cinamespace internal {
161cb0ef41Sopenharmony_cinamespace wasm {
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_cinamespace liftoff {
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ciinline constexpr Condition ToCondition(LiftoffCondition liftoff_cond) {
211cb0ef41Sopenharmony_ci  switch (liftoff_cond) {
221cb0ef41Sopenharmony_ci    case kEqual:
231cb0ef41Sopenharmony_ci      return eq;
241cb0ef41Sopenharmony_ci    case kUnequal:
251cb0ef41Sopenharmony_ci      return ne;
261cb0ef41Sopenharmony_ci    case kSignedLessThan:
271cb0ef41Sopenharmony_ci      return lt;
281cb0ef41Sopenharmony_ci    case kSignedLessEqual:
291cb0ef41Sopenharmony_ci      return le;
301cb0ef41Sopenharmony_ci    case kSignedGreaterThan:
311cb0ef41Sopenharmony_ci      return gt;
321cb0ef41Sopenharmony_ci    case kSignedGreaterEqual:
331cb0ef41Sopenharmony_ci      return ge;
341cb0ef41Sopenharmony_ci    case kUnsignedLessThan:
351cb0ef41Sopenharmony_ci      return ult;
361cb0ef41Sopenharmony_ci    case kUnsignedLessEqual:
371cb0ef41Sopenharmony_ci      return ule;
381cb0ef41Sopenharmony_ci    case kUnsignedGreaterThan:
391cb0ef41Sopenharmony_ci      return ugt;
401cb0ef41Sopenharmony_ci    case kUnsignedGreaterEqual:
411cb0ef41Sopenharmony_ci      return uge;
421cb0ef41Sopenharmony_ci  }
431cb0ef41Sopenharmony_ci}
441cb0ef41Sopenharmony_ci
451cb0ef41Sopenharmony_ci// Liftoff Frames.
461cb0ef41Sopenharmony_ci//
471cb0ef41Sopenharmony_ci//  slot      Frame
481cb0ef41Sopenharmony_ci//       +--------------------+---------------------------
491cb0ef41Sopenharmony_ci//  n+4  | optional padding slot to keep the stack 16 byte aligned.
501cb0ef41Sopenharmony_ci//  n+3  |   parameter n      |
511cb0ef41Sopenharmony_ci//  ...  |       ...          |
521cb0ef41Sopenharmony_ci//   4   |   parameter 1      | or parameter 2
531cb0ef41Sopenharmony_ci//   3   |   parameter 0      | or parameter 1
541cb0ef41Sopenharmony_ci//   2   |  (result address)  | or parameter 0
551cb0ef41Sopenharmony_ci//  -----+--------------------+---------------------------
561cb0ef41Sopenharmony_ci//   1   | return addr (ra)   |
571cb0ef41Sopenharmony_ci//   0   | previous frame (fp)|
581cb0ef41Sopenharmony_ci//  -----+--------------------+  <-- frame ptr (fp)
591cb0ef41Sopenharmony_ci//  -1   | StackFrame::WASM   |
601cb0ef41Sopenharmony_ci//  -2   |     instance       |
611cb0ef41Sopenharmony_ci//  -3   |     feedback vector|
621cb0ef41Sopenharmony_ci//  -4   |     tiering budget |
631cb0ef41Sopenharmony_ci//  -----+--------------------+---------------------------
641cb0ef41Sopenharmony_ci//  -5   |     slot 0         |   ^
651cb0ef41Sopenharmony_ci//  -6   |     slot 1         |   |
661cb0ef41Sopenharmony_ci//       |                    | Frame slots
671cb0ef41Sopenharmony_ci//       |                    |   |
681cb0ef41Sopenharmony_ci//       |                    |   v
691cb0ef41Sopenharmony_ci//       | optional padding slot to keep the stack 16 byte aligned.
701cb0ef41Sopenharmony_ci//  -----+--------------------+  <-- stack ptr (sp)
711cb0ef41Sopenharmony_ci//
721cb0ef41Sopenharmony_ci
731cb0ef41Sopenharmony_ciconstexpr int kInstanceOffset = 2 * kSystemPointerSize;
741cb0ef41Sopenharmony_ciconstexpr int kFeedbackVectorOffset = 3 * kSystemPointerSize;
751cb0ef41Sopenharmony_ciconstexpr int kTierupBudgetOffset = 4 * kSystemPointerSize;
761cb0ef41Sopenharmony_ci
771cb0ef41Sopenharmony_ciinline MemOperand GetStackSlot(int offset) { return MemOperand(fp, -offset); }
781cb0ef41Sopenharmony_ci
791cb0ef41Sopenharmony_ciinline MemOperand GetInstanceOperand() { return GetStackSlot(kInstanceOffset); }
801cb0ef41Sopenharmony_ci
811cb0ef41Sopenharmony_citemplate <typename T>
821cb0ef41Sopenharmony_ciinline MemOperand GetMemOp(LiftoffAssembler* assm, Register addr,
831cb0ef41Sopenharmony_ci                           Register offset, T offset_imm) {
841cb0ef41Sopenharmony_ci  if (is_int32(offset_imm)) {
851cb0ef41Sopenharmony_ci    int32_t offset_imm32 = static_cast<int32_t>(offset_imm);
861cb0ef41Sopenharmony_ci    if (offset == no_reg) return MemOperand(addr, offset_imm32);
871cb0ef41Sopenharmony_ci    assm->add_d(kScratchReg, addr, offset);
881cb0ef41Sopenharmony_ci    return MemOperand(kScratchReg, offset_imm32);
891cb0ef41Sopenharmony_ci  }
901cb0ef41Sopenharmony_ci  // Offset immediate does not fit in 31 bits.
911cb0ef41Sopenharmony_ci  assm->li(kScratchReg, Operand(offset_imm));
921cb0ef41Sopenharmony_ci  assm->add_d(kScratchReg, kScratchReg, addr);
931cb0ef41Sopenharmony_ci  if (offset != no_reg) {
941cb0ef41Sopenharmony_ci    assm->add_d(kScratchReg, kScratchReg, offset);
951cb0ef41Sopenharmony_ci  }
961cb0ef41Sopenharmony_ci  return MemOperand(kScratchReg, 0);
971cb0ef41Sopenharmony_ci}
981cb0ef41Sopenharmony_ci
991cb0ef41Sopenharmony_ciinline void Load(LiftoffAssembler* assm, LiftoffRegister dst, MemOperand src,
1001cb0ef41Sopenharmony_ci                 ValueKind kind) {
1011cb0ef41Sopenharmony_ci  switch (kind) {
1021cb0ef41Sopenharmony_ci    case kI32:
1031cb0ef41Sopenharmony_ci      assm->Ld_w(dst.gp(), src);
1041cb0ef41Sopenharmony_ci      break;
1051cb0ef41Sopenharmony_ci    case kI64:
1061cb0ef41Sopenharmony_ci    case kRef:
1071cb0ef41Sopenharmony_ci    case kOptRef:
1081cb0ef41Sopenharmony_ci    case kRtt:
1091cb0ef41Sopenharmony_ci      assm->Ld_d(dst.gp(), src);
1101cb0ef41Sopenharmony_ci      break;
1111cb0ef41Sopenharmony_ci    case kF32:
1121cb0ef41Sopenharmony_ci      assm->Fld_s(dst.fp(), src);
1131cb0ef41Sopenharmony_ci      break;
1141cb0ef41Sopenharmony_ci    case kF64:
1151cb0ef41Sopenharmony_ci      assm->Fld_d(dst.fp(), src);
1161cb0ef41Sopenharmony_ci      break;
1171cb0ef41Sopenharmony_ci    case kS128:
1181cb0ef41Sopenharmony_ci      UNREACHABLE();
1191cb0ef41Sopenharmony_ci      break;
1201cb0ef41Sopenharmony_ci    default:
1211cb0ef41Sopenharmony_ci      UNREACHABLE();
1221cb0ef41Sopenharmony_ci  }
1231cb0ef41Sopenharmony_ci}
1241cb0ef41Sopenharmony_ci
1251cb0ef41Sopenharmony_ciinline void Store(LiftoffAssembler* assm, Register base, int32_t offset,
1261cb0ef41Sopenharmony_ci                  LiftoffRegister src, ValueKind kind) {
1271cb0ef41Sopenharmony_ci  MemOperand dst(base, offset);
1281cb0ef41Sopenharmony_ci  switch (kind) {
1291cb0ef41Sopenharmony_ci    case kI32:
1301cb0ef41Sopenharmony_ci      assm->St_w(src.gp(), dst);
1311cb0ef41Sopenharmony_ci      break;
1321cb0ef41Sopenharmony_ci    case kI64:
1331cb0ef41Sopenharmony_ci    case kOptRef:
1341cb0ef41Sopenharmony_ci    case kRef:
1351cb0ef41Sopenharmony_ci    case kRtt:
1361cb0ef41Sopenharmony_ci      assm->St_d(src.gp(), dst);
1371cb0ef41Sopenharmony_ci      break;
1381cb0ef41Sopenharmony_ci    case kF32:
1391cb0ef41Sopenharmony_ci      assm->Fst_s(src.fp(), dst);
1401cb0ef41Sopenharmony_ci      break;
1411cb0ef41Sopenharmony_ci    case kF64:
1421cb0ef41Sopenharmony_ci      assm->Fst_d(src.fp(), dst);
1431cb0ef41Sopenharmony_ci      break;
1441cb0ef41Sopenharmony_ci    default:
1451cb0ef41Sopenharmony_ci      UNREACHABLE();
1461cb0ef41Sopenharmony_ci  }
1471cb0ef41Sopenharmony_ci}
1481cb0ef41Sopenharmony_ci
1491cb0ef41Sopenharmony_ciinline void push(LiftoffAssembler* assm, LiftoffRegister reg, ValueKind kind) {
1501cb0ef41Sopenharmony_ci  switch (kind) {
1511cb0ef41Sopenharmony_ci    case kI32:
1521cb0ef41Sopenharmony_ci      assm->addi_d(sp, sp, -kSystemPointerSize);
1531cb0ef41Sopenharmony_ci      assm->St_w(reg.gp(), MemOperand(sp, 0));
1541cb0ef41Sopenharmony_ci      break;
1551cb0ef41Sopenharmony_ci    case kI64:
1561cb0ef41Sopenharmony_ci    case kOptRef:
1571cb0ef41Sopenharmony_ci    case kRef:
1581cb0ef41Sopenharmony_ci    case kRtt:
1591cb0ef41Sopenharmony_ci      assm->Push(reg.gp());
1601cb0ef41Sopenharmony_ci      break;
1611cb0ef41Sopenharmony_ci    case kF32:
1621cb0ef41Sopenharmony_ci      assm->addi_d(sp, sp, -kSystemPointerSize);
1631cb0ef41Sopenharmony_ci      assm->Fst_s(reg.fp(), MemOperand(sp, 0));
1641cb0ef41Sopenharmony_ci      break;
1651cb0ef41Sopenharmony_ci    case kF64:
1661cb0ef41Sopenharmony_ci      assm->addi_d(sp, sp, -kSystemPointerSize);
1671cb0ef41Sopenharmony_ci      assm->Fst_d(reg.fp(), MemOperand(sp, 0));
1681cb0ef41Sopenharmony_ci      break;
1691cb0ef41Sopenharmony_ci    case kS128:
1701cb0ef41Sopenharmony_ci      UNREACHABLE();
1711cb0ef41Sopenharmony_ci      break;
1721cb0ef41Sopenharmony_ci    default:
1731cb0ef41Sopenharmony_ci      UNREACHABLE();
1741cb0ef41Sopenharmony_ci  }
1751cb0ef41Sopenharmony_ci}
1761cb0ef41Sopenharmony_ci
1771cb0ef41Sopenharmony_ci}  // namespace liftoff
1781cb0ef41Sopenharmony_ci
1791cb0ef41Sopenharmony_ciint LiftoffAssembler::PrepareStackFrame() {
1801cb0ef41Sopenharmony_ci  int offset = pc_offset();
1811cb0ef41Sopenharmony_ci  // When constant that represents size of stack frame can't be represented
1821cb0ef41Sopenharmony_ci  // as 16bit we need three instructions to add it to sp, so we reserve space
1831cb0ef41Sopenharmony_ci  // for this case.
1841cb0ef41Sopenharmony_ci  addi_d(sp, sp, 0);
1851cb0ef41Sopenharmony_ci  nop();
1861cb0ef41Sopenharmony_ci  nop();
1871cb0ef41Sopenharmony_ci  return offset;
1881cb0ef41Sopenharmony_ci}
1891cb0ef41Sopenharmony_ci
1901cb0ef41Sopenharmony_civoid LiftoffAssembler::PrepareTailCall(int num_callee_stack_params,
1911cb0ef41Sopenharmony_ci                                       int stack_param_delta) {
1921cb0ef41Sopenharmony_ci  UseScratchRegisterScope temps(this);
1931cb0ef41Sopenharmony_ci  Register scratch = temps.Acquire();
1941cb0ef41Sopenharmony_ci
1951cb0ef41Sopenharmony_ci  // Push the return address and frame pointer to complete the stack frame.
1961cb0ef41Sopenharmony_ci  Ld_d(scratch, MemOperand(fp, 8));
1971cb0ef41Sopenharmony_ci  Push(scratch);
1981cb0ef41Sopenharmony_ci  Ld_d(scratch, MemOperand(fp, 0));
1991cb0ef41Sopenharmony_ci  Push(scratch);
2001cb0ef41Sopenharmony_ci
2011cb0ef41Sopenharmony_ci  // Shift the whole frame upwards.
2021cb0ef41Sopenharmony_ci  int slot_count = num_callee_stack_params + 2;
2031cb0ef41Sopenharmony_ci  for (int i = slot_count - 1; i >= 0; --i) {
2041cb0ef41Sopenharmony_ci    Ld_d(scratch, MemOperand(sp, i * 8));
2051cb0ef41Sopenharmony_ci    St_d(scratch, MemOperand(fp, (i - stack_param_delta) * 8));
2061cb0ef41Sopenharmony_ci  }
2071cb0ef41Sopenharmony_ci
2081cb0ef41Sopenharmony_ci  // Set the new stack and frame pointer.
2091cb0ef41Sopenharmony_ci  addi_d(sp, fp, -stack_param_delta * 8);
2101cb0ef41Sopenharmony_ci  Pop(ra, fp);
2111cb0ef41Sopenharmony_ci}
2121cb0ef41Sopenharmony_ci
2131cb0ef41Sopenharmony_civoid LiftoffAssembler::AlignFrameSize() {}
2141cb0ef41Sopenharmony_ci
2151cb0ef41Sopenharmony_civoid LiftoffAssembler::PatchPrepareStackFrame(
2161cb0ef41Sopenharmony_ci    int offset, SafepointTableBuilder* safepoint_table_builder) {
2171cb0ef41Sopenharmony_ci  // The frame_size includes the frame marker and the instance slot. Both are
2181cb0ef41Sopenharmony_ci  // pushed as part of frame construction, so we don't need to allocate memory
2191cb0ef41Sopenharmony_ci  // for them anymore.
2201cb0ef41Sopenharmony_ci  int frame_size = GetTotalFrameSize() - 2 * kSystemPointerSize;
2211cb0ef41Sopenharmony_ci
2221cb0ef41Sopenharmony_ci  // We can't run out of space, just pass anything big enough to not cause the
2231cb0ef41Sopenharmony_ci  // assembler to try to grow the buffer.
2241cb0ef41Sopenharmony_ci  constexpr int kAvailableSpace = 256;
2251cb0ef41Sopenharmony_ci  TurboAssembler patching_assembler(
2261cb0ef41Sopenharmony_ci      nullptr, AssemblerOptions{}, CodeObjectRequired::kNo,
2271cb0ef41Sopenharmony_ci      ExternalAssemblerBuffer(buffer_start_ + offset, kAvailableSpace));
2281cb0ef41Sopenharmony_ci
2291cb0ef41Sopenharmony_ci  if (V8_LIKELY(frame_size < 4 * KB)) {
2301cb0ef41Sopenharmony_ci    // This is the standard case for small frames: just subtract from SP and be
2311cb0ef41Sopenharmony_ci    // done with it.
2321cb0ef41Sopenharmony_ci    patching_assembler.Add_d(sp, sp, Operand(-frame_size));
2331cb0ef41Sopenharmony_ci    return;
2341cb0ef41Sopenharmony_ci  }
2351cb0ef41Sopenharmony_ci
2361cb0ef41Sopenharmony_ci  // The frame size is bigger than 4KB, so we might overflow the available stack
2371cb0ef41Sopenharmony_ci  // space if we first allocate the frame and then do the stack check (we will
2381cb0ef41Sopenharmony_ci  // need some remaining stack space for throwing the exception). That's why we
2391cb0ef41Sopenharmony_ci  // check the available stack space before we allocate the frame. To do this we
2401cb0ef41Sopenharmony_ci  // replace the {__ Add_d(sp, sp, -frame_size)} with a jump to OOL code that
2411cb0ef41Sopenharmony_ci  // does this "extended stack check".
2421cb0ef41Sopenharmony_ci  //
2431cb0ef41Sopenharmony_ci  // The OOL code can simply be generated here with the normal assembler,
2441cb0ef41Sopenharmony_ci  // because all other code generation, including OOL code, has already finished
2451cb0ef41Sopenharmony_ci  // when {PatchPrepareStackFrame} is called. The function prologue then jumps
2461cb0ef41Sopenharmony_ci  // to the current {pc_offset()} to execute the OOL code for allocating the
2471cb0ef41Sopenharmony_ci  // large frame.
2481cb0ef41Sopenharmony_ci  // Emit the unconditional branch in the function prologue (from {offset} to
2491cb0ef41Sopenharmony_ci  // {pc_offset()}).
2501cb0ef41Sopenharmony_ci
2511cb0ef41Sopenharmony_ci  int imm32 = pc_offset() - offset;
2521cb0ef41Sopenharmony_ci  CHECK(is_int26(imm32));
2531cb0ef41Sopenharmony_ci  patching_assembler.b(imm32 >> 2);
2541cb0ef41Sopenharmony_ci
2551cb0ef41Sopenharmony_ci  // If the frame is bigger than the stack, we throw the stack overflow
2561cb0ef41Sopenharmony_ci  // exception unconditionally. Thereby we can avoid the integer overflow
2571cb0ef41Sopenharmony_ci  // check in the condition code.
2581cb0ef41Sopenharmony_ci  RecordComment("OOL: stack check for large frame");
2591cb0ef41Sopenharmony_ci  Label continuation;
2601cb0ef41Sopenharmony_ci  if (frame_size < FLAG_stack_size * 1024) {
2611cb0ef41Sopenharmony_ci    Register stack_limit = kScratchReg;
2621cb0ef41Sopenharmony_ci    Ld_d(stack_limit,
2631cb0ef41Sopenharmony_ci         FieldMemOperand(kWasmInstanceRegister,
2641cb0ef41Sopenharmony_ci                         WasmInstanceObject::kRealStackLimitAddressOffset));
2651cb0ef41Sopenharmony_ci    Ld_d(stack_limit, MemOperand(stack_limit, 0));
2661cb0ef41Sopenharmony_ci    Add_d(stack_limit, stack_limit, Operand(frame_size));
2671cb0ef41Sopenharmony_ci    Branch(&continuation, uge, sp, Operand(stack_limit));
2681cb0ef41Sopenharmony_ci  }
2691cb0ef41Sopenharmony_ci
2701cb0ef41Sopenharmony_ci  Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL);
2711cb0ef41Sopenharmony_ci  // The call will not return; just define an empty safepoint.
2721cb0ef41Sopenharmony_ci  safepoint_table_builder->DefineSafepoint(this);
2731cb0ef41Sopenharmony_ci  if (FLAG_debug_code) stop();
2741cb0ef41Sopenharmony_ci
2751cb0ef41Sopenharmony_ci  bind(&continuation);
2761cb0ef41Sopenharmony_ci
2771cb0ef41Sopenharmony_ci  // Now allocate the stack space. Note that this might do more than just
2781cb0ef41Sopenharmony_ci  // decrementing the SP;
2791cb0ef41Sopenharmony_ci  Add_d(sp, sp, Operand(-frame_size));
2801cb0ef41Sopenharmony_ci
2811cb0ef41Sopenharmony_ci  // Jump back to the start of the function, from {pc_offset()} to
2821cb0ef41Sopenharmony_ci  // right after the reserved space for the {__ Add_d(sp, sp, -framesize)}
2831cb0ef41Sopenharmony_ci  // (which is a Branch now).
2841cb0ef41Sopenharmony_ci  int func_start_offset = offset + 3 * kInstrSize;
2851cb0ef41Sopenharmony_ci  imm32 = func_start_offset - pc_offset();
2861cb0ef41Sopenharmony_ci  CHECK(is_int26(imm32));
2871cb0ef41Sopenharmony_ci  b(imm32 >> 2);
2881cb0ef41Sopenharmony_ci}
2891cb0ef41Sopenharmony_ci
2901cb0ef41Sopenharmony_civoid LiftoffAssembler::FinishCode() {}
2911cb0ef41Sopenharmony_ci
2921cb0ef41Sopenharmony_civoid LiftoffAssembler::AbortCompilation() {}
2931cb0ef41Sopenharmony_ci
2941cb0ef41Sopenharmony_ci// static
2951cb0ef41Sopenharmony_ciconstexpr int LiftoffAssembler::StaticStackFrameSize() {
2961cb0ef41Sopenharmony_ci  return liftoff::kTierupBudgetOffset;
2971cb0ef41Sopenharmony_ci}
2981cb0ef41Sopenharmony_ci
2991cb0ef41Sopenharmony_ciint LiftoffAssembler::SlotSizeForType(ValueKind kind) {
3001cb0ef41Sopenharmony_ci  switch (kind) {
3011cb0ef41Sopenharmony_ci    case kS128:
3021cb0ef41Sopenharmony_ci      return value_kind_size(kind);
3031cb0ef41Sopenharmony_ci    default:
3041cb0ef41Sopenharmony_ci      return kStackSlotSize;
3051cb0ef41Sopenharmony_ci  }
3061cb0ef41Sopenharmony_ci}
3071cb0ef41Sopenharmony_ci
3081cb0ef41Sopenharmony_cibool LiftoffAssembler::NeedsAlignment(ValueKind kind) {
3091cb0ef41Sopenharmony_ci  return kind == kS128 || is_reference(kind);
3101cb0ef41Sopenharmony_ci}
3111cb0ef41Sopenharmony_ci
3121cb0ef41Sopenharmony_civoid LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value,
3131cb0ef41Sopenharmony_ci                                    RelocInfo::Mode rmode) {
3141cb0ef41Sopenharmony_ci  switch (value.type().kind()) {
3151cb0ef41Sopenharmony_ci    case kI32:
3161cb0ef41Sopenharmony_ci      TurboAssembler::li(reg.gp(), Operand(value.to_i32(), rmode));
3171cb0ef41Sopenharmony_ci      break;
3181cb0ef41Sopenharmony_ci    case kI64:
3191cb0ef41Sopenharmony_ci      TurboAssembler::li(reg.gp(), Operand(value.to_i64(), rmode));
3201cb0ef41Sopenharmony_ci      break;
3211cb0ef41Sopenharmony_ci    case kF32:
3221cb0ef41Sopenharmony_ci      TurboAssembler::Move(reg.fp(), value.to_f32_boxed().get_bits());
3231cb0ef41Sopenharmony_ci      break;
3241cb0ef41Sopenharmony_ci    case kF64:
3251cb0ef41Sopenharmony_ci      TurboAssembler::Move(reg.fp(), value.to_f64_boxed().get_bits());
3261cb0ef41Sopenharmony_ci      break;
3271cb0ef41Sopenharmony_ci    default:
3281cb0ef41Sopenharmony_ci      UNREACHABLE();
3291cb0ef41Sopenharmony_ci  }
3301cb0ef41Sopenharmony_ci}
3311cb0ef41Sopenharmony_ci
3321cb0ef41Sopenharmony_civoid LiftoffAssembler::LoadInstanceFromFrame(Register dst) {
3331cb0ef41Sopenharmony_ci  Ld_d(dst, liftoff::GetInstanceOperand());
3341cb0ef41Sopenharmony_ci}
3351cb0ef41Sopenharmony_ci
3361cb0ef41Sopenharmony_civoid LiftoffAssembler::LoadFromInstance(Register dst, Register instance,
3371cb0ef41Sopenharmony_ci                                        int offset, int size) {
3381cb0ef41Sopenharmony_ci  DCHECK_LE(0, offset);
3391cb0ef41Sopenharmony_ci  switch (size) {
3401cb0ef41Sopenharmony_ci    case 1:
3411cb0ef41Sopenharmony_ci      Ld_b(dst, MemOperand(instance, offset));
3421cb0ef41Sopenharmony_ci      break;
3431cb0ef41Sopenharmony_ci    case 4:
3441cb0ef41Sopenharmony_ci      Ld_w(dst, MemOperand(instance, offset));
3451cb0ef41Sopenharmony_ci      break;
3461cb0ef41Sopenharmony_ci    case 8:
3471cb0ef41Sopenharmony_ci      Ld_d(dst, MemOperand(instance, offset));
3481cb0ef41Sopenharmony_ci      break;
3491cb0ef41Sopenharmony_ci    default:
3501cb0ef41Sopenharmony_ci      UNIMPLEMENTED();
3511cb0ef41Sopenharmony_ci  }
3521cb0ef41Sopenharmony_ci}
3531cb0ef41Sopenharmony_ci
3541cb0ef41Sopenharmony_civoid LiftoffAssembler::LoadTaggedPointerFromInstance(Register dst,
3551cb0ef41Sopenharmony_ci                                                     Register instance,
3561cb0ef41Sopenharmony_ci                                                     int32_t offset) {
3571cb0ef41Sopenharmony_ci  STATIC_ASSERT(kTaggedSize == kSystemPointerSize);
3581cb0ef41Sopenharmony_ci  Ld_d(dst, MemOperand(instance, offset));
3591cb0ef41Sopenharmony_ci}
3601cb0ef41Sopenharmony_ci
3611cb0ef41Sopenharmony_civoid LiftoffAssembler::SpillInstance(Register instance) {
3621cb0ef41Sopenharmony_ci  St_d(instance, liftoff::GetInstanceOperand());
3631cb0ef41Sopenharmony_ci}
3641cb0ef41Sopenharmony_ci
3651cb0ef41Sopenharmony_civoid LiftoffAssembler::ResetOSRTarget() {}
3661cb0ef41Sopenharmony_ci
3671cb0ef41Sopenharmony_civoid LiftoffAssembler::LoadTaggedPointer(Register dst, Register src_addr,
3681cb0ef41Sopenharmony_ci                                         Register offset_reg,
3691cb0ef41Sopenharmony_ci                                         int32_t offset_imm,
3701cb0ef41Sopenharmony_ci                                         LiftoffRegList pinned) {
3711cb0ef41Sopenharmony_ci  STATIC_ASSERT(kTaggedSize == kInt64Size);
3721cb0ef41Sopenharmony_ci  MemOperand src_op = liftoff::GetMemOp(this, src_addr, offset_reg, offset_imm);
3731cb0ef41Sopenharmony_ci  Ld_d(dst, src_op);
3741cb0ef41Sopenharmony_ci}
3751cb0ef41Sopenharmony_ci
3761cb0ef41Sopenharmony_civoid LiftoffAssembler::LoadFullPointer(Register dst, Register src_addr,
3771cb0ef41Sopenharmony_ci                                       int32_t offset_imm) {
3781cb0ef41Sopenharmony_ci  MemOperand src_op = liftoff::GetMemOp(this, src_addr, no_reg, offset_imm);
3791cb0ef41Sopenharmony_ci  Ld_d(dst, src_op);
3801cb0ef41Sopenharmony_ci}
3811cb0ef41Sopenharmony_ci
3821cb0ef41Sopenharmony_civoid LiftoffAssembler::StoreTaggedPointer(Register dst_addr,
3831cb0ef41Sopenharmony_ci                                          Register offset_reg,
3841cb0ef41Sopenharmony_ci                                          int32_t offset_imm,
3851cb0ef41Sopenharmony_ci                                          LiftoffRegister src,
3861cb0ef41Sopenharmony_ci                                          LiftoffRegList pinned,
3871cb0ef41Sopenharmony_ci                                          SkipWriteBarrier skip_write_barrier) {
3881cb0ef41Sopenharmony_ci  UseScratchRegisterScope temps(this);
3891cb0ef41Sopenharmony_ci  Operand offset_op =
3901cb0ef41Sopenharmony_ci      offset_reg.is_valid() ? Operand(offset_reg) : Operand(offset_imm);
3911cb0ef41Sopenharmony_ci  // For the write barrier (below), we cannot have both an offset register and
3921cb0ef41Sopenharmony_ci  // an immediate offset. Add them to a 32-bit offset initially, but in a 64-bit
3931cb0ef41Sopenharmony_ci  // register, because that's needed in the MemOperand below.
3941cb0ef41Sopenharmony_ci  if (offset_reg.is_valid() && offset_imm) {
3951cb0ef41Sopenharmony_ci    Register effective_offset = temps.Acquire();
3961cb0ef41Sopenharmony_ci    Add_d(effective_offset, offset_reg, Operand(offset_imm));
3971cb0ef41Sopenharmony_ci    offset_op = Operand(effective_offset);
3981cb0ef41Sopenharmony_ci  }
3991cb0ef41Sopenharmony_ci  if (offset_op.is_reg()) {
4001cb0ef41Sopenharmony_ci    St_d(src.gp(), MemOperand(dst_addr, offset_op.rm()));
4011cb0ef41Sopenharmony_ci  } else {
4021cb0ef41Sopenharmony_ci    St_d(src.gp(), MemOperand(dst_addr, offset_imm));
4031cb0ef41Sopenharmony_ci  }
4041cb0ef41Sopenharmony_ci
4051cb0ef41Sopenharmony_ci  if (skip_write_barrier || FLAG_disable_write_barriers) return;
4061cb0ef41Sopenharmony_ci
4071cb0ef41Sopenharmony_ci  Label write_barrier;
4081cb0ef41Sopenharmony_ci  Label exit;
4091cb0ef41Sopenharmony_ci  CheckPageFlag(dst_addr, MemoryChunk::kPointersFromHereAreInterestingMask, ne,
4101cb0ef41Sopenharmony_ci                &write_barrier);
4111cb0ef41Sopenharmony_ci  b(&exit);
4121cb0ef41Sopenharmony_ci  bind(&write_barrier);
4131cb0ef41Sopenharmony_ci  JumpIfSmi(src.gp(), &exit);
4141cb0ef41Sopenharmony_ci  CheckPageFlag(src.gp(), MemoryChunk::kPointersToHereAreInterestingMask, eq,
4151cb0ef41Sopenharmony_ci                &exit);
4161cb0ef41Sopenharmony_ci  CallRecordWriteStubSaveRegisters(
4171cb0ef41Sopenharmony_ci      dst_addr, offset_op, RememberedSetAction::kEmit, SaveFPRegsMode::kSave,
4181cb0ef41Sopenharmony_ci      StubCallMode::kCallWasmRuntimeStub);
4191cb0ef41Sopenharmony_ci  bind(&exit);
4201cb0ef41Sopenharmony_ci}
4211cb0ef41Sopenharmony_ci
4221cb0ef41Sopenharmony_civoid LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr,
4231cb0ef41Sopenharmony_ci                            Register offset_reg, uintptr_t offset_imm,
4241cb0ef41Sopenharmony_ci                            LoadType type, LiftoffRegList pinned,
4251cb0ef41Sopenharmony_ci                            uint32_t* protected_load_pc, bool is_load_mem,
4261cb0ef41Sopenharmony_ci                            bool i64_offset) {
4271cb0ef41Sopenharmony_ci  MemOperand src_op = liftoff::GetMemOp(this, src_addr, offset_reg, offset_imm);
4281cb0ef41Sopenharmony_ci
4291cb0ef41Sopenharmony_ci  if (protected_load_pc) *protected_load_pc = pc_offset();
4301cb0ef41Sopenharmony_ci  switch (type.value()) {
4311cb0ef41Sopenharmony_ci    case LoadType::kI32Load8U:
4321cb0ef41Sopenharmony_ci    case LoadType::kI64Load8U:
4331cb0ef41Sopenharmony_ci      Ld_bu(dst.gp(), src_op);
4341cb0ef41Sopenharmony_ci      break;
4351cb0ef41Sopenharmony_ci    case LoadType::kI32Load8S:
4361cb0ef41Sopenharmony_ci    case LoadType::kI64Load8S:
4371cb0ef41Sopenharmony_ci      Ld_b(dst.gp(), src_op);
4381cb0ef41Sopenharmony_ci      break;
4391cb0ef41Sopenharmony_ci    case LoadType::kI32Load16U:
4401cb0ef41Sopenharmony_ci    case LoadType::kI64Load16U:
4411cb0ef41Sopenharmony_ci      TurboAssembler::Ld_hu(dst.gp(), src_op);
4421cb0ef41Sopenharmony_ci      break;
4431cb0ef41Sopenharmony_ci    case LoadType::kI32Load16S:
4441cb0ef41Sopenharmony_ci    case LoadType::kI64Load16S:
4451cb0ef41Sopenharmony_ci      TurboAssembler::Ld_h(dst.gp(), src_op);
4461cb0ef41Sopenharmony_ci      break;
4471cb0ef41Sopenharmony_ci    case LoadType::kI64Load32U:
4481cb0ef41Sopenharmony_ci      TurboAssembler::Ld_wu(dst.gp(), src_op);
4491cb0ef41Sopenharmony_ci      break;
4501cb0ef41Sopenharmony_ci    case LoadType::kI32Load:
4511cb0ef41Sopenharmony_ci    case LoadType::kI64Load32S:
4521cb0ef41Sopenharmony_ci      TurboAssembler::Ld_w(dst.gp(), src_op);
4531cb0ef41Sopenharmony_ci      break;
4541cb0ef41Sopenharmony_ci    case LoadType::kI64Load:
4551cb0ef41Sopenharmony_ci      TurboAssembler::Ld_d(dst.gp(), src_op);
4561cb0ef41Sopenharmony_ci      break;
4571cb0ef41Sopenharmony_ci    case LoadType::kF32Load:
4581cb0ef41Sopenharmony_ci      TurboAssembler::Fld_s(dst.fp(), src_op);
4591cb0ef41Sopenharmony_ci      break;
4601cb0ef41Sopenharmony_ci    case LoadType::kF64Load:
4611cb0ef41Sopenharmony_ci      TurboAssembler::Fld_d(dst.fp(), src_op);
4621cb0ef41Sopenharmony_ci      break;
4631cb0ef41Sopenharmony_ci    case LoadType::kS128Load:
4641cb0ef41Sopenharmony_ci      UNREACHABLE();
4651cb0ef41Sopenharmony_ci      break;
4661cb0ef41Sopenharmony_ci    default:
4671cb0ef41Sopenharmony_ci      UNREACHABLE();
4681cb0ef41Sopenharmony_ci  }
4691cb0ef41Sopenharmony_ci}
4701cb0ef41Sopenharmony_ci
4711cb0ef41Sopenharmony_civoid LiftoffAssembler::Store(Register dst_addr, Register offset_reg,
4721cb0ef41Sopenharmony_ci                             uintptr_t offset_imm, LiftoffRegister src,
4731cb0ef41Sopenharmony_ci                             StoreType type, LiftoffRegList pinned,
4741cb0ef41Sopenharmony_ci                             uint32_t* protected_store_pc, bool is_store_mem) {
4751cb0ef41Sopenharmony_ci  MemOperand dst_op = liftoff::GetMemOp(this, dst_addr, offset_reg, offset_imm);
4761cb0ef41Sopenharmony_ci
4771cb0ef41Sopenharmony_ci  if (protected_store_pc) *protected_store_pc = pc_offset();
4781cb0ef41Sopenharmony_ci  switch (type.value()) {
4791cb0ef41Sopenharmony_ci    case StoreType::kI32Store8:
4801cb0ef41Sopenharmony_ci    case StoreType::kI64Store8:
4811cb0ef41Sopenharmony_ci      St_b(src.gp(), dst_op);
4821cb0ef41Sopenharmony_ci      break;
4831cb0ef41Sopenharmony_ci    case StoreType::kI32Store16:
4841cb0ef41Sopenharmony_ci    case StoreType::kI64Store16:
4851cb0ef41Sopenharmony_ci      TurboAssembler::St_h(src.gp(), dst_op);
4861cb0ef41Sopenharmony_ci      break;
4871cb0ef41Sopenharmony_ci    case StoreType::kI32Store:
4881cb0ef41Sopenharmony_ci    case StoreType::kI64Store32:
4891cb0ef41Sopenharmony_ci      TurboAssembler::St_w(src.gp(), dst_op);
4901cb0ef41Sopenharmony_ci      break;
4911cb0ef41Sopenharmony_ci    case StoreType::kI64Store:
4921cb0ef41Sopenharmony_ci      TurboAssembler::St_d(src.gp(), dst_op);
4931cb0ef41Sopenharmony_ci      break;
4941cb0ef41Sopenharmony_ci    case StoreType::kF32Store:
4951cb0ef41Sopenharmony_ci      TurboAssembler::Fst_s(src.fp(), dst_op);
4961cb0ef41Sopenharmony_ci      break;
4971cb0ef41Sopenharmony_ci    case StoreType::kF64Store:
4981cb0ef41Sopenharmony_ci      TurboAssembler::Fst_d(src.fp(), dst_op);
4991cb0ef41Sopenharmony_ci      break;
5001cb0ef41Sopenharmony_ci    case StoreType::kS128Store:
5011cb0ef41Sopenharmony_ci      UNREACHABLE();
5021cb0ef41Sopenharmony_ci      break;
5031cb0ef41Sopenharmony_ci    default:
5041cb0ef41Sopenharmony_ci      UNREACHABLE();
5051cb0ef41Sopenharmony_ci  }
5061cb0ef41Sopenharmony_ci}
5071cb0ef41Sopenharmony_ci
5081cb0ef41Sopenharmony_civoid LiftoffAssembler::AtomicLoad(LiftoffRegister dst, Register src_addr,
5091cb0ef41Sopenharmony_ci                                  Register offset_reg, uintptr_t offset_imm,
5101cb0ef41Sopenharmony_ci                                  LoadType type, LiftoffRegList pinned) {
5111cb0ef41Sopenharmony_ci  UseScratchRegisterScope temps(this);
5121cb0ef41Sopenharmony_ci  MemOperand src_op = liftoff::GetMemOp(this, src_addr, offset_reg, offset_imm);
5131cb0ef41Sopenharmony_ci  switch (type.value()) {
5141cb0ef41Sopenharmony_ci    case LoadType::kI32Load8U:
5151cb0ef41Sopenharmony_ci    case LoadType::kI64Load8U: {
5161cb0ef41Sopenharmony_ci      Ld_bu(dst.gp(), src_op);
5171cb0ef41Sopenharmony_ci      dbar(0);
5181cb0ef41Sopenharmony_ci      return;
5191cb0ef41Sopenharmony_ci    }
5201cb0ef41Sopenharmony_ci    case LoadType::kI32Load16U:
5211cb0ef41Sopenharmony_ci    case LoadType::kI64Load16U: {
5221cb0ef41Sopenharmony_ci      Ld_hu(dst.gp(), src_op);
5231cb0ef41Sopenharmony_ci      dbar(0);
5241cb0ef41Sopenharmony_ci      return;
5251cb0ef41Sopenharmony_ci    }
5261cb0ef41Sopenharmony_ci    case LoadType::kI32Load: {
5271cb0ef41Sopenharmony_ci      Ld_w(dst.gp(), src_op);
5281cb0ef41Sopenharmony_ci      dbar(0);
5291cb0ef41Sopenharmony_ci      return;
5301cb0ef41Sopenharmony_ci    }
5311cb0ef41Sopenharmony_ci    case LoadType::kI64Load32U: {
5321cb0ef41Sopenharmony_ci      Ld_wu(dst.gp(), src_op);
5331cb0ef41Sopenharmony_ci      dbar(0);
5341cb0ef41Sopenharmony_ci      return;
5351cb0ef41Sopenharmony_ci    }
5361cb0ef41Sopenharmony_ci    case LoadType::kI64Load: {
5371cb0ef41Sopenharmony_ci      Ld_d(dst.gp(), src_op);
5381cb0ef41Sopenharmony_ci      dbar(0);
5391cb0ef41Sopenharmony_ci      return;
5401cb0ef41Sopenharmony_ci    }
5411cb0ef41Sopenharmony_ci    default:
5421cb0ef41Sopenharmony_ci      UNREACHABLE();
5431cb0ef41Sopenharmony_ci  }
5441cb0ef41Sopenharmony_ci}
5451cb0ef41Sopenharmony_ci
5461cb0ef41Sopenharmony_civoid LiftoffAssembler::AtomicStore(Register dst_addr, Register offset_reg,
5471cb0ef41Sopenharmony_ci                                   uintptr_t offset_imm, LiftoffRegister src,
5481cb0ef41Sopenharmony_ci                                   StoreType type, LiftoffRegList pinned) {
5491cb0ef41Sopenharmony_ci  UseScratchRegisterScope temps(this);
5501cb0ef41Sopenharmony_ci  MemOperand dst_op = liftoff::GetMemOp(this, dst_addr, offset_reg, offset_imm);
5511cb0ef41Sopenharmony_ci  switch (type.value()) {
5521cb0ef41Sopenharmony_ci    case StoreType::kI64Store8:
5531cb0ef41Sopenharmony_ci    case StoreType::kI32Store8: {
5541cb0ef41Sopenharmony_ci      dbar(0);
5551cb0ef41Sopenharmony_ci      St_b(src.gp(), dst_op);
5561cb0ef41Sopenharmony_ci      return;
5571cb0ef41Sopenharmony_ci    }
5581cb0ef41Sopenharmony_ci    case StoreType::kI64Store16:
5591cb0ef41Sopenharmony_ci    case StoreType::kI32Store16: {
5601cb0ef41Sopenharmony_ci      dbar(0);
5611cb0ef41Sopenharmony_ci      St_h(src.gp(), dst_op);
5621cb0ef41Sopenharmony_ci      return;
5631cb0ef41Sopenharmony_ci    }
5641cb0ef41Sopenharmony_ci    case StoreType::kI64Store32:
5651cb0ef41Sopenharmony_ci    case StoreType::kI32Store: {
5661cb0ef41Sopenharmony_ci      dbar(0);
5671cb0ef41Sopenharmony_ci      St_w(src.gp(), dst_op);
5681cb0ef41Sopenharmony_ci      return;
5691cb0ef41Sopenharmony_ci    }
5701cb0ef41Sopenharmony_ci    case StoreType::kI64Store: {
5711cb0ef41Sopenharmony_ci      dbar(0);
5721cb0ef41Sopenharmony_ci      St_d(src.gp(), dst_op);
5731cb0ef41Sopenharmony_ci      return;
5741cb0ef41Sopenharmony_ci    }
5751cb0ef41Sopenharmony_ci    default:
5761cb0ef41Sopenharmony_ci      UNREACHABLE();
5771cb0ef41Sopenharmony_ci  }
5781cb0ef41Sopenharmony_ci}
5791cb0ef41Sopenharmony_ci
5801cb0ef41Sopenharmony_ci#define ASSEMBLE_ATOMIC_BINOP_EXT(load_linked, store_conditional, size, \
5811cb0ef41Sopenharmony_ci                                  bin_instr, aligned)                   \
5821cb0ef41Sopenharmony_ci  do {                                                                  \
5831cb0ef41Sopenharmony_ci    Label binop;                                                        \
5841cb0ef41Sopenharmony_ci    andi(temp3, temp0, aligned);                                        \
5851cb0ef41Sopenharmony_ci    Sub_d(temp0, temp0, Operand(temp3));                                \
5861cb0ef41Sopenharmony_ci    slli_w(temp3, temp3, 3);                                            \
5871cb0ef41Sopenharmony_ci    dbar(0);                                                            \
5881cb0ef41Sopenharmony_ci    bind(&binop);                                                       \
5891cb0ef41Sopenharmony_ci    load_linked(temp1, MemOperand(temp0, 0));                           \
5901cb0ef41Sopenharmony_ci    ExtractBits(result.gp(), temp1, temp3, size, false);                \
5911cb0ef41Sopenharmony_ci    bin_instr(temp2, result.gp(), Operand(value.gp()));                 \
5921cb0ef41Sopenharmony_ci    InsertBits(temp1, temp2, temp3, size);                              \
5931cb0ef41Sopenharmony_ci    store_conditional(temp1, MemOperand(temp0, 0));                     \
5941cb0ef41Sopenharmony_ci    BranchShort(&binop, eq, temp1, Operand(zero_reg));                  \
5951cb0ef41Sopenharmony_ci    dbar(0);                                                            \
5961cb0ef41Sopenharmony_ci  } while (0)
5971cb0ef41Sopenharmony_ci
5981cb0ef41Sopenharmony_ci#define ATOMIC_BINOP_CASE(name, inst32, inst64, opcode)                  \
5991cb0ef41Sopenharmony_ci  void LiftoffAssembler::Atomic##name(                                   \
6001cb0ef41Sopenharmony_ci      Register dst_addr, Register offset_reg, uintptr_t offset_imm,      \
6011cb0ef41Sopenharmony_ci      LiftoffRegister value, LiftoffRegister result, StoreType type) {   \
6021cb0ef41Sopenharmony_ci    LiftoffRegList pinned = {dst_addr, offset_reg, value, result};       \
6031cb0ef41Sopenharmony_ci    Register temp0 = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp(); \
6041cb0ef41Sopenharmony_ci    Register temp1 = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp(); \
6051cb0ef41Sopenharmony_ci    Register temp2 = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp(); \
6061cb0ef41Sopenharmony_ci    Register temp3 = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp(); \
6071cb0ef41Sopenharmony_ci    MemOperand dst_op =                                                  \
6081cb0ef41Sopenharmony_ci        liftoff::GetMemOp(this, dst_addr, offset_reg, offset_imm);       \
6091cb0ef41Sopenharmony_ci    Add_d(temp0, dst_op.base(), dst_op.offset());                        \
6101cb0ef41Sopenharmony_ci    switch (type.value()) {                                              \
6111cb0ef41Sopenharmony_ci      case StoreType::kI64Store8:                                        \
6121cb0ef41Sopenharmony_ci        ASSEMBLE_ATOMIC_BINOP_EXT(Ll_d, Sc_d, 8, inst64, 7);             \
6131cb0ef41Sopenharmony_ci        break;                                                           \
6141cb0ef41Sopenharmony_ci      case StoreType::kI32Store8:                                        \
6151cb0ef41Sopenharmony_ci        ASSEMBLE_ATOMIC_BINOP_EXT(Ll_w, Sc_w, 8, inst32, 3);             \
6161cb0ef41Sopenharmony_ci        break;                                                           \
6171cb0ef41Sopenharmony_ci      case StoreType::kI64Store16:                                       \
6181cb0ef41Sopenharmony_ci        ASSEMBLE_ATOMIC_BINOP_EXT(Ll_d, Sc_d, 16, inst64, 7);            \
6191cb0ef41Sopenharmony_ci        break;                                                           \
6201cb0ef41Sopenharmony_ci      case StoreType::kI32Store16:                                       \
6211cb0ef41Sopenharmony_ci        ASSEMBLE_ATOMIC_BINOP_EXT(Ll_w, Sc_w, 16, inst32, 3);            \
6221cb0ef41Sopenharmony_ci        break;                                                           \
6231cb0ef41Sopenharmony_ci      case StoreType::kI64Store32:                                       \
6241cb0ef41Sopenharmony_ci        ASSEMBLE_ATOMIC_BINOP_EXT(Ll_d, Sc_d, 32, inst64, 7);            \
6251cb0ef41Sopenharmony_ci        break;                                                           \
6261cb0ef41Sopenharmony_ci      case StoreType::kI32Store:                                         \
6271cb0ef41Sopenharmony_ci        am##opcode##_db_w(result.gp(), value.gp(), temp0);               \
6281cb0ef41Sopenharmony_ci        break;                                                           \
6291cb0ef41Sopenharmony_ci      case StoreType::kI64Store:                                         \
6301cb0ef41Sopenharmony_ci        am##opcode##_db_d(result.gp(), value.gp(), temp0);               \
6311cb0ef41Sopenharmony_ci        break;                                                           \
6321cb0ef41Sopenharmony_ci      default:                                                           \
6331cb0ef41Sopenharmony_ci        UNREACHABLE();                                                   \
6341cb0ef41Sopenharmony_ci    }                                                                    \
6351cb0ef41Sopenharmony_ci  }
6361cb0ef41Sopenharmony_ci
6371cb0ef41Sopenharmony_ciATOMIC_BINOP_CASE(Add, Add_w, Add_d, add)
6381cb0ef41Sopenharmony_ciATOMIC_BINOP_CASE(And, And, And, and)
6391cb0ef41Sopenharmony_ciATOMIC_BINOP_CASE(Or, Or, Or, or)
6401cb0ef41Sopenharmony_ciATOMIC_BINOP_CASE(Xor, Xor, Xor, xor)
6411cb0ef41Sopenharmony_ci
6421cb0ef41Sopenharmony_ci#define ASSEMBLE_ATOMIC_BINOP(load_linked, store_conditional, bin_instr) \
6431cb0ef41Sopenharmony_ci  do {                                                                   \
6441cb0ef41Sopenharmony_ci    Label binop;                                                         \
6451cb0ef41Sopenharmony_ci    dbar(0);                                                             \
6461cb0ef41Sopenharmony_ci    bind(&binop);                                                        \
6471cb0ef41Sopenharmony_ci    load_linked(result.gp(), MemOperand(temp0, 0));                      \
6481cb0ef41Sopenharmony_ci    bin_instr(temp1, result.gp(), Operand(value.gp()));                  \
6491cb0ef41Sopenharmony_ci    store_conditional(temp1, MemOperand(temp0, 0));                      \
6501cb0ef41Sopenharmony_ci    BranchShort(&binop, eq, temp1, Operand(zero_reg));                   \
6511cb0ef41Sopenharmony_ci    dbar(0);                                                             \
6521cb0ef41Sopenharmony_ci  } while (0)
6531cb0ef41Sopenharmony_ci
6541cb0ef41Sopenharmony_civoid LiftoffAssembler::AtomicSub(Register dst_addr, Register offset_reg,
6551cb0ef41Sopenharmony_ci                                 uintptr_t offset_imm, LiftoffRegister value,
6561cb0ef41Sopenharmony_ci                                 LiftoffRegister result, StoreType type) {
6571cb0ef41Sopenharmony_ci  LiftoffRegList pinned = {dst_addr, offset_reg, value, result};
6581cb0ef41Sopenharmony_ci  Register temp0 = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp();
6591cb0ef41Sopenharmony_ci  Register temp1 = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp();
6601cb0ef41Sopenharmony_ci  Register temp2 = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp();
6611cb0ef41Sopenharmony_ci  Register temp3 = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp();
6621cb0ef41Sopenharmony_ci  MemOperand dst_op = liftoff::GetMemOp(this, dst_addr, offset_reg, offset_imm);
6631cb0ef41Sopenharmony_ci  Add_d(temp0, dst_op.base(), dst_op.offset());
6641cb0ef41Sopenharmony_ci  switch (type.value()) {
6651cb0ef41Sopenharmony_ci    case StoreType::kI64Store8:
6661cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_BINOP_EXT(Ll_d, Sc_d, 8, Sub_d, 7);
6671cb0ef41Sopenharmony_ci      break;
6681cb0ef41Sopenharmony_ci    case StoreType::kI32Store8:
6691cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_BINOP_EXT(Ll_w, Sc_w, 8, Sub_w, 3);
6701cb0ef41Sopenharmony_ci      break;
6711cb0ef41Sopenharmony_ci    case StoreType::kI64Store16:
6721cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_BINOP_EXT(Ll_d, Sc_d, 16, Sub_d, 7);
6731cb0ef41Sopenharmony_ci      break;
6741cb0ef41Sopenharmony_ci    case StoreType::kI32Store16:
6751cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_BINOP_EXT(Ll_w, Sc_w, 16, Sub_w, 3);
6761cb0ef41Sopenharmony_ci      break;
6771cb0ef41Sopenharmony_ci    case StoreType::kI64Store32:
6781cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_BINOP_EXT(Ll_d, Sc_d, 32, Sub_d, 7);
6791cb0ef41Sopenharmony_ci      break;
6801cb0ef41Sopenharmony_ci    case StoreType::kI32Store:
6811cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_BINOP(Ll_w, Sc_w, Sub_w);
6821cb0ef41Sopenharmony_ci      break;
6831cb0ef41Sopenharmony_ci    case StoreType::kI64Store:
6841cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_BINOP(Ll_d, Sc_d, Sub_d);
6851cb0ef41Sopenharmony_ci      break;
6861cb0ef41Sopenharmony_ci    default:
6871cb0ef41Sopenharmony_ci      UNREACHABLE();
6881cb0ef41Sopenharmony_ci  }
6891cb0ef41Sopenharmony_ci}
6901cb0ef41Sopenharmony_ci#undef ASSEMBLE_ATOMIC_BINOP
6911cb0ef41Sopenharmony_ci#undef ASSEMBLE_ATOMIC_BINOP_EXT
6921cb0ef41Sopenharmony_ci#undef ATOMIC_BINOP_CASE
6931cb0ef41Sopenharmony_ci
6941cb0ef41Sopenharmony_ci#define ASSEMBLE_ATOMIC_EXCHANGE_INTEGER_EXT(load_linked, store_conditional, \
6951cb0ef41Sopenharmony_ci                                             size, aligned)                  \
6961cb0ef41Sopenharmony_ci  do {                                                                       \
6971cb0ef41Sopenharmony_ci    Label exchange;                                                          \
6981cb0ef41Sopenharmony_ci    andi(temp1, temp0, aligned);                                             \
6991cb0ef41Sopenharmony_ci    Sub_d(temp0, temp0, Operand(temp1));                                     \
7001cb0ef41Sopenharmony_ci    slli_w(temp1, temp1, 3);                                                 \
7011cb0ef41Sopenharmony_ci    dbar(0);                                                                 \
7021cb0ef41Sopenharmony_ci    bind(&exchange);                                                         \
7031cb0ef41Sopenharmony_ci    load_linked(temp2, MemOperand(temp0, 0));                                \
7041cb0ef41Sopenharmony_ci    ExtractBits(result.gp(), temp2, temp1, size, false);                     \
7051cb0ef41Sopenharmony_ci    InsertBits(temp2, value.gp(), temp1, size);                              \
7061cb0ef41Sopenharmony_ci    store_conditional(temp2, MemOperand(temp0, 0));                          \
7071cb0ef41Sopenharmony_ci    BranchShort(&exchange, eq, temp2, Operand(zero_reg));                    \
7081cb0ef41Sopenharmony_ci    dbar(0);                                                                 \
7091cb0ef41Sopenharmony_ci  } while (0)
7101cb0ef41Sopenharmony_ci
7111cb0ef41Sopenharmony_civoid LiftoffAssembler::AtomicExchange(Register dst_addr, Register offset_reg,
7121cb0ef41Sopenharmony_ci                                      uintptr_t offset_imm,
7131cb0ef41Sopenharmony_ci                                      LiftoffRegister value,
7141cb0ef41Sopenharmony_ci                                      LiftoffRegister result, StoreType type) {
7151cb0ef41Sopenharmony_ci  LiftoffRegList pinned = {dst_addr, offset_reg, value, result};
7161cb0ef41Sopenharmony_ci  Register temp0 = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp();
7171cb0ef41Sopenharmony_ci  Register temp1 = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp();
7181cb0ef41Sopenharmony_ci  Register temp2 = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp();
7191cb0ef41Sopenharmony_ci  MemOperand dst_op = liftoff::GetMemOp(this, dst_addr, offset_reg, offset_imm);
7201cb0ef41Sopenharmony_ci  Add_d(temp0, dst_op.base(), dst_op.offset());
7211cb0ef41Sopenharmony_ci  switch (type.value()) {
7221cb0ef41Sopenharmony_ci    case StoreType::kI64Store8:
7231cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_EXCHANGE_INTEGER_EXT(Ll_d, Sc_d, 8, 7);
7241cb0ef41Sopenharmony_ci      break;
7251cb0ef41Sopenharmony_ci    case StoreType::kI32Store8:
7261cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_EXCHANGE_INTEGER_EXT(Ll_w, Sc_w, 8, 3);
7271cb0ef41Sopenharmony_ci      break;
7281cb0ef41Sopenharmony_ci    case StoreType::kI64Store16:
7291cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_EXCHANGE_INTEGER_EXT(Ll_d, Sc_d, 16, 7);
7301cb0ef41Sopenharmony_ci      break;
7311cb0ef41Sopenharmony_ci    case StoreType::kI32Store16:
7321cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_EXCHANGE_INTEGER_EXT(Ll_w, Sc_w, 16, 3);
7331cb0ef41Sopenharmony_ci      break;
7341cb0ef41Sopenharmony_ci    case StoreType::kI64Store32:
7351cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_EXCHANGE_INTEGER_EXT(Ll_d, Sc_d, 32, 7);
7361cb0ef41Sopenharmony_ci      break;
7371cb0ef41Sopenharmony_ci    case StoreType::kI32Store:
7381cb0ef41Sopenharmony_ci      amswap_db_w(result.gp(), value.gp(), temp0);
7391cb0ef41Sopenharmony_ci      break;
7401cb0ef41Sopenharmony_ci    case StoreType::kI64Store:
7411cb0ef41Sopenharmony_ci      amswap_db_d(result.gp(), value.gp(), temp0);
7421cb0ef41Sopenharmony_ci      break;
7431cb0ef41Sopenharmony_ci    default:
7441cb0ef41Sopenharmony_ci      UNREACHABLE();
7451cb0ef41Sopenharmony_ci  }
7461cb0ef41Sopenharmony_ci}
7471cb0ef41Sopenharmony_ci#undef ASSEMBLE_ATOMIC_EXCHANGE_INTEGER_EXT
7481cb0ef41Sopenharmony_ci
7491cb0ef41Sopenharmony_ci#define ASSEMBLE_ATOMIC_COMPARE_EXCHANGE_INTEGER(load_linked,       \
7501cb0ef41Sopenharmony_ci                                                 store_conditional) \
7511cb0ef41Sopenharmony_ci  do {                                                              \
7521cb0ef41Sopenharmony_ci    Label compareExchange;                                          \
7531cb0ef41Sopenharmony_ci    Label exit;                                                     \
7541cb0ef41Sopenharmony_ci    dbar(0);                                                        \
7551cb0ef41Sopenharmony_ci    bind(&compareExchange);                                         \
7561cb0ef41Sopenharmony_ci    load_linked(result.gp(), MemOperand(temp0, 0));                 \
7571cb0ef41Sopenharmony_ci    BranchShort(&exit, ne, expected.gp(), Operand(result.gp()));    \
7581cb0ef41Sopenharmony_ci    mov(temp2, new_value.gp());                                     \
7591cb0ef41Sopenharmony_ci    store_conditional(temp2, MemOperand(temp0, 0));                 \
7601cb0ef41Sopenharmony_ci    BranchShort(&compareExchange, eq, temp2, Operand(zero_reg));    \
7611cb0ef41Sopenharmony_ci    bind(&exit);                                                    \
7621cb0ef41Sopenharmony_ci    dbar(0);                                                        \
7631cb0ef41Sopenharmony_ci  } while (0)
7641cb0ef41Sopenharmony_ci
7651cb0ef41Sopenharmony_ci#define ASSEMBLE_ATOMIC_COMPARE_EXCHANGE_INTEGER_EXT(            \
7661cb0ef41Sopenharmony_ci    load_linked, store_conditional, size, aligned)               \
7671cb0ef41Sopenharmony_ci  do {                                                           \
7681cb0ef41Sopenharmony_ci    Label compareExchange;                                       \
7691cb0ef41Sopenharmony_ci    Label exit;                                                  \
7701cb0ef41Sopenharmony_ci    andi(temp1, temp0, aligned);                                 \
7711cb0ef41Sopenharmony_ci    Sub_d(temp0, temp0, Operand(temp1));                         \
7721cb0ef41Sopenharmony_ci    slli_w(temp1, temp1, 3);                                     \
7731cb0ef41Sopenharmony_ci    dbar(0);                                                     \
7741cb0ef41Sopenharmony_ci    bind(&compareExchange);                                      \
7751cb0ef41Sopenharmony_ci    load_linked(temp2, MemOperand(temp0, 0));                    \
7761cb0ef41Sopenharmony_ci    ExtractBits(result.gp(), temp2, temp1, size, false);         \
7771cb0ef41Sopenharmony_ci    ExtractBits(temp2, expected.gp(), zero_reg, size, false);    \
7781cb0ef41Sopenharmony_ci    BranchShort(&exit, ne, temp2, Operand(result.gp()));         \
7791cb0ef41Sopenharmony_ci    InsertBits(temp2, new_value.gp(), temp1, size);              \
7801cb0ef41Sopenharmony_ci    store_conditional(temp2, MemOperand(temp0, 0));              \
7811cb0ef41Sopenharmony_ci    BranchShort(&compareExchange, eq, temp2, Operand(zero_reg)); \
7821cb0ef41Sopenharmony_ci    bind(&exit);                                                 \
7831cb0ef41Sopenharmony_ci    dbar(0);                                                     \
7841cb0ef41Sopenharmony_ci  } while (0)
7851cb0ef41Sopenharmony_ci
7861cb0ef41Sopenharmony_civoid LiftoffAssembler::AtomicCompareExchange(
7871cb0ef41Sopenharmony_ci    Register dst_addr, Register offset_reg, uintptr_t offset_imm,
7881cb0ef41Sopenharmony_ci    LiftoffRegister expected, LiftoffRegister new_value, LiftoffRegister result,
7891cb0ef41Sopenharmony_ci    StoreType type) {
7901cb0ef41Sopenharmony_ci  LiftoffRegList pinned = {dst_addr, offset_reg, expected, new_value, result};
7911cb0ef41Sopenharmony_ci  Register temp0 = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp();
7921cb0ef41Sopenharmony_ci  Register temp1 = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp();
7931cb0ef41Sopenharmony_ci  Register temp2 = pinned.set(GetUnusedRegister(kGpReg, pinned)).gp();
7941cb0ef41Sopenharmony_ci  MemOperand dst_op = liftoff::GetMemOp(this, dst_addr, offset_reg, offset_imm);
7951cb0ef41Sopenharmony_ci  Add_d(temp0, dst_op.base(), dst_op.offset());
7961cb0ef41Sopenharmony_ci  switch (type.value()) {
7971cb0ef41Sopenharmony_ci    case StoreType::kI64Store8:
7981cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_COMPARE_EXCHANGE_INTEGER_EXT(Ll_d, Sc_d, 8, 7);
7991cb0ef41Sopenharmony_ci      break;
8001cb0ef41Sopenharmony_ci    case StoreType::kI32Store8:
8011cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_COMPARE_EXCHANGE_INTEGER_EXT(Ll_w, Sc_w, 8, 3);
8021cb0ef41Sopenharmony_ci      break;
8031cb0ef41Sopenharmony_ci    case StoreType::kI64Store16:
8041cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_COMPARE_EXCHANGE_INTEGER_EXT(Ll_d, Sc_d, 16, 7);
8051cb0ef41Sopenharmony_ci      break;
8061cb0ef41Sopenharmony_ci    case StoreType::kI32Store16:
8071cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_COMPARE_EXCHANGE_INTEGER_EXT(Ll_w, Sc_w, 16, 3);
8081cb0ef41Sopenharmony_ci      break;
8091cb0ef41Sopenharmony_ci    case StoreType::kI64Store32:
8101cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_COMPARE_EXCHANGE_INTEGER_EXT(Ll_d, Sc_d, 32, 7);
8111cb0ef41Sopenharmony_ci      break;
8121cb0ef41Sopenharmony_ci    case StoreType::kI32Store:
8131cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_COMPARE_EXCHANGE_INTEGER(Ll_w, Sc_w);
8141cb0ef41Sopenharmony_ci      break;
8151cb0ef41Sopenharmony_ci    case StoreType::kI64Store:
8161cb0ef41Sopenharmony_ci      ASSEMBLE_ATOMIC_COMPARE_EXCHANGE_INTEGER(Ll_d, Sc_d);
8171cb0ef41Sopenharmony_ci      break;
8181cb0ef41Sopenharmony_ci    default:
8191cb0ef41Sopenharmony_ci      UNREACHABLE();
8201cb0ef41Sopenharmony_ci  }
8211cb0ef41Sopenharmony_ci}
8221cb0ef41Sopenharmony_ci#undef ASSEMBLE_ATOMIC_COMPARE_EXCHANGE_INTEGER
8231cb0ef41Sopenharmony_ci#undef ASSEMBLE_ATOMIC_COMPARE_EXCHANGE_INTEGER_EXT
8241cb0ef41Sopenharmony_ci
8251cb0ef41Sopenharmony_civoid LiftoffAssembler::AtomicFence() { dbar(0); }
8261cb0ef41Sopenharmony_ci
8271cb0ef41Sopenharmony_civoid LiftoffAssembler::LoadCallerFrameSlot(LiftoffRegister dst,
8281cb0ef41Sopenharmony_ci                                           uint32_t caller_slot_idx,
8291cb0ef41Sopenharmony_ci                                           ValueKind kind) {
8301cb0ef41Sopenharmony_ci  MemOperand src(fp, kSystemPointerSize * (caller_slot_idx + 1));
8311cb0ef41Sopenharmony_ci  liftoff::Load(this, dst, src, kind);
8321cb0ef41Sopenharmony_ci}
8331cb0ef41Sopenharmony_ci
8341cb0ef41Sopenharmony_civoid LiftoffAssembler::StoreCallerFrameSlot(LiftoffRegister src,
8351cb0ef41Sopenharmony_ci                                            uint32_t caller_slot_idx,
8361cb0ef41Sopenharmony_ci                                            ValueKind kind) {
8371cb0ef41Sopenharmony_ci  int32_t offset = kSystemPointerSize * (caller_slot_idx + 1);
8381cb0ef41Sopenharmony_ci  liftoff::Store(this, fp, offset, src, kind);
8391cb0ef41Sopenharmony_ci}
8401cb0ef41Sopenharmony_ci
8411cb0ef41Sopenharmony_civoid LiftoffAssembler::LoadReturnStackSlot(LiftoffRegister dst, int offset,
8421cb0ef41Sopenharmony_ci                                           ValueKind kind) {
8431cb0ef41Sopenharmony_ci  liftoff::Load(this, dst, MemOperand(sp, offset), kind);
8441cb0ef41Sopenharmony_ci}
8451cb0ef41Sopenharmony_ci
8461cb0ef41Sopenharmony_civoid LiftoffAssembler::MoveStackValue(uint32_t dst_offset, uint32_t src_offset,
8471cb0ef41Sopenharmony_ci                                      ValueKind kind) {
8481cb0ef41Sopenharmony_ci  DCHECK_NE(dst_offset, src_offset);
8491cb0ef41Sopenharmony_ci  LiftoffRegister reg = GetUnusedRegister(reg_class_for(kind), {});
8501cb0ef41Sopenharmony_ci  Fill(reg, src_offset, kind);
8511cb0ef41Sopenharmony_ci  Spill(dst_offset, reg, kind);
8521cb0ef41Sopenharmony_ci}
8531cb0ef41Sopenharmony_ci
8541cb0ef41Sopenharmony_civoid LiftoffAssembler::Move(Register dst, Register src, ValueKind kind) {
8551cb0ef41Sopenharmony_ci  DCHECK_NE(dst, src);
8561cb0ef41Sopenharmony_ci  // TODO(ksreten): Handle different sizes here.
8571cb0ef41Sopenharmony_ci  TurboAssembler::Move(dst, src);
8581cb0ef41Sopenharmony_ci}
8591cb0ef41Sopenharmony_ci
8601cb0ef41Sopenharmony_civoid LiftoffAssembler::Move(DoubleRegister dst, DoubleRegister src,
8611cb0ef41Sopenharmony_ci                            ValueKind kind) {
8621cb0ef41Sopenharmony_ci  DCHECK_NE(dst, src);
8631cb0ef41Sopenharmony_ci  if (kind != kS128) {
8641cb0ef41Sopenharmony_ci    TurboAssembler::Move(dst, src);
8651cb0ef41Sopenharmony_ci  } else {
8661cb0ef41Sopenharmony_ci    UNREACHABLE();
8671cb0ef41Sopenharmony_ci  }
8681cb0ef41Sopenharmony_ci}
8691cb0ef41Sopenharmony_ci
8701cb0ef41Sopenharmony_civoid LiftoffAssembler::Spill(int offset, LiftoffRegister reg, ValueKind kind) {
8711cb0ef41Sopenharmony_ci  RecordUsedSpillOffset(offset);
8721cb0ef41Sopenharmony_ci  MemOperand dst = liftoff::GetStackSlot(offset);
8731cb0ef41Sopenharmony_ci  switch (kind) {
8741cb0ef41Sopenharmony_ci    case kI32:
8751cb0ef41Sopenharmony_ci      St_w(reg.gp(), dst);
8761cb0ef41Sopenharmony_ci      break;
8771cb0ef41Sopenharmony_ci    case kI64:
8781cb0ef41Sopenharmony_ci    case kRef:
8791cb0ef41Sopenharmony_ci    case kOptRef:
8801cb0ef41Sopenharmony_ci    case kRtt:
8811cb0ef41Sopenharmony_ci      St_d(reg.gp(), dst);
8821cb0ef41Sopenharmony_ci      break;
8831cb0ef41Sopenharmony_ci    case kF32:
8841cb0ef41Sopenharmony_ci      Fst_s(reg.fp(), dst);
8851cb0ef41Sopenharmony_ci      break;
8861cb0ef41Sopenharmony_ci    case kF64:
8871cb0ef41Sopenharmony_ci      TurboAssembler::Fst_d(reg.fp(), dst);
8881cb0ef41Sopenharmony_ci      break;
8891cb0ef41Sopenharmony_ci    case kS128:
8901cb0ef41Sopenharmony_ci      UNREACHABLE();
8911cb0ef41Sopenharmony_ci      break;
8921cb0ef41Sopenharmony_ci    default:
8931cb0ef41Sopenharmony_ci      UNREACHABLE();
8941cb0ef41Sopenharmony_ci  }
8951cb0ef41Sopenharmony_ci}
8961cb0ef41Sopenharmony_ci
8971cb0ef41Sopenharmony_civoid LiftoffAssembler::Spill(int offset, WasmValue value) {
8981cb0ef41Sopenharmony_ci  RecordUsedSpillOffset(offset);
8991cb0ef41Sopenharmony_ci  MemOperand dst = liftoff::GetStackSlot(offset);
9001cb0ef41Sopenharmony_ci  switch (value.type().kind()) {
9011cb0ef41Sopenharmony_ci    case kI32: {
9021cb0ef41Sopenharmony_ci      LiftoffRegister tmp = GetUnusedRegister(kGpReg, {});
9031cb0ef41Sopenharmony_ci      TurboAssembler::li(tmp.gp(), Operand(value.to_i32()));
9041cb0ef41Sopenharmony_ci      St_w(tmp.gp(), dst);
9051cb0ef41Sopenharmony_ci      break;
9061cb0ef41Sopenharmony_ci    }
9071cb0ef41Sopenharmony_ci    case kI64:
9081cb0ef41Sopenharmony_ci    case kRef:
9091cb0ef41Sopenharmony_ci    case kOptRef: {
9101cb0ef41Sopenharmony_ci      LiftoffRegister tmp = GetUnusedRegister(kGpReg, {});
9111cb0ef41Sopenharmony_ci      TurboAssembler::li(tmp.gp(), value.to_i64());
9121cb0ef41Sopenharmony_ci      St_d(tmp.gp(), dst);
9131cb0ef41Sopenharmony_ci      break;
9141cb0ef41Sopenharmony_ci    }
9151cb0ef41Sopenharmony_ci    default:
9161cb0ef41Sopenharmony_ci      // kWasmF32 and kWasmF64 are unreachable, since those
9171cb0ef41Sopenharmony_ci      // constants are not tracked.
9181cb0ef41Sopenharmony_ci      UNREACHABLE();
9191cb0ef41Sopenharmony_ci  }
9201cb0ef41Sopenharmony_ci}
9211cb0ef41Sopenharmony_ci
9221cb0ef41Sopenharmony_civoid LiftoffAssembler::Fill(LiftoffRegister reg, int offset, ValueKind kind) {
9231cb0ef41Sopenharmony_ci  MemOperand src = liftoff::GetStackSlot(offset);
9241cb0ef41Sopenharmony_ci  switch (kind) {
9251cb0ef41Sopenharmony_ci    case kI32:
9261cb0ef41Sopenharmony_ci      Ld_w(reg.gp(), src);
9271cb0ef41Sopenharmony_ci      break;
9281cb0ef41Sopenharmony_ci    case kI64:
9291cb0ef41Sopenharmony_ci    case kRef:
9301cb0ef41Sopenharmony_ci    case kOptRef:
9311cb0ef41Sopenharmony_ci    // TODO(LOONG_dev): LOONG64 Check, MIPS64 dosn't need, ARM64/LOONG64 need?
9321cb0ef41Sopenharmony_ci    case kRtt:
9331cb0ef41Sopenharmony_ci      Ld_d(reg.gp(), src);
9341cb0ef41Sopenharmony_ci      break;
9351cb0ef41Sopenharmony_ci    case kF32:
9361cb0ef41Sopenharmony_ci      Fld_s(reg.fp(), src);
9371cb0ef41Sopenharmony_ci      break;
9381cb0ef41Sopenharmony_ci    case kF64:
9391cb0ef41Sopenharmony_ci      TurboAssembler::Fld_d(reg.fp(), src);
9401cb0ef41Sopenharmony_ci      break;
9411cb0ef41Sopenharmony_ci    case kS128:
9421cb0ef41Sopenharmony_ci      UNREACHABLE();
9431cb0ef41Sopenharmony_ci      break;
9441cb0ef41Sopenharmony_ci    default:
9451cb0ef41Sopenharmony_ci      UNREACHABLE();
9461cb0ef41Sopenharmony_ci  }
9471cb0ef41Sopenharmony_ci}
9481cb0ef41Sopenharmony_ci
9491cb0ef41Sopenharmony_civoid LiftoffAssembler::FillI64Half(Register, int offset, RegPairHalf) {
9501cb0ef41Sopenharmony_ci  UNREACHABLE();
9511cb0ef41Sopenharmony_ci}
9521cb0ef41Sopenharmony_ci
9531cb0ef41Sopenharmony_civoid LiftoffAssembler::FillStackSlotsWithZero(int start, int size) {
9541cb0ef41Sopenharmony_ci  DCHECK_LT(0, size);
9551cb0ef41Sopenharmony_ci  RecordUsedSpillOffset(start + size);
9561cb0ef41Sopenharmony_ci
9571cb0ef41Sopenharmony_ci  if (size <= 12 * kStackSlotSize) {
9581cb0ef41Sopenharmony_ci    // Special straight-line code for up to 12 slots. Generates one
9591cb0ef41Sopenharmony_ci    // instruction per slot (<= 12 instructions total).
9601cb0ef41Sopenharmony_ci    uint32_t remainder = size;
9611cb0ef41Sopenharmony_ci    for (; remainder >= kStackSlotSize; remainder -= kStackSlotSize) {
9621cb0ef41Sopenharmony_ci      St_d(zero_reg, liftoff::GetStackSlot(start + remainder));
9631cb0ef41Sopenharmony_ci    }
9641cb0ef41Sopenharmony_ci    DCHECK(remainder == 4 || remainder == 0);
9651cb0ef41Sopenharmony_ci    if (remainder) {
9661cb0ef41Sopenharmony_ci      St_w(zero_reg, liftoff::GetStackSlot(start + remainder));
9671cb0ef41Sopenharmony_ci    }
9681cb0ef41Sopenharmony_ci  } else {
9691cb0ef41Sopenharmony_ci    // General case for bigger counts (12 instructions).
9701cb0ef41Sopenharmony_ci    // Use a0 for start address (inclusive), a1 for end address (exclusive).
9711cb0ef41Sopenharmony_ci    Push(a1, a0);
9721cb0ef41Sopenharmony_ci    Add_d(a0, fp, Operand(-start - size));
9731cb0ef41Sopenharmony_ci    Add_d(a1, fp, Operand(-start));
9741cb0ef41Sopenharmony_ci
9751cb0ef41Sopenharmony_ci    Label loop;
9761cb0ef41Sopenharmony_ci    bind(&loop);
9771cb0ef41Sopenharmony_ci    St_d(zero_reg, MemOperand(a0, 0));
9781cb0ef41Sopenharmony_ci    addi_d(a0, a0, kSystemPointerSize);
9791cb0ef41Sopenharmony_ci    BranchShort(&loop, ne, a0, Operand(a1));
9801cb0ef41Sopenharmony_ci
9811cb0ef41Sopenharmony_ci    Pop(a1, a0);
9821cb0ef41Sopenharmony_ci  }
9831cb0ef41Sopenharmony_ci}
9841cb0ef41Sopenharmony_ci
9851cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64_clz(LiftoffRegister dst, LiftoffRegister src) {
9861cb0ef41Sopenharmony_ci  TurboAssembler::Clz_d(dst.gp(), src.gp());
9871cb0ef41Sopenharmony_ci}
9881cb0ef41Sopenharmony_ci
9891cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64_ctz(LiftoffRegister dst, LiftoffRegister src) {
9901cb0ef41Sopenharmony_ci  TurboAssembler::Ctz_d(dst.gp(), src.gp());
9911cb0ef41Sopenharmony_ci}
9921cb0ef41Sopenharmony_ci
9931cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_i64_popcnt(LiftoffRegister dst,
9941cb0ef41Sopenharmony_ci                                       LiftoffRegister src) {
9951cb0ef41Sopenharmony_ci  TurboAssembler::Popcnt_d(dst.gp(), src.gp());
9961cb0ef41Sopenharmony_ci  return true;
9971cb0ef41Sopenharmony_ci}
9981cb0ef41Sopenharmony_ci
9991cb0ef41Sopenharmony_civoid LiftoffAssembler::IncrementSmi(LiftoffRegister dst, int offset) {
10001cb0ef41Sopenharmony_ci  UseScratchRegisterScope temps(this);
10011cb0ef41Sopenharmony_ci  Register scratch = temps.Acquire();
10021cb0ef41Sopenharmony_ci  SmiUntag(scratch, MemOperand(dst.gp(), offset));
10031cb0ef41Sopenharmony_ci  Add_d(scratch, scratch, Operand(1));
10041cb0ef41Sopenharmony_ci  SmiTag(scratch);
10051cb0ef41Sopenharmony_ci  St_d(scratch, MemOperand(dst.gp(), offset));
10061cb0ef41Sopenharmony_ci}
10071cb0ef41Sopenharmony_ci
10081cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32_mul(Register dst, Register lhs, Register rhs) {
10091cb0ef41Sopenharmony_ci  TurboAssembler::Mul_w(dst, lhs, rhs);
10101cb0ef41Sopenharmony_ci}
10111cb0ef41Sopenharmony_ci
10121cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32_divs(Register dst, Register lhs, Register rhs,
10131cb0ef41Sopenharmony_ci                                     Label* trap_div_by_zero,
10141cb0ef41Sopenharmony_ci                                     Label* trap_div_unrepresentable) {
10151cb0ef41Sopenharmony_ci  TurboAssembler::Branch(trap_div_by_zero, eq, rhs, Operand(zero_reg));
10161cb0ef41Sopenharmony_ci
10171cb0ef41Sopenharmony_ci  // Check if lhs == kMinInt and rhs == -1, since this case is unrepresentable.
10181cb0ef41Sopenharmony_ci  TurboAssembler::li(kScratchReg, 1);
10191cb0ef41Sopenharmony_ci  TurboAssembler::li(kScratchReg2, 1);
10201cb0ef41Sopenharmony_ci  TurboAssembler::LoadZeroOnCondition(kScratchReg, lhs, Operand(kMinInt), eq);
10211cb0ef41Sopenharmony_ci  TurboAssembler::LoadZeroOnCondition(kScratchReg2, rhs, Operand(-1), eq);
10221cb0ef41Sopenharmony_ci  add_d(kScratchReg, kScratchReg, kScratchReg2);
10231cb0ef41Sopenharmony_ci  TurboAssembler::Branch(trap_div_unrepresentable, eq, kScratchReg,
10241cb0ef41Sopenharmony_ci                         Operand(zero_reg));
10251cb0ef41Sopenharmony_ci
10261cb0ef41Sopenharmony_ci  TurboAssembler::Div_w(dst, lhs, rhs);
10271cb0ef41Sopenharmony_ci}
10281cb0ef41Sopenharmony_ci
10291cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32_divu(Register dst, Register lhs, Register rhs,
10301cb0ef41Sopenharmony_ci                                     Label* trap_div_by_zero) {
10311cb0ef41Sopenharmony_ci  TurboAssembler::Branch(trap_div_by_zero, eq, rhs, Operand(zero_reg));
10321cb0ef41Sopenharmony_ci  TurboAssembler::Div_wu(dst, lhs, rhs);
10331cb0ef41Sopenharmony_ci}
10341cb0ef41Sopenharmony_ci
10351cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32_rems(Register dst, Register lhs, Register rhs,
10361cb0ef41Sopenharmony_ci                                     Label* trap_div_by_zero) {
10371cb0ef41Sopenharmony_ci  TurboAssembler::Branch(trap_div_by_zero, eq, rhs, Operand(zero_reg));
10381cb0ef41Sopenharmony_ci  TurboAssembler::Mod_w(dst, lhs, rhs);
10391cb0ef41Sopenharmony_ci}
10401cb0ef41Sopenharmony_ci
10411cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32_remu(Register dst, Register lhs, Register rhs,
10421cb0ef41Sopenharmony_ci                                     Label* trap_div_by_zero) {
10431cb0ef41Sopenharmony_ci  TurboAssembler::Branch(trap_div_by_zero, eq, rhs, Operand(zero_reg));
10441cb0ef41Sopenharmony_ci  TurboAssembler::Mod_wu(dst, lhs, rhs);
10451cb0ef41Sopenharmony_ci}
10461cb0ef41Sopenharmony_ci
10471cb0ef41Sopenharmony_ci#define I32_BINOP(name, instruction)                                 \
10481cb0ef41Sopenharmony_ci  void LiftoffAssembler::emit_i32_##name(Register dst, Register lhs, \
10491cb0ef41Sopenharmony_ci                                         Register rhs) {             \
10501cb0ef41Sopenharmony_ci    instruction(dst, lhs, rhs);                                      \
10511cb0ef41Sopenharmony_ci  }
10521cb0ef41Sopenharmony_ci
10531cb0ef41Sopenharmony_ci// clang-format off
10541cb0ef41Sopenharmony_ciI32_BINOP(add, add_w)
10551cb0ef41Sopenharmony_ciI32_BINOP(sub, sub_w)
10561cb0ef41Sopenharmony_ciI32_BINOP(and, and_)
10571cb0ef41Sopenharmony_ciI32_BINOP(or, or_)
10581cb0ef41Sopenharmony_ciI32_BINOP(xor, xor_)
10591cb0ef41Sopenharmony_ci// clang-format on
10601cb0ef41Sopenharmony_ci
10611cb0ef41Sopenharmony_ci#undef I32_BINOP
10621cb0ef41Sopenharmony_ci
10631cb0ef41Sopenharmony_ci#define I32_BINOP_I(name, instruction)                                  \
10641cb0ef41Sopenharmony_ci  void LiftoffAssembler::emit_i32_##name##i(Register dst, Register lhs, \
10651cb0ef41Sopenharmony_ci                                            int32_t imm) {              \
10661cb0ef41Sopenharmony_ci    instruction(dst, lhs, Operand(imm));                                \
10671cb0ef41Sopenharmony_ci  }
10681cb0ef41Sopenharmony_ci
10691cb0ef41Sopenharmony_ci// clang-format off
10701cb0ef41Sopenharmony_ciI32_BINOP_I(add, Add_w)
10711cb0ef41Sopenharmony_ciI32_BINOP_I(sub, Sub_w)
10721cb0ef41Sopenharmony_ciI32_BINOP_I(and, And)
10731cb0ef41Sopenharmony_ciI32_BINOP_I(or, Or)
10741cb0ef41Sopenharmony_ciI32_BINOP_I(xor, Xor)
10751cb0ef41Sopenharmony_ci// clang-format on
10761cb0ef41Sopenharmony_ci
10771cb0ef41Sopenharmony_ci#undef I32_BINOP_I
10781cb0ef41Sopenharmony_ci
10791cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32_clz(Register dst, Register src) {
10801cb0ef41Sopenharmony_ci  TurboAssembler::Clz_w(dst, src);
10811cb0ef41Sopenharmony_ci}
10821cb0ef41Sopenharmony_ci
10831cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32_ctz(Register dst, Register src) {
10841cb0ef41Sopenharmony_ci  TurboAssembler::Ctz_w(dst, src);
10851cb0ef41Sopenharmony_ci}
10861cb0ef41Sopenharmony_ci
10871cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_i32_popcnt(Register dst, Register src) {
10881cb0ef41Sopenharmony_ci  TurboAssembler::Popcnt_w(dst, src);
10891cb0ef41Sopenharmony_ci  return true;
10901cb0ef41Sopenharmony_ci}
10911cb0ef41Sopenharmony_ci
10921cb0ef41Sopenharmony_ci#define I32_SHIFTOP(name, instruction)                               \
10931cb0ef41Sopenharmony_ci  void LiftoffAssembler::emit_i32_##name(Register dst, Register src, \
10941cb0ef41Sopenharmony_ci                                         Register amount) {          \
10951cb0ef41Sopenharmony_ci    instruction(dst, src, amount);                                   \
10961cb0ef41Sopenharmony_ci  }
10971cb0ef41Sopenharmony_ci#define I32_SHIFTOP_I(name, instruction, instruction1)                  \
10981cb0ef41Sopenharmony_ci  I32_SHIFTOP(name, instruction)                                        \
10991cb0ef41Sopenharmony_ci  void LiftoffAssembler::emit_i32_##name##i(Register dst, Register src, \
11001cb0ef41Sopenharmony_ci                                            int amount) {               \
11011cb0ef41Sopenharmony_ci    instruction1(dst, src, amount & 0x1f);                              \
11021cb0ef41Sopenharmony_ci  }
11031cb0ef41Sopenharmony_ci
11041cb0ef41Sopenharmony_ciI32_SHIFTOP_I(shl, sll_w, slli_w)
11051cb0ef41Sopenharmony_ciI32_SHIFTOP_I(sar, sra_w, srai_w)
11061cb0ef41Sopenharmony_ciI32_SHIFTOP_I(shr, srl_w, srli_w)
11071cb0ef41Sopenharmony_ci
11081cb0ef41Sopenharmony_ci#undef I32_SHIFTOP
11091cb0ef41Sopenharmony_ci#undef I32_SHIFTOP_I
11101cb0ef41Sopenharmony_ci
11111cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64_addi(LiftoffRegister dst, LiftoffRegister lhs,
11121cb0ef41Sopenharmony_ci                                     int64_t imm) {
11131cb0ef41Sopenharmony_ci  TurboAssembler::Add_d(dst.gp(), lhs.gp(), Operand(imm));
11141cb0ef41Sopenharmony_ci}
11151cb0ef41Sopenharmony_ci
11161cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64_mul(LiftoffRegister dst, LiftoffRegister lhs,
11171cb0ef41Sopenharmony_ci                                    LiftoffRegister rhs) {
11181cb0ef41Sopenharmony_ci  TurboAssembler::Mul_d(dst.gp(), lhs.gp(), rhs.gp());
11191cb0ef41Sopenharmony_ci}
11201cb0ef41Sopenharmony_ci
11211cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_i64_divs(LiftoffRegister dst, LiftoffRegister lhs,
11221cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs,
11231cb0ef41Sopenharmony_ci                                     Label* trap_div_by_zero,
11241cb0ef41Sopenharmony_ci                                     Label* trap_div_unrepresentable) {
11251cb0ef41Sopenharmony_ci  TurboAssembler::Branch(trap_div_by_zero, eq, rhs.gp(), Operand(zero_reg));
11261cb0ef41Sopenharmony_ci
11271cb0ef41Sopenharmony_ci  // Check if lhs == MinInt64 and rhs == -1, since this case is unrepresentable.
11281cb0ef41Sopenharmony_ci  TurboAssembler::li(kScratchReg, 1);
11291cb0ef41Sopenharmony_ci  TurboAssembler::li(kScratchReg2, 1);
11301cb0ef41Sopenharmony_ci  TurboAssembler::LoadZeroOnCondition(
11311cb0ef41Sopenharmony_ci      kScratchReg, lhs.gp(), Operand(std::numeric_limits<int64_t>::min()), eq);
11321cb0ef41Sopenharmony_ci  TurboAssembler::LoadZeroOnCondition(kScratchReg2, rhs.gp(), Operand(-1), eq);
11331cb0ef41Sopenharmony_ci  add_d(kScratchReg, kScratchReg, kScratchReg2);
11341cb0ef41Sopenharmony_ci  TurboAssembler::Branch(trap_div_unrepresentable, eq, kScratchReg,
11351cb0ef41Sopenharmony_ci                         Operand(zero_reg));
11361cb0ef41Sopenharmony_ci
11371cb0ef41Sopenharmony_ci  TurboAssembler::Div_d(dst.gp(), lhs.gp(), rhs.gp());
11381cb0ef41Sopenharmony_ci  return true;
11391cb0ef41Sopenharmony_ci}
11401cb0ef41Sopenharmony_ci
11411cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_i64_divu(LiftoffRegister dst, LiftoffRegister lhs,
11421cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs,
11431cb0ef41Sopenharmony_ci                                     Label* trap_div_by_zero) {
11441cb0ef41Sopenharmony_ci  TurboAssembler::Branch(trap_div_by_zero, eq, rhs.gp(), Operand(zero_reg));
11451cb0ef41Sopenharmony_ci  TurboAssembler::Div_du(dst.gp(), lhs.gp(), rhs.gp());
11461cb0ef41Sopenharmony_ci  return true;
11471cb0ef41Sopenharmony_ci}
11481cb0ef41Sopenharmony_ci
11491cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_i64_rems(LiftoffRegister dst, LiftoffRegister lhs,
11501cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs,
11511cb0ef41Sopenharmony_ci                                     Label* trap_div_by_zero) {
11521cb0ef41Sopenharmony_ci  TurboAssembler::Branch(trap_div_by_zero, eq, rhs.gp(), Operand(zero_reg));
11531cb0ef41Sopenharmony_ci  TurboAssembler::Mod_d(dst.gp(), lhs.gp(), rhs.gp());
11541cb0ef41Sopenharmony_ci  return true;
11551cb0ef41Sopenharmony_ci}
11561cb0ef41Sopenharmony_ci
11571cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_i64_remu(LiftoffRegister dst, LiftoffRegister lhs,
11581cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs,
11591cb0ef41Sopenharmony_ci                                     Label* trap_div_by_zero) {
11601cb0ef41Sopenharmony_ci  TurboAssembler::Branch(trap_div_by_zero, eq, rhs.gp(), Operand(zero_reg));
11611cb0ef41Sopenharmony_ci  TurboAssembler::Mod_du(dst.gp(), lhs.gp(), rhs.gp());
11621cb0ef41Sopenharmony_ci  return true;
11631cb0ef41Sopenharmony_ci}
11641cb0ef41Sopenharmony_ci
11651cb0ef41Sopenharmony_ci#define I64_BINOP(name, instruction)                                   \
11661cb0ef41Sopenharmony_ci  void LiftoffAssembler::emit_i64_##name(                              \
11671cb0ef41Sopenharmony_ci      LiftoffRegister dst, LiftoffRegister lhs, LiftoffRegister rhs) { \
11681cb0ef41Sopenharmony_ci    instruction(dst.gp(), lhs.gp(), rhs.gp());                         \
11691cb0ef41Sopenharmony_ci  }
11701cb0ef41Sopenharmony_ci
11711cb0ef41Sopenharmony_ci// clang-format off
11721cb0ef41Sopenharmony_ciI64_BINOP(add, Add_d)
11731cb0ef41Sopenharmony_ciI64_BINOP(sub, Sub_d)
11741cb0ef41Sopenharmony_ciI64_BINOP(and, and_)
11751cb0ef41Sopenharmony_ciI64_BINOP(or, or_)
11761cb0ef41Sopenharmony_ciI64_BINOP(xor, xor_)
11771cb0ef41Sopenharmony_ci// clang-format on
11781cb0ef41Sopenharmony_ci
11791cb0ef41Sopenharmony_ci#undef I64_BINOP
11801cb0ef41Sopenharmony_ci
11811cb0ef41Sopenharmony_ci#define I64_BINOP_I(name, instruction)                         \
11821cb0ef41Sopenharmony_ci  void LiftoffAssembler::emit_i64_##name##i(                   \
11831cb0ef41Sopenharmony_ci      LiftoffRegister dst, LiftoffRegister lhs, int32_t imm) { \
11841cb0ef41Sopenharmony_ci    instruction(dst.gp(), lhs.gp(), Operand(imm));             \
11851cb0ef41Sopenharmony_ci  }
11861cb0ef41Sopenharmony_ci
11871cb0ef41Sopenharmony_ci// clang-format off
11881cb0ef41Sopenharmony_ciI64_BINOP_I(and, And)
11891cb0ef41Sopenharmony_ciI64_BINOP_I(or, Or)
11901cb0ef41Sopenharmony_ciI64_BINOP_I(xor, Xor)
11911cb0ef41Sopenharmony_ci// clang-format on
11921cb0ef41Sopenharmony_ci
11931cb0ef41Sopenharmony_ci#undef I64_BINOP_I
11941cb0ef41Sopenharmony_ci
11951cb0ef41Sopenharmony_ci#define I64_SHIFTOP(name, instruction)                             \
11961cb0ef41Sopenharmony_ci  void LiftoffAssembler::emit_i64_##name(                          \
11971cb0ef41Sopenharmony_ci      LiftoffRegister dst, LiftoffRegister src, Register amount) { \
11981cb0ef41Sopenharmony_ci    instruction(dst.gp(), src.gp(), amount);                       \
11991cb0ef41Sopenharmony_ci  }
12001cb0ef41Sopenharmony_ci#define I64_SHIFTOP_I(name, instruction, instructioni)                         \
12011cb0ef41Sopenharmony_ci  I64_SHIFTOP(name, instruction)                                               \
12021cb0ef41Sopenharmony_ci  void LiftoffAssembler::emit_i64_##name##i(LiftoffRegister dst,               \
12031cb0ef41Sopenharmony_ci                                            LiftoffRegister src, int amount) { \
12041cb0ef41Sopenharmony_ci    instructioni(dst.gp(), src.gp(), amount & 63);                             \
12051cb0ef41Sopenharmony_ci  }
12061cb0ef41Sopenharmony_ci
12071cb0ef41Sopenharmony_ciI64_SHIFTOP_I(shl, sll_d, slli_d)
12081cb0ef41Sopenharmony_ciI64_SHIFTOP_I(sar, sra_d, srai_d)
12091cb0ef41Sopenharmony_ciI64_SHIFTOP_I(shr, srl_d, srli_d)
12101cb0ef41Sopenharmony_ci
12111cb0ef41Sopenharmony_ci#undef I64_SHIFTOP
12121cb0ef41Sopenharmony_ci#undef I64_SHIFTOP_I
12131cb0ef41Sopenharmony_ci
12141cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_u32_to_uintptr(Register dst, Register src) {
12151cb0ef41Sopenharmony_ci  bstrpick_d(dst, src, 31, 0);
12161cb0ef41Sopenharmony_ci}
12171cb0ef41Sopenharmony_ci
12181cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32_neg(DoubleRegister dst, DoubleRegister src) {
12191cb0ef41Sopenharmony_ci  TurboAssembler::Neg_s(dst, src);
12201cb0ef41Sopenharmony_ci}
12211cb0ef41Sopenharmony_ci
12221cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64_neg(DoubleRegister dst, DoubleRegister src) {
12231cb0ef41Sopenharmony_ci  TurboAssembler::Neg_d(dst, src);
12241cb0ef41Sopenharmony_ci}
12251cb0ef41Sopenharmony_ci
12261cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32_min(DoubleRegister dst, DoubleRegister lhs,
12271cb0ef41Sopenharmony_ci                                    DoubleRegister rhs) {
12281cb0ef41Sopenharmony_ci  Label ool, done;
12291cb0ef41Sopenharmony_ci  TurboAssembler::Float32Min(dst, lhs, rhs, &ool);
12301cb0ef41Sopenharmony_ci  Branch(&done);
12311cb0ef41Sopenharmony_ci
12321cb0ef41Sopenharmony_ci  bind(&ool);
12331cb0ef41Sopenharmony_ci  TurboAssembler::Float32MinOutOfLine(dst, lhs, rhs);
12341cb0ef41Sopenharmony_ci  bind(&done);
12351cb0ef41Sopenharmony_ci}
12361cb0ef41Sopenharmony_ci
12371cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32_max(DoubleRegister dst, DoubleRegister lhs,
12381cb0ef41Sopenharmony_ci                                    DoubleRegister rhs) {
12391cb0ef41Sopenharmony_ci  Label ool, done;
12401cb0ef41Sopenharmony_ci  TurboAssembler::Float32Max(dst, lhs, rhs, &ool);
12411cb0ef41Sopenharmony_ci  Branch(&done);
12421cb0ef41Sopenharmony_ci
12431cb0ef41Sopenharmony_ci  bind(&ool);
12441cb0ef41Sopenharmony_ci  TurboAssembler::Float32MaxOutOfLine(dst, lhs, rhs);
12451cb0ef41Sopenharmony_ci  bind(&done);
12461cb0ef41Sopenharmony_ci}
12471cb0ef41Sopenharmony_ci
12481cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32_copysign(DoubleRegister dst, DoubleRegister lhs,
12491cb0ef41Sopenharmony_ci                                         DoubleRegister rhs) {
12501cb0ef41Sopenharmony_ci  fcopysign_s(dst, lhs, rhs);
12511cb0ef41Sopenharmony_ci}
12521cb0ef41Sopenharmony_ci
12531cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64_min(DoubleRegister dst, DoubleRegister lhs,
12541cb0ef41Sopenharmony_ci                                    DoubleRegister rhs) {
12551cb0ef41Sopenharmony_ci  Label ool, done;
12561cb0ef41Sopenharmony_ci  TurboAssembler::Float64Min(dst, lhs, rhs, &ool);
12571cb0ef41Sopenharmony_ci  Branch(&done);
12581cb0ef41Sopenharmony_ci
12591cb0ef41Sopenharmony_ci  bind(&ool);
12601cb0ef41Sopenharmony_ci  TurboAssembler::Float64MinOutOfLine(dst, lhs, rhs);
12611cb0ef41Sopenharmony_ci  bind(&done);
12621cb0ef41Sopenharmony_ci}
12631cb0ef41Sopenharmony_ci
12641cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64_max(DoubleRegister dst, DoubleRegister lhs,
12651cb0ef41Sopenharmony_ci                                    DoubleRegister rhs) {
12661cb0ef41Sopenharmony_ci  Label ool, done;
12671cb0ef41Sopenharmony_ci  TurboAssembler::Float64Max(dst, lhs, rhs, &ool);
12681cb0ef41Sopenharmony_ci  Branch(&done);
12691cb0ef41Sopenharmony_ci
12701cb0ef41Sopenharmony_ci  bind(&ool);
12711cb0ef41Sopenharmony_ci  TurboAssembler::Float64MaxOutOfLine(dst, lhs, rhs);
12721cb0ef41Sopenharmony_ci  bind(&done);
12731cb0ef41Sopenharmony_ci}
12741cb0ef41Sopenharmony_ci
12751cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64_copysign(DoubleRegister dst, DoubleRegister lhs,
12761cb0ef41Sopenharmony_ci                                         DoubleRegister rhs) {
12771cb0ef41Sopenharmony_ci  fcopysign_d(dst, lhs, rhs);
12781cb0ef41Sopenharmony_ci}
12791cb0ef41Sopenharmony_ci
12801cb0ef41Sopenharmony_ci#define FP_BINOP(name, instruction)                                          \
12811cb0ef41Sopenharmony_ci  void LiftoffAssembler::emit_##name(DoubleRegister dst, DoubleRegister lhs, \
12821cb0ef41Sopenharmony_ci                                     DoubleRegister rhs) {                   \
12831cb0ef41Sopenharmony_ci    instruction(dst, lhs, rhs);                                              \
12841cb0ef41Sopenharmony_ci  }
12851cb0ef41Sopenharmony_ci#define FP_UNOP(name, instruction)                                             \
12861cb0ef41Sopenharmony_ci  void LiftoffAssembler::emit_##name(DoubleRegister dst, DoubleRegister src) { \
12871cb0ef41Sopenharmony_ci    instruction(dst, src);                                                     \
12881cb0ef41Sopenharmony_ci  }
12891cb0ef41Sopenharmony_ci#define FP_UNOP_RETURN_TRUE(name, instruction)                                 \
12901cb0ef41Sopenharmony_ci  bool LiftoffAssembler::emit_##name(DoubleRegister dst, DoubleRegister src) { \
12911cb0ef41Sopenharmony_ci    instruction(dst, src);                                                     \
12921cb0ef41Sopenharmony_ci    return true;                                                               \
12931cb0ef41Sopenharmony_ci  }
12941cb0ef41Sopenharmony_ci
12951cb0ef41Sopenharmony_ciFP_BINOP(f32_add, fadd_s)
12961cb0ef41Sopenharmony_ciFP_BINOP(f32_sub, fsub_s)
12971cb0ef41Sopenharmony_ciFP_BINOP(f32_mul, fmul_s)
12981cb0ef41Sopenharmony_ciFP_BINOP(f32_div, fdiv_s)
12991cb0ef41Sopenharmony_ciFP_UNOP(f32_abs, fabs_s)
13001cb0ef41Sopenharmony_ciFP_UNOP_RETURN_TRUE(f32_ceil, Ceil_s)
13011cb0ef41Sopenharmony_ciFP_UNOP_RETURN_TRUE(f32_floor, Floor_s)
13021cb0ef41Sopenharmony_ciFP_UNOP_RETURN_TRUE(f32_trunc, Trunc_s)
13031cb0ef41Sopenharmony_ciFP_UNOP_RETURN_TRUE(f32_nearest_int, Round_s)
13041cb0ef41Sopenharmony_ciFP_UNOP(f32_sqrt, fsqrt_s)
13051cb0ef41Sopenharmony_ciFP_BINOP(f64_add, fadd_d)
13061cb0ef41Sopenharmony_ciFP_BINOP(f64_sub, fsub_d)
13071cb0ef41Sopenharmony_ciFP_BINOP(f64_mul, fmul_d)
13081cb0ef41Sopenharmony_ciFP_BINOP(f64_div, fdiv_d)
13091cb0ef41Sopenharmony_ciFP_UNOP(f64_abs, fabs_d)
13101cb0ef41Sopenharmony_ciFP_UNOP_RETURN_TRUE(f64_ceil, Ceil_d)
13111cb0ef41Sopenharmony_ciFP_UNOP_RETURN_TRUE(f64_floor, Floor_d)
13121cb0ef41Sopenharmony_ciFP_UNOP_RETURN_TRUE(f64_trunc, Trunc_d)
13131cb0ef41Sopenharmony_ciFP_UNOP_RETURN_TRUE(f64_nearest_int, Round_d)
13141cb0ef41Sopenharmony_ciFP_UNOP(f64_sqrt, fsqrt_d)
13151cb0ef41Sopenharmony_ci
13161cb0ef41Sopenharmony_ci#undef FP_BINOP
13171cb0ef41Sopenharmony_ci#undef FP_UNOP
13181cb0ef41Sopenharmony_ci#undef FP_UNOP_RETURN_TRUE
13191cb0ef41Sopenharmony_ci
13201cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_type_conversion(WasmOpcode opcode,
13211cb0ef41Sopenharmony_ci                                            LiftoffRegister dst,
13221cb0ef41Sopenharmony_ci                                            LiftoffRegister src, Label* trap) {
13231cb0ef41Sopenharmony_ci  switch (opcode) {
13241cb0ef41Sopenharmony_ci    case kExprI32ConvertI64:
13251cb0ef41Sopenharmony_ci      TurboAssembler::bstrpick_w(dst.gp(), src.gp(), 31, 0);
13261cb0ef41Sopenharmony_ci      return true;
13271cb0ef41Sopenharmony_ci    case kExprI32SConvertF32: {
13281cb0ef41Sopenharmony_ci      LiftoffRegister rounded = GetUnusedRegister(kFpReg, LiftoffRegList{src});
13291cb0ef41Sopenharmony_ci      LiftoffRegister converted_back =
13301cb0ef41Sopenharmony_ci          GetUnusedRegister(kFpReg, LiftoffRegList{src, rounded});
13311cb0ef41Sopenharmony_ci
13321cb0ef41Sopenharmony_ci      // Real conversion.
13331cb0ef41Sopenharmony_ci      TurboAssembler::Trunc_s(rounded.fp(), src.fp());
13341cb0ef41Sopenharmony_ci      ftintrz_w_s(kScratchDoubleReg, rounded.fp());
13351cb0ef41Sopenharmony_ci      movfr2gr_s(dst.gp(), kScratchDoubleReg);
13361cb0ef41Sopenharmony_ci      // Avoid INT32_MAX as an overflow indicator and use INT32_MIN instead,
13371cb0ef41Sopenharmony_ci      // because INT32_MIN allows easier out-of-bounds detection.
13381cb0ef41Sopenharmony_ci      TurboAssembler::Add_w(kScratchReg, dst.gp(), 1);
13391cb0ef41Sopenharmony_ci      TurboAssembler::Slt(kScratchReg2, kScratchReg, dst.gp());
13401cb0ef41Sopenharmony_ci      TurboAssembler::Movn(dst.gp(), kScratchReg, kScratchReg2);
13411cb0ef41Sopenharmony_ci
13421cb0ef41Sopenharmony_ci      // Checking if trap.
13431cb0ef41Sopenharmony_ci      movgr2fr_w(kScratchDoubleReg, dst.gp());
13441cb0ef41Sopenharmony_ci      ffint_s_w(converted_back.fp(), kScratchDoubleReg);
13451cb0ef41Sopenharmony_ci      TurboAssembler::CompareF32(rounded.fp(), converted_back.fp(), CEQ);
13461cb0ef41Sopenharmony_ci      TurboAssembler::BranchFalseF(trap);
13471cb0ef41Sopenharmony_ci      return true;
13481cb0ef41Sopenharmony_ci    }
13491cb0ef41Sopenharmony_ci    case kExprI32UConvertF32: {
13501cb0ef41Sopenharmony_ci      LiftoffRegister rounded = GetUnusedRegister(kFpReg, LiftoffRegList{src});
13511cb0ef41Sopenharmony_ci      LiftoffRegister converted_back =
13521cb0ef41Sopenharmony_ci          GetUnusedRegister(kFpReg, LiftoffRegList{src, rounded});
13531cb0ef41Sopenharmony_ci
13541cb0ef41Sopenharmony_ci      // Real conversion.
13551cb0ef41Sopenharmony_ci      TurboAssembler::Trunc_s(rounded.fp(), src.fp());
13561cb0ef41Sopenharmony_ci      TurboAssembler::Ftintrz_uw_s(dst.gp(), rounded.fp(), kScratchDoubleReg);
13571cb0ef41Sopenharmony_ci      // Avoid UINT32_MAX as an overflow indicator and use 0 instead,
13581cb0ef41Sopenharmony_ci      // because 0 allows easier out-of-bounds detection.
13591cb0ef41Sopenharmony_ci      TurboAssembler::Add_w(kScratchReg, dst.gp(), 1);
13601cb0ef41Sopenharmony_ci      TurboAssembler::Movz(dst.gp(), zero_reg, kScratchReg);
13611cb0ef41Sopenharmony_ci
13621cb0ef41Sopenharmony_ci      // Checking if trap.
13631cb0ef41Sopenharmony_ci      TurboAssembler::Ffint_d_uw(converted_back.fp(), dst.gp());
13641cb0ef41Sopenharmony_ci      fcvt_s_d(converted_back.fp(), converted_back.fp());
13651cb0ef41Sopenharmony_ci      TurboAssembler::CompareF32(rounded.fp(), converted_back.fp(), CEQ);
13661cb0ef41Sopenharmony_ci      TurboAssembler::BranchFalseF(trap);
13671cb0ef41Sopenharmony_ci      return true;
13681cb0ef41Sopenharmony_ci    }
13691cb0ef41Sopenharmony_ci    case kExprI32SConvertF64: {
13701cb0ef41Sopenharmony_ci      LiftoffRegister rounded = GetUnusedRegister(kFpReg, LiftoffRegList{src});
13711cb0ef41Sopenharmony_ci      LiftoffRegister converted_back =
13721cb0ef41Sopenharmony_ci          GetUnusedRegister(kFpReg, LiftoffRegList{src, rounded});
13731cb0ef41Sopenharmony_ci
13741cb0ef41Sopenharmony_ci      // Real conversion.
13751cb0ef41Sopenharmony_ci      TurboAssembler::Trunc_d(rounded.fp(), src.fp());
13761cb0ef41Sopenharmony_ci      ftintrz_w_d(kScratchDoubleReg, rounded.fp());
13771cb0ef41Sopenharmony_ci      movfr2gr_s(dst.gp(), kScratchDoubleReg);
13781cb0ef41Sopenharmony_ci
13791cb0ef41Sopenharmony_ci      // Checking if trap.
13801cb0ef41Sopenharmony_ci      ffint_d_w(converted_back.fp(), kScratchDoubleReg);
13811cb0ef41Sopenharmony_ci      TurboAssembler::CompareF64(rounded.fp(), converted_back.fp(), CEQ);
13821cb0ef41Sopenharmony_ci      TurboAssembler::BranchFalseF(trap);
13831cb0ef41Sopenharmony_ci      return true;
13841cb0ef41Sopenharmony_ci    }
13851cb0ef41Sopenharmony_ci    case kExprI32UConvertF64: {
13861cb0ef41Sopenharmony_ci      LiftoffRegister rounded = GetUnusedRegister(kFpReg, LiftoffRegList{src});
13871cb0ef41Sopenharmony_ci      LiftoffRegister converted_back =
13881cb0ef41Sopenharmony_ci          GetUnusedRegister(kFpReg, LiftoffRegList{src, rounded});
13891cb0ef41Sopenharmony_ci
13901cb0ef41Sopenharmony_ci      // Real conversion.
13911cb0ef41Sopenharmony_ci      TurboAssembler::Trunc_d(rounded.fp(), src.fp());
13921cb0ef41Sopenharmony_ci      TurboAssembler::Ftintrz_uw_d(dst.gp(), rounded.fp(), kScratchDoubleReg);
13931cb0ef41Sopenharmony_ci
13941cb0ef41Sopenharmony_ci      // Checking if trap.
13951cb0ef41Sopenharmony_ci      TurboAssembler::Ffint_d_uw(converted_back.fp(), dst.gp());
13961cb0ef41Sopenharmony_ci      TurboAssembler::CompareF64(rounded.fp(), converted_back.fp(), CEQ);
13971cb0ef41Sopenharmony_ci      TurboAssembler::BranchFalseF(trap);
13981cb0ef41Sopenharmony_ci      return true;
13991cb0ef41Sopenharmony_ci    }
14001cb0ef41Sopenharmony_ci    case kExprI32ReinterpretF32:
14011cb0ef41Sopenharmony_ci      TurboAssembler::FmoveLow(dst.gp(), src.fp());
14021cb0ef41Sopenharmony_ci      return true;
14031cb0ef41Sopenharmony_ci    case kExprI64SConvertI32:
14041cb0ef41Sopenharmony_ci      slli_w(dst.gp(), src.gp(), 0);
14051cb0ef41Sopenharmony_ci      return true;
14061cb0ef41Sopenharmony_ci    case kExprI64UConvertI32:
14071cb0ef41Sopenharmony_ci      TurboAssembler::bstrpick_d(dst.gp(), src.gp(), 31, 0);
14081cb0ef41Sopenharmony_ci      return true;
14091cb0ef41Sopenharmony_ci    case kExprI64SConvertF32: {
14101cb0ef41Sopenharmony_ci      LiftoffRegister rounded = GetUnusedRegister(kFpReg, LiftoffRegList{src});
14111cb0ef41Sopenharmony_ci      LiftoffRegister converted_back =
14121cb0ef41Sopenharmony_ci          GetUnusedRegister(kFpReg, LiftoffRegList{src, rounded});
14131cb0ef41Sopenharmony_ci
14141cb0ef41Sopenharmony_ci      // Real conversion.
14151cb0ef41Sopenharmony_ci      TurboAssembler::Trunc_s(rounded.fp(), src.fp());
14161cb0ef41Sopenharmony_ci      ftintrz_l_s(kScratchDoubleReg, rounded.fp());
14171cb0ef41Sopenharmony_ci      movfr2gr_d(dst.gp(), kScratchDoubleReg);
14181cb0ef41Sopenharmony_ci      // Avoid INT64_MAX as an overflow indicator and use INT64_MIN instead,
14191cb0ef41Sopenharmony_ci      // because INT64_MIN allows easier out-of-bounds detection.
14201cb0ef41Sopenharmony_ci      TurboAssembler::Add_d(kScratchReg, dst.gp(), 1);
14211cb0ef41Sopenharmony_ci      TurboAssembler::Slt(kScratchReg2, kScratchReg, dst.gp());
14221cb0ef41Sopenharmony_ci      TurboAssembler::Movn(dst.gp(), kScratchReg, kScratchReg2);
14231cb0ef41Sopenharmony_ci
14241cb0ef41Sopenharmony_ci      // Checking if trap.
14251cb0ef41Sopenharmony_ci      movgr2fr_d(kScratchDoubleReg, dst.gp());
14261cb0ef41Sopenharmony_ci      ffint_s_l(converted_back.fp(), kScratchDoubleReg);
14271cb0ef41Sopenharmony_ci      TurboAssembler::CompareF32(rounded.fp(), converted_back.fp(), CEQ);
14281cb0ef41Sopenharmony_ci      TurboAssembler::BranchFalseF(trap);
14291cb0ef41Sopenharmony_ci      return true;
14301cb0ef41Sopenharmony_ci    }
14311cb0ef41Sopenharmony_ci    case kExprI64UConvertF32: {
14321cb0ef41Sopenharmony_ci      // Real conversion.
14331cb0ef41Sopenharmony_ci      TurboAssembler::Ftintrz_ul_s(dst.gp(), src.fp(), kScratchDoubleReg,
14341cb0ef41Sopenharmony_ci                                   kScratchReg);
14351cb0ef41Sopenharmony_ci
14361cb0ef41Sopenharmony_ci      // Checking if trap.
14371cb0ef41Sopenharmony_ci      TurboAssembler::Branch(trap, eq, kScratchReg, Operand(zero_reg));
14381cb0ef41Sopenharmony_ci      return true;
14391cb0ef41Sopenharmony_ci    }
14401cb0ef41Sopenharmony_ci    case kExprI64SConvertF64: {
14411cb0ef41Sopenharmony_ci      LiftoffRegister rounded = GetUnusedRegister(kFpReg, LiftoffRegList{src});
14421cb0ef41Sopenharmony_ci      LiftoffRegister converted_back =
14431cb0ef41Sopenharmony_ci          GetUnusedRegister(kFpReg, LiftoffRegList{src, rounded});
14441cb0ef41Sopenharmony_ci
14451cb0ef41Sopenharmony_ci      // Real conversion.
14461cb0ef41Sopenharmony_ci      TurboAssembler::Trunc_d(rounded.fp(), src.fp());
14471cb0ef41Sopenharmony_ci      ftintrz_l_d(kScratchDoubleReg, rounded.fp());
14481cb0ef41Sopenharmony_ci      movfr2gr_d(dst.gp(), kScratchDoubleReg);
14491cb0ef41Sopenharmony_ci      // Avoid INT64_MAX as an overflow indicator and use INT64_MIN instead,
14501cb0ef41Sopenharmony_ci      // because INT64_MIN allows easier out-of-bounds detection.
14511cb0ef41Sopenharmony_ci      TurboAssembler::Add_d(kScratchReg, dst.gp(), 1);
14521cb0ef41Sopenharmony_ci      TurboAssembler::Slt(kScratchReg2, kScratchReg, dst.gp());
14531cb0ef41Sopenharmony_ci      TurboAssembler::Movn(dst.gp(), kScratchReg, kScratchReg2);
14541cb0ef41Sopenharmony_ci
14551cb0ef41Sopenharmony_ci      // Checking if trap.
14561cb0ef41Sopenharmony_ci      movgr2fr_d(kScratchDoubleReg, dst.gp());
14571cb0ef41Sopenharmony_ci      ffint_d_l(converted_back.fp(), kScratchDoubleReg);
14581cb0ef41Sopenharmony_ci      TurboAssembler::CompareF64(rounded.fp(), converted_back.fp(), CEQ);
14591cb0ef41Sopenharmony_ci      TurboAssembler::BranchFalseF(trap);
14601cb0ef41Sopenharmony_ci      return true;
14611cb0ef41Sopenharmony_ci    }
14621cb0ef41Sopenharmony_ci    case kExprI64UConvertF64: {
14631cb0ef41Sopenharmony_ci      // Real conversion.
14641cb0ef41Sopenharmony_ci      TurboAssembler::Ftintrz_ul_d(dst.gp(), src.fp(), kScratchDoubleReg,
14651cb0ef41Sopenharmony_ci                                   kScratchReg);
14661cb0ef41Sopenharmony_ci
14671cb0ef41Sopenharmony_ci      // Checking if trap.
14681cb0ef41Sopenharmony_ci      TurboAssembler::Branch(trap, eq, kScratchReg, Operand(zero_reg));
14691cb0ef41Sopenharmony_ci      return true;
14701cb0ef41Sopenharmony_ci    }
14711cb0ef41Sopenharmony_ci    case kExprI64ReinterpretF64:
14721cb0ef41Sopenharmony_ci      movfr2gr_d(dst.gp(), src.fp());
14731cb0ef41Sopenharmony_ci      return true;
14741cb0ef41Sopenharmony_ci    case kExprF32SConvertI32: {
14751cb0ef41Sopenharmony_ci      LiftoffRegister scratch = GetUnusedRegister(kFpReg, LiftoffRegList{dst});
14761cb0ef41Sopenharmony_ci      movgr2fr_w(scratch.fp(), src.gp());
14771cb0ef41Sopenharmony_ci      ffint_s_w(dst.fp(), scratch.fp());
14781cb0ef41Sopenharmony_ci      return true;
14791cb0ef41Sopenharmony_ci    }
14801cb0ef41Sopenharmony_ci    case kExprF32UConvertI32:
14811cb0ef41Sopenharmony_ci      TurboAssembler::Ffint_s_uw(dst.fp(), src.gp());
14821cb0ef41Sopenharmony_ci      return true;
14831cb0ef41Sopenharmony_ci    case kExprF32ConvertF64:
14841cb0ef41Sopenharmony_ci      fcvt_s_d(dst.fp(), src.fp());
14851cb0ef41Sopenharmony_ci      return true;
14861cb0ef41Sopenharmony_ci    case kExprF32ReinterpretI32:
14871cb0ef41Sopenharmony_ci      TurboAssembler::FmoveLow(dst.fp(), src.gp());
14881cb0ef41Sopenharmony_ci      return true;
14891cb0ef41Sopenharmony_ci    case kExprF64SConvertI32: {
14901cb0ef41Sopenharmony_ci      LiftoffRegister scratch = GetUnusedRegister(kFpReg, LiftoffRegList{dst});
14911cb0ef41Sopenharmony_ci      movgr2fr_w(scratch.fp(), src.gp());
14921cb0ef41Sopenharmony_ci      ffint_d_w(dst.fp(), scratch.fp());
14931cb0ef41Sopenharmony_ci      return true;
14941cb0ef41Sopenharmony_ci    }
14951cb0ef41Sopenharmony_ci    case kExprF64UConvertI32:
14961cb0ef41Sopenharmony_ci      TurboAssembler::Ffint_d_uw(dst.fp(), src.gp());
14971cb0ef41Sopenharmony_ci      return true;
14981cb0ef41Sopenharmony_ci    case kExprF64ConvertF32:
14991cb0ef41Sopenharmony_ci      fcvt_d_s(dst.fp(), src.fp());
15001cb0ef41Sopenharmony_ci      return true;
15011cb0ef41Sopenharmony_ci    case kExprF64ReinterpretI64:
15021cb0ef41Sopenharmony_ci      movgr2fr_d(dst.fp(), src.gp());
15031cb0ef41Sopenharmony_ci      return true;
15041cb0ef41Sopenharmony_ci    case kExprI32SConvertSatF32:
15051cb0ef41Sopenharmony_ci      ftintrz_w_s(kScratchDoubleReg, src.fp());
15061cb0ef41Sopenharmony_ci      movfr2gr_s(dst.gp(), kScratchDoubleReg);
15071cb0ef41Sopenharmony_ci      return true;
15081cb0ef41Sopenharmony_ci    case kExprI32UConvertSatF32: {
15091cb0ef41Sopenharmony_ci      Label isnan_or_lessthan_or_equal_zero;
15101cb0ef41Sopenharmony_ci      mov(dst.gp(), zero_reg);
15111cb0ef41Sopenharmony_ci      TurboAssembler::Move(kScratchDoubleReg, static_cast<float>(0.0));
15121cb0ef41Sopenharmony_ci      CompareF32(src.fp(), kScratchDoubleReg, CULE);
15131cb0ef41Sopenharmony_ci      BranchTrueShortF(&isnan_or_lessthan_or_equal_zero);
15141cb0ef41Sopenharmony_ci      Ftintrz_uw_s(dst.gp(), src.fp(), kScratchDoubleReg);
15151cb0ef41Sopenharmony_ci      bind(&isnan_or_lessthan_or_equal_zero);
15161cb0ef41Sopenharmony_ci      return true;
15171cb0ef41Sopenharmony_ci    }
15181cb0ef41Sopenharmony_ci    case kExprI32SConvertSatF64:
15191cb0ef41Sopenharmony_ci      ftintrz_w_d(kScratchDoubleReg, src.fp());
15201cb0ef41Sopenharmony_ci      movfr2gr_s(dst.gp(), kScratchDoubleReg);
15211cb0ef41Sopenharmony_ci      return true;
15221cb0ef41Sopenharmony_ci    case kExprI32UConvertSatF64: {
15231cb0ef41Sopenharmony_ci      Label isnan_or_lessthan_or_equal_zero;
15241cb0ef41Sopenharmony_ci      mov(dst.gp(), zero_reg);
15251cb0ef41Sopenharmony_ci      TurboAssembler::Move(kScratchDoubleReg, static_cast<double>(0.0));
15261cb0ef41Sopenharmony_ci      CompareF64(src.fp(), kScratchDoubleReg, CULE);
15271cb0ef41Sopenharmony_ci      BranchTrueShortF(&isnan_or_lessthan_or_equal_zero);
15281cb0ef41Sopenharmony_ci      Ftintrz_uw_d(dst.gp(), src.fp(), kScratchDoubleReg);
15291cb0ef41Sopenharmony_ci      bind(&isnan_or_lessthan_or_equal_zero);
15301cb0ef41Sopenharmony_ci      return true;
15311cb0ef41Sopenharmony_ci    }
15321cb0ef41Sopenharmony_ci    case kExprI64SConvertSatF32:
15331cb0ef41Sopenharmony_ci      ftintrz_l_s(kScratchDoubleReg, src.fp());
15341cb0ef41Sopenharmony_ci      movfr2gr_d(dst.gp(), kScratchDoubleReg);
15351cb0ef41Sopenharmony_ci      return true;
15361cb0ef41Sopenharmony_ci    case kExprI64UConvertSatF32: {
15371cb0ef41Sopenharmony_ci      Label isnan_or_lessthan_or_equal_zero;
15381cb0ef41Sopenharmony_ci      mov(dst.gp(), zero_reg);
15391cb0ef41Sopenharmony_ci      TurboAssembler::Move(kScratchDoubleReg, static_cast<float>(0.0));
15401cb0ef41Sopenharmony_ci      CompareF32(src.fp(), kScratchDoubleReg, CULE);
15411cb0ef41Sopenharmony_ci      BranchTrueShortF(&isnan_or_lessthan_or_equal_zero);
15421cb0ef41Sopenharmony_ci      Ftintrz_ul_s(dst.gp(), src.fp(), kScratchDoubleReg);
15431cb0ef41Sopenharmony_ci      bind(&isnan_or_lessthan_or_equal_zero);
15441cb0ef41Sopenharmony_ci      return true;
15451cb0ef41Sopenharmony_ci    }
15461cb0ef41Sopenharmony_ci    case kExprI64SConvertSatF64:
15471cb0ef41Sopenharmony_ci      ftintrz_l_d(kScratchDoubleReg, src.fp());
15481cb0ef41Sopenharmony_ci      movfr2gr_d(dst.gp(), kScratchDoubleReg);
15491cb0ef41Sopenharmony_ci      return true;
15501cb0ef41Sopenharmony_ci    case kExprI64UConvertSatF64: {
15511cb0ef41Sopenharmony_ci      Label isnan_or_lessthan_or_equal_zero;
15521cb0ef41Sopenharmony_ci      mov(dst.gp(), zero_reg);
15531cb0ef41Sopenharmony_ci      TurboAssembler::Move(kScratchDoubleReg, static_cast<double>(0.0));
15541cb0ef41Sopenharmony_ci      CompareF64(src.fp(), kScratchDoubleReg, CULE);
15551cb0ef41Sopenharmony_ci      BranchTrueShortF(&isnan_or_lessthan_or_equal_zero);
15561cb0ef41Sopenharmony_ci      Ftintrz_ul_d(dst.gp(), src.fp(), kScratchDoubleReg);
15571cb0ef41Sopenharmony_ci      bind(&isnan_or_lessthan_or_equal_zero);
15581cb0ef41Sopenharmony_ci      return true;
15591cb0ef41Sopenharmony_ci    }
15601cb0ef41Sopenharmony_ci    default:
15611cb0ef41Sopenharmony_ci      return false;
15621cb0ef41Sopenharmony_ci  }
15631cb0ef41Sopenharmony_ci}
15641cb0ef41Sopenharmony_ci
15651cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32_signextend_i8(Register dst, Register src) {
15661cb0ef41Sopenharmony_ci  ext_w_b(dst, src);
15671cb0ef41Sopenharmony_ci}
15681cb0ef41Sopenharmony_ci
15691cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32_signextend_i16(Register dst, Register src) {
15701cb0ef41Sopenharmony_ci  ext_w_h(dst, src);
15711cb0ef41Sopenharmony_ci}
15721cb0ef41Sopenharmony_ci
15731cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64_signextend_i8(LiftoffRegister dst,
15741cb0ef41Sopenharmony_ci                                              LiftoffRegister src) {
15751cb0ef41Sopenharmony_ci  ext_w_b(dst.gp(), src.gp());
15761cb0ef41Sopenharmony_ci}
15771cb0ef41Sopenharmony_ci
15781cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64_signextend_i16(LiftoffRegister dst,
15791cb0ef41Sopenharmony_ci                                               LiftoffRegister src) {
15801cb0ef41Sopenharmony_ci  ext_w_h(dst.gp(), src.gp());
15811cb0ef41Sopenharmony_ci}
15821cb0ef41Sopenharmony_ci
15831cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64_signextend_i32(LiftoffRegister dst,
15841cb0ef41Sopenharmony_ci                                               LiftoffRegister src) {
15851cb0ef41Sopenharmony_ci  slli_w(dst.gp(), src.gp(), 0);
15861cb0ef41Sopenharmony_ci}
15871cb0ef41Sopenharmony_ci
15881cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_jump(Label* label) {
15891cb0ef41Sopenharmony_ci  TurboAssembler::Branch(label);
15901cb0ef41Sopenharmony_ci}
15911cb0ef41Sopenharmony_ci
15921cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_jump(Register target) {
15931cb0ef41Sopenharmony_ci  TurboAssembler::Jump(target);
15941cb0ef41Sopenharmony_ci}
15951cb0ef41Sopenharmony_ci
15961cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_cond_jump(LiftoffCondition liftoff_cond,
15971cb0ef41Sopenharmony_ci                                      Label* label, ValueKind kind,
15981cb0ef41Sopenharmony_ci                                      Register lhs, Register rhs) {
15991cb0ef41Sopenharmony_ci  Condition cond = liftoff::ToCondition(liftoff_cond);
16001cb0ef41Sopenharmony_ci  if (rhs == no_reg) {
16011cb0ef41Sopenharmony_ci    DCHECK(kind == kI32 || kind == kI64);
16021cb0ef41Sopenharmony_ci    TurboAssembler::Branch(label, cond, lhs, Operand(zero_reg));
16031cb0ef41Sopenharmony_ci  } else {
16041cb0ef41Sopenharmony_ci    DCHECK((kind == kI32 || kind == kI64) ||
16051cb0ef41Sopenharmony_ci           (is_reference(kind) &&
16061cb0ef41Sopenharmony_ci            (liftoff_cond == kEqual || liftoff_cond == kUnequal)));
16071cb0ef41Sopenharmony_ci    TurboAssembler::Branch(label, cond, lhs, Operand(rhs));
16081cb0ef41Sopenharmony_ci  }
16091cb0ef41Sopenharmony_ci}
16101cb0ef41Sopenharmony_ci
16111cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32_cond_jumpi(LiftoffCondition liftoff_cond,
16121cb0ef41Sopenharmony_ci                                           Label* label, Register lhs,
16131cb0ef41Sopenharmony_ci                                           int32_t imm) {
16141cb0ef41Sopenharmony_ci  Condition cond = liftoff::ToCondition(liftoff_cond);
16151cb0ef41Sopenharmony_ci  TurboAssembler::Branch(label, cond, lhs, Operand(imm));
16161cb0ef41Sopenharmony_ci}
16171cb0ef41Sopenharmony_ci
16181cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32_subi_jump_negative(Register value,
16191cb0ef41Sopenharmony_ci                                                   int subtrahend,
16201cb0ef41Sopenharmony_ci                                                   Label* result_negative) {
16211cb0ef41Sopenharmony_ci  TurboAssembler::Sub_d(value, value, Operand(subtrahend));
16221cb0ef41Sopenharmony_ci  TurboAssembler::Branch(result_negative, less, value, Operand(zero_reg));
16231cb0ef41Sopenharmony_ci}
16241cb0ef41Sopenharmony_ci
16251cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32_eqz(Register dst, Register src) {
16261cb0ef41Sopenharmony_ci  sltui(dst, src, 1);
16271cb0ef41Sopenharmony_ci}
16281cb0ef41Sopenharmony_ci
16291cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32_set_cond(LiftoffCondition liftoff_cond,
16301cb0ef41Sopenharmony_ci                                         Register dst, Register lhs,
16311cb0ef41Sopenharmony_ci                                         Register rhs) {
16321cb0ef41Sopenharmony_ci  Condition cond = liftoff::ToCondition(liftoff_cond);
16331cb0ef41Sopenharmony_ci  Register tmp = dst;
16341cb0ef41Sopenharmony_ci  if (dst == lhs || dst == rhs) {
16351cb0ef41Sopenharmony_ci    tmp = GetUnusedRegister(kGpReg, LiftoffRegList{lhs, rhs}).gp();
16361cb0ef41Sopenharmony_ci  }
16371cb0ef41Sopenharmony_ci  // Write 1 as result.
16381cb0ef41Sopenharmony_ci  TurboAssembler::li(tmp, 1);
16391cb0ef41Sopenharmony_ci
16401cb0ef41Sopenharmony_ci  // If negative condition is true, write 0 as result.
16411cb0ef41Sopenharmony_ci  Condition neg_cond = NegateCondition(cond);
16421cb0ef41Sopenharmony_ci  TurboAssembler::LoadZeroOnCondition(tmp, lhs, Operand(rhs), neg_cond);
16431cb0ef41Sopenharmony_ci
16441cb0ef41Sopenharmony_ci  // If tmp != dst, result will be moved.
16451cb0ef41Sopenharmony_ci  TurboAssembler::Move(dst, tmp);
16461cb0ef41Sopenharmony_ci}
16471cb0ef41Sopenharmony_ci
16481cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64_eqz(Register dst, LiftoffRegister src) {
16491cb0ef41Sopenharmony_ci  sltui(dst, src.gp(), 1);
16501cb0ef41Sopenharmony_ci}
16511cb0ef41Sopenharmony_ci
16521cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64_set_cond(LiftoffCondition liftoff_cond,
16531cb0ef41Sopenharmony_ci                                         Register dst, LiftoffRegister lhs,
16541cb0ef41Sopenharmony_ci                                         LiftoffRegister rhs) {
16551cb0ef41Sopenharmony_ci  Condition cond = liftoff::ToCondition(liftoff_cond);
16561cb0ef41Sopenharmony_ci  Register tmp = dst;
16571cb0ef41Sopenharmony_ci  if (dst == lhs.gp() || dst == rhs.gp()) {
16581cb0ef41Sopenharmony_ci    tmp = GetUnusedRegister(kGpReg, LiftoffRegList{lhs, rhs}).gp();
16591cb0ef41Sopenharmony_ci  }
16601cb0ef41Sopenharmony_ci  // Write 1 as result.
16611cb0ef41Sopenharmony_ci  TurboAssembler::li(tmp, 1);
16621cb0ef41Sopenharmony_ci
16631cb0ef41Sopenharmony_ci  // If negative condition is true, write 0 as result.
16641cb0ef41Sopenharmony_ci  Condition neg_cond = NegateCondition(cond);
16651cb0ef41Sopenharmony_ci  TurboAssembler::LoadZeroOnCondition(tmp, lhs.gp(), Operand(rhs.gp()),
16661cb0ef41Sopenharmony_ci                                      neg_cond);
16671cb0ef41Sopenharmony_ci
16681cb0ef41Sopenharmony_ci  // If tmp != dst, result will be moved.
16691cb0ef41Sopenharmony_ci  TurboAssembler::Move(dst, tmp);
16701cb0ef41Sopenharmony_ci}
16711cb0ef41Sopenharmony_ci
16721cb0ef41Sopenharmony_cinamespace liftoff {
16731cb0ef41Sopenharmony_ci
16741cb0ef41Sopenharmony_ciinline FPUCondition ConditionToConditionCmpFPU(LiftoffCondition condition,
16751cb0ef41Sopenharmony_ci                                               bool* predicate) {
16761cb0ef41Sopenharmony_ci  switch (condition) {
16771cb0ef41Sopenharmony_ci    case kEqual:
16781cb0ef41Sopenharmony_ci      *predicate = true;
16791cb0ef41Sopenharmony_ci      return CEQ;
16801cb0ef41Sopenharmony_ci    case kUnequal:
16811cb0ef41Sopenharmony_ci      *predicate = false;
16821cb0ef41Sopenharmony_ci      return CEQ;
16831cb0ef41Sopenharmony_ci    case kUnsignedLessThan:
16841cb0ef41Sopenharmony_ci      *predicate = true;
16851cb0ef41Sopenharmony_ci      return CLT;
16861cb0ef41Sopenharmony_ci    case kUnsignedGreaterEqual:
16871cb0ef41Sopenharmony_ci      *predicate = false;
16881cb0ef41Sopenharmony_ci      return CLT;
16891cb0ef41Sopenharmony_ci    case kUnsignedLessEqual:
16901cb0ef41Sopenharmony_ci      *predicate = true;
16911cb0ef41Sopenharmony_ci      return CLE;
16921cb0ef41Sopenharmony_ci    case kUnsignedGreaterThan:
16931cb0ef41Sopenharmony_ci      *predicate = false;
16941cb0ef41Sopenharmony_ci      return CLE;
16951cb0ef41Sopenharmony_ci    default:
16961cb0ef41Sopenharmony_ci      *predicate = true;
16971cb0ef41Sopenharmony_ci      break;
16981cb0ef41Sopenharmony_ci  }
16991cb0ef41Sopenharmony_ci  UNREACHABLE();
17001cb0ef41Sopenharmony_ci}
17011cb0ef41Sopenharmony_ci
17021cb0ef41Sopenharmony_ci}  // namespace liftoff
17031cb0ef41Sopenharmony_ci
17041cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32_set_cond(LiftoffCondition liftoff_cond,
17051cb0ef41Sopenharmony_ci                                         Register dst, DoubleRegister lhs,
17061cb0ef41Sopenharmony_ci                                         DoubleRegister rhs) {
17071cb0ef41Sopenharmony_ci  Condition cond = liftoff::ToCondition(liftoff_cond);
17081cb0ef41Sopenharmony_ci  Label not_nan, cont;
17091cb0ef41Sopenharmony_ci  TurboAssembler::CompareIsNanF32(lhs, rhs);
17101cb0ef41Sopenharmony_ci  TurboAssembler::BranchFalseF(&not_nan);
17111cb0ef41Sopenharmony_ci  // If one of the operands is NaN, return 1 for f32.ne, else 0.
17121cb0ef41Sopenharmony_ci  if (cond == ne) {
17131cb0ef41Sopenharmony_ci    TurboAssembler::li(dst, 1);
17141cb0ef41Sopenharmony_ci  } else {
17151cb0ef41Sopenharmony_ci    TurboAssembler::Move(dst, zero_reg);
17161cb0ef41Sopenharmony_ci  }
17171cb0ef41Sopenharmony_ci  TurboAssembler::Branch(&cont);
17181cb0ef41Sopenharmony_ci
17191cb0ef41Sopenharmony_ci  bind(&not_nan);
17201cb0ef41Sopenharmony_ci
17211cb0ef41Sopenharmony_ci  TurboAssembler::li(dst, 1);
17221cb0ef41Sopenharmony_ci  bool predicate;
17231cb0ef41Sopenharmony_ci  FPUCondition fcond =
17241cb0ef41Sopenharmony_ci      liftoff::ConditionToConditionCmpFPU(liftoff_cond, &predicate);
17251cb0ef41Sopenharmony_ci  TurboAssembler::CompareF32(lhs, rhs, fcond);
17261cb0ef41Sopenharmony_ci  if (predicate) {
17271cb0ef41Sopenharmony_ci    TurboAssembler::LoadZeroIfNotFPUCondition(dst);
17281cb0ef41Sopenharmony_ci  } else {
17291cb0ef41Sopenharmony_ci    TurboAssembler::LoadZeroIfFPUCondition(dst);
17301cb0ef41Sopenharmony_ci  }
17311cb0ef41Sopenharmony_ci
17321cb0ef41Sopenharmony_ci  bind(&cont);
17331cb0ef41Sopenharmony_ci}
17341cb0ef41Sopenharmony_ci
17351cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64_set_cond(LiftoffCondition liftoff_cond,
17361cb0ef41Sopenharmony_ci                                         Register dst, DoubleRegister lhs,
17371cb0ef41Sopenharmony_ci                                         DoubleRegister rhs) {
17381cb0ef41Sopenharmony_ci  Condition cond = liftoff::ToCondition(liftoff_cond);
17391cb0ef41Sopenharmony_ci  Label not_nan, cont;
17401cb0ef41Sopenharmony_ci  TurboAssembler::CompareIsNanF64(lhs, rhs);
17411cb0ef41Sopenharmony_ci  TurboAssembler::BranchFalseF(&not_nan);
17421cb0ef41Sopenharmony_ci  // If one of the operands is NaN, return 1 for f64.ne, else 0.
17431cb0ef41Sopenharmony_ci  if (cond == ne) {
17441cb0ef41Sopenharmony_ci    TurboAssembler::li(dst, 1);
17451cb0ef41Sopenharmony_ci  } else {
17461cb0ef41Sopenharmony_ci    TurboAssembler::Move(dst, zero_reg);
17471cb0ef41Sopenharmony_ci  }
17481cb0ef41Sopenharmony_ci  TurboAssembler::Branch(&cont);
17491cb0ef41Sopenharmony_ci
17501cb0ef41Sopenharmony_ci  bind(&not_nan);
17511cb0ef41Sopenharmony_ci
17521cb0ef41Sopenharmony_ci  TurboAssembler::li(dst, 1);
17531cb0ef41Sopenharmony_ci  bool predicate;
17541cb0ef41Sopenharmony_ci  FPUCondition fcond =
17551cb0ef41Sopenharmony_ci      liftoff::ConditionToConditionCmpFPU(liftoff_cond, &predicate);
17561cb0ef41Sopenharmony_ci  TurboAssembler::CompareF64(lhs, rhs, fcond);
17571cb0ef41Sopenharmony_ci  if (predicate) {
17581cb0ef41Sopenharmony_ci    TurboAssembler::LoadZeroIfNotFPUCondition(dst);
17591cb0ef41Sopenharmony_ci  } else {
17601cb0ef41Sopenharmony_ci    TurboAssembler::LoadZeroIfFPUCondition(dst);
17611cb0ef41Sopenharmony_ci  }
17621cb0ef41Sopenharmony_ci
17631cb0ef41Sopenharmony_ci  bind(&cont);
17641cb0ef41Sopenharmony_ci}
17651cb0ef41Sopenharmony_ci
17661cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_select(LiftoffRegister dst, Register condition,
17671cb0ef41Sopenharmony_ci                                   LiftoffRegister true_value,
17681cb0ef41Sopenharmony_ci                                   LiftoffRegister false_value,
17691cb0ef41Sopenharmony_ci                                   ValueKind kind) {
17701cb0ef41Sopenharmony_ci  return false;
17711cb0ef41Sopenharmony_ci}
17721cb0ef41Sopenharmony_ci
17731cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_smi_check(Register obj, Label* target,
17741cb0ef41Sopenharmony_ci                                      SmiCheckMode mode) {
17751cb0ef41Sopenharmony_ci  UseScratchRegisterScope temps(this);
17761cb0ef41Sopenharmony_ci  Register scratch = temps.Acquire();
17771cb0ef41Sopenharmony_ci  And(scratch, obj, Operand(kSmiTagMask));
17781cb0ef41Sopenharmony_ci  Condition condition = mode == kJumpOnSmi ? eq : ne;
17791cb0ef41Sopenharmony_ci  Branch(target, condition, scratch, Operand(zero_reg));
17801cb0ef41Sopenharmony_ci}
17811cb0ef41Sopenharmony_ci
17821cb0ef41Sopenharmony_civoid LiftoffAssembler::LoadTransform(LiftoffRegister dst, Register src_addr,
17831cb0ef41Sopenharmony_ci                                     Register offset_reg, uintptr_t offset_imm,
17841cb0ef41Sopenharmony_ci                                     LoadType type,
17851cb0ef41Sopenharmony_ci                                     LoadTransformationKind transform,
17861cb0ef41Sopenharmony_ci                                     uint32_t* protected_load_pc) {
17871cb0ef41Sopenharmony_ci  bailout(kSimd, "load extend and load splat unimplemented");
17881cb0ef41Sopenharmony_ci}
17891cb0ef41Sopenharmony_ci
17901cb0ef41Sopenharmony_civoid LiftoffAssembler::LoadLane(LiftoffRegister dst, LiftoffRegister src,
17911cb0ef41Sopenharmony_ci                                Register addr, Register offset_reg,
17921cb0ef41Sopenharmony_ci                                uintptr_t offset_imm, LoadType type,
17931cb0ef41Sopenharmony_ci                                uint8_t laneidx, uint32_t* protected_load_pc) {
17941cb0ef41Sopenharmony_ci  bailout(kSimd, "loadlane");
17951cb0ef41Sopenharmony_ci}
17961cb0ef41Sopenharmony_ci
17971cb0ef41Sopenharmony_civoid LiftoffAssembler::StoreLane(Register dst, Register offset,
17981cb0ef41Sopenharmony_ci                                 uintptr_t offset_imm, LiftoffRegister src,
17991cb0ef41Sopenharmony_ci                                 StoreType type, uint8_t lane,
18001cb0ef41Sopenharmony_ci                                 uint32_t* protected_store_pc) {
18011cb0ef41Sopenharmony_ci  bailout(kSimd, "storelane");
18021cb0ef41Sopenharmony_ci}
18031cb0ef41Sopenharmony_ci
18041cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_shuffle(LiftoffRegister dst,
18051cb0ef41Sopenharmony_ci                                          LiftoffRegister lhs,
18061cb0ef41Sopenharmony_ci                                          LiftoffRegister rhs,
18071cb0ef41Sopenharmony_ci                                          const uint8_t shuffle[16],
18081cb0ef41Sopenharmony_ci                                          bool is_swizzle) {
18091cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_shuffle");
18101cb0ef41Sopenharmony_ci}
18111cb0ef41Sopenharmony_ci
18121cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_swizzle(LiftoffRegister dst,
18131cb0ef41Sopenharmony_ci                                          LiftoffRegister lhs,
18141cb0ef41Sopenharmony_ci                                          LiftoffRegister rhs) {
18151cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_swizzle");
18161cb0ef41Sopenharmony_ci}
18171cb0ef41Sopenharmony_ci
18181cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_splat(LiftoffRegister dst,
18191cb0ef41Sopenharmony_ci                                        LiftoffRegister src) {
18201cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_splat");
18211cb0ef41Sopenharmony_ci}
18221cb0ef41Sopenharmony_ci
18231cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_splat(LiftoffRegister dst,
18241cb0ef41Sopenharmony_ci                                        LiftoffRegister src) {
18251cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_splat");
18261cb0ef41Sopenharmony_ci}
18271cb0ef41Sopenharmony_ci
18281cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_splat(LiftoffRegister dst,
18291cb0ef41Sopenharmony_ci                                        LiftoffRegister src) {
18301cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_splat");
18311cb0ef41Sopenharmony_ci}
18321cb0ef41Sopenharmony_ci
18331cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_splat(LiftoffRegister dst,
18341cb0ef41Sopenharmony_ci                                        LiftoffRegister src) {
18351cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_splat");
18361cb0ef41Sopenharmony_ci}
18371cb0ef41Sopenharmony_ci
18381cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_splat(LiftoffRegister dst,
18391cb0ef41Sopenharmony_ci                                        LiftoffRegister src) {
18401cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_splat");
18411cb0ef41Sopenharmony_ci}
18421cb0ef41Sopenharmony_ci
18431cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_splat(LiftoffRegister dst,
18441cb0ef41Sopenharmony_ci                                        LiftoffRegister src) {
18451cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_splat");
18461cb0ef41Sopenharmony_ci}
18471cb0ef41Sopenharmony_ci
18481cb0ef41Sopenharmony_ci#define SIMD_BINOP(name1, name2)                                         \
18491cb0ef41Sopenharmony_ci  void LiftoffAssembler::emit_##name1##_extmul_low_##name2(              \
18501cb0ef41Sopenharmony_ci      LiftoffRegister dst, LiftoffRegister src1, LiftoffRegister src2) { \
18511cb0ef41Sopenharmony_ci    bailout(kSimd, "emit_" #name1 "_extmul_low_" #name2);                \
18521cb0ef41Sopenharmony_ci  }                                                                      \
18531cb0ef41Sopenharmony_ci  void LiftoffAssembler::emit_##name1##_extmul_high_##name2(             \
18541cb0ef41Sopenharmony_ci      LiftoffRegister dst, LiftoffRegister src1, LiftoffRegister src2) { \
18551cb0ef41Sopenharmony_ci    bailout(kSimd, "emit_" #name1 "_extmul_high_" #name2);               \
18561cb0ef41Sopenharmony_ci  }
18571cb0ef41Sopenharmony_ci
18581cb0ef41Sopenharmony_ciSIMD_BINOP(i16x8, i8x16_s)
18591cb0ef41Sopenharmony_ciSIMD_BINOP(i16x8, i8x16_u)
18601cb0ef41Sopenharmony_ci
18611cb0ef41Sopenharmony_ciSIMD_BINOP(i32x4, i16x8_s)
18621cb0ef41Sopenharmony_ciSIMD_BINOP(i32x4, i16x8_u)
18631cb0ef41Sopenharmony_ci
18641cb0ef41Sopenharmony_ciSIMD_BINOP(i64x2, i32x4_s)
18651cb0ef41Sopenharmony_ciSIMD_BINOP(i64x2, i32x4_u)
18661cb0ef41Sopenharmony_ci
18671cb0ef41Sopenharmony_ci#undef SIMD_BINOP
18681cb0ef41Sopenharmony_ci
18691cb0ef41Sopenharmony_ci#define SIMD_BINOP(name1, name2)                                 \
18701cb0ef41Sopenharmony_ci  void LiftoffAssembler::emit_##name1##_extadd_pairwise_##name2( \
18711cb0ef41Sopenharmony_ci      LiftoffRegister dst, LiftoffRegister src) {                \
18721cb0ef41Sopenharmony_ci    bailout(kSimd, "emit_" #name1 "_extadd_pairwise_" #name2);   \
18731cb0ef41Sopenharmony_ci  }
18741cb0ef41Sopenharmony_ci
18751cb0ef41Sopenharmony_ciSIMD_BINOP(i16x8, i8x16_s)
18761cb0ef41Sopenharmony_ciSIMD_BINOP(i16x8, i8x16_u)
18771cb0ef41Sopenharmony_ciSIMD_BINOP(i32x4, i16x8_s)
18781cb0ef41Sopenharmony_ciSIMD_BINOP(i32x4, i16x8_u)
18791cb0ef41Sopenharmony_ci#undef SIMD_BINOP
18801cb0ef41Sopenharmony_ci
18811cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_q15mulr_sat_s(LiftoffRegister dst,
18821cb0ef41Sopenharmony_ci                                                LiftoffRegister src1,
18831cb0ef41Sopenharmony_ci                                                LiftoffRegister src2) {
18841cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_q15mulr_sat_s");
18851cb0ef41Sopenharmony_ci}
18861cb0ef41Sopenharmony_ci
18871cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_eq(LiftoffRegister dst, LiftoffRegister lhs,
18881cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
18891cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_eq");
18901cb0ef41Sopenharmony_ci}
18911cb0ef41Sopenharmony_ci
18921cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_ne(LiftoffRegister dst, LiftoffRegister lhs,
18931cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
18941cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_ne");
18951cb0ef41Sopenharmony_ci}
18961cb0ef41Sopenharmony_ci
18971cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
18981cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
18991cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_gt_s");
19001cb0ef41Sopenharmony_ci}
19011cb0ef41Sopenharmony_ci
19021cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
19031cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
19041cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_gt_u");
19051cb0ef41Sopenharmony_ci}
19061cb0ef41Sopenharmony_ci
19071cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
19081cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
19091cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_ge_s");
19101cb0ef41Sopenharmony_ci}
19111cb0ef41Sopenharmony_ci
19121cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_ge_u(LiftoffRegister dst, LiftoffRegister lhs,
19131cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
19141cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_ge_u");
19151cb0ef41Sopenharmony_ci}
19161cb0ef41Sopenharmony_ci
19171cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_eq(LiftoffRegister dst, LiftoffRegister lhs,
19181cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
19191cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_eq");
19201cb0ef41Sopenharmony_ci}
19211cb0ef41Sopenharmony_ci
19221cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_ne(LiftoffRegister dst, LiftoffRegister lhs,
19231cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
19241cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_ne");
19251cb0ef41Sopenharmony_ci}
19261cb0ef41Sopenharmony_ci
19271cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
19281cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
19291cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_gt_s");
19301cb0ef41Sopenharmony_ci}
19311cb0ef41Sopenharmony_ci
19321cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
19331cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
19341cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_gt_u");
19351cb0ef41Sopenharmony_ci}
19361cb0ef41Sopenharmony_ci
19371cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
19381cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
19391cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_ge_s");
19401cb0ef41Sopenharmony_ci}
19411cb0ef41Sopenharmony_ci
19421cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_ge_u(LiftoffRegister dst, LiftoffRegister lhs,
19431cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
19441cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_ge_u");
19451cb0ef41Sopenharmony_ci}
19461cb0ef41Sopenharmony_ci
19471cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_eq(LiftoffRegister dst, LiftoffRegister lhs,
19481cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
19491cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_eq");
19501cb0ef41Sopenharmony_ci}
19511cb0ef41Sopenharmony_ci
19521cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_ne(LiftoffRegister dst, LiftoffRegister lhs,
19531cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
19541cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_ne");
19551cb0ef41Sopenharmony_ci}
19561cb0ef41Sopenharmony_ci
19571cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
19581cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
19591cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_gt_s");
19601cb0ef41Sopenharmony_ci}
19611cb0ef41Sopenharmony_ci
19621cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
19631cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
19641cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_gt_u");
19651cb0ef41Sopenharmony_ci}
19661cb0ef41Sopenharmony_ci
19671cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
19681cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
19691cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_ge_s");
19701cb0ef41Sopenharmony_ci}
19711cb0ef41Sopenharmony_ci
19721cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_ge_u(LiftoffRegister dst, LiftoffRegister lhs,
19731cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
19741cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_ge_u");
19751cb0ef41Sopenharmony_ci}
19761cb0ef41Sopenharmony_ci
19771cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_eq(LiftoffRegister dst, LiftoffRegister lhs,
19781cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
19791cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_eq");
19801cb0ef41Sopenharmony_ci}
19811cb0ef41Sopenharmony_ci
19821cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_ne(LiftoffRegister dst, LiftoffRegister lhs,
19831cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
19841cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_ne");
19851cb0ef41Sopenharmony_ci}
19861cb0ef41Sopenharmony_ci
19871cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_lt(LiftoffRegister dst, LiftoffRegister lhs,
19881cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
19891cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_lt");
19901cb0ef41Sopenharmony_ci}
19911cb0ef41Sopenharmony_ci
19921cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_le(LiftoffRegister dst, LiftoffRegister lhs,
19931cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
19941cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_le");
19951cb0ef41Sopenharmony_ci}
19961cb0ef41Sopenharmony_ci
19971cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_eq(LiftoffRegister dst, LiftoffRegister lhs,
19981cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
19991cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_eq");
20001cb0ef41Sopenharmony_ci}
20011cb0ef41Sopenharmony_ci
20021cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_ne(LiftoffRegister dst, LiftoffRegister lhs,
20031cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
20041cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_ne");
20051cb0ef41Sopenharmony_ci}
20061cb0ef41Sopenharmony_ci
20071cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_abs(LiftoffRegister dst,
20081cb0ef41Sopenharmony_ci                                      LiftoffRegister src) {
20091cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_abs");
20101cb0ef41Sopenharmony_ci}
20111cb0ef41Sopenharmony_ci
20121cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_eq(LiftoffRegister dst, LiftoffRegister lhs,
20131cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
20141cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_eq");
20151cb0ef41Sopenharmony_ci}
20161cb0ef41Sopenharmony_ci
20171cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_ne(LiftoffRegister dst, LiftoffRegister lhs,
20181cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
20191cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_ne");
20201cb0ef41Sopenharmony_ci}
20211cb0ef41Sopenharmony_ci
20221cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_lt(LiftoffRegister dst, LiftoffRegister lhs,
20231cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
20241cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_lt");
20251cb0ef41Sopenharmony_ci}
20261cb0ef41Sopenharmony_ci
20271cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_le(LiftoffRegister dst, LiftoffRegister lhs,
20281cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
20291cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_le");
20301cb0ef41Sopenharmony_ci}
20311cb0ef41Sopenharmony_ci
20321cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_s128_const(LiftoffRegister dst,
20331cb0ef41Sopenharmony_ci                                       const uint8_t imms[16]) {
20341cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_s128_const");
20351cb0ef41Sopenharmony_ci}
20361cb0ef41Sopenharmony_ci
20371cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_s128_not(LiftoffRegister dst, LiftoffRegister src) {
20381cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_s128_not");
20391cb0ef41Sopenharmony_ci}
20401cb0ef41Sopenharmony_ci
20411cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_s128_and(LiftoffRegister dst, LiftoffRegister lhs,
20421cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
20431cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_s128_and");
20441cb0ef41Sopenharmony_ci}
20451cb0ef41Sopenharmony_ci
20461cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_s128_or(LiftoffRegister dst, LiftoffRegister lhs,
20471cb0ef41Sopenharmony_ci                                    LiftoffRegister rhs) {
20481cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_s128_or");
20491cb0ef41Sopenharmony_ci}
20501cb0ef41Sopenharmony_ci
20511cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_s128_xor(LiftoffRegister dst, LiftoffRegister lhs,
20521cb0ef41Sopenharmony_ci                                     LiftoffRegister rhs) {
20531cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_s128_xor");
20541cb0ef41Sopenharmony_ci}
20551cb0ef41Sopenharmony_ci
20561cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_s128_and_not(LiftoffRegister dst,
20571cb0ef41Sopenharmony_ci                                         LiftoffRegister lhs,
20581cb0ef41Sopenharmony_ci                                         LiftoffRegister rhs) {
20591cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_s128_and_not");
20601cb0ef41Sopenharmony_ci}
20611cb0ef41Sopenharmony_ci
20621cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_s128_select(LiftoffRegister dst,
20631cb0ef41Sopenharmony_ci                                        LiftoffRegister src1,
20641cb0ef41Sopenharmony_ci                                        LiftoffRegister src2,
20651cb0ef41Sopenharmony_ci                                        LiftoffRegister mask) {
20661cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_s128_select");
20671cb0ef41Sopenharmony_ci}
20681cb0ef41Sopenharmony_ci
20691cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_neg(LiftoffRegister dst,
20701cb0ef41Sopenharmony_ci                                      LiftoffRegister src) {
20711cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_neg");
20721cb0ef41Sopenharmony_ci}
20731cb0ef41Sopenharmony_ci
20741cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_v128_anytrue(LiftoffRegister dst,
20751cb0ef41Sopenharmony_ci                                         LiftoffRegister src) {
20761cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_v128_anytrue");
20771cb0ef41Sopenharmony_ci}
20781cb0ef41Sopenharmony_ci
20791cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_alltrue(LiftoffRegister dst,
20801cb0ef41Sopenharmony_ci                                          LiftoffRegister src) {
20811cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_alltrue");
20821cb0ef41Sopenharmony_ci}
20831cb0ef41Sopenharmony_ci
20841cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_bitmask(LiftoffRegister dst,
20851cb0ef41Sopenharmony_ci                                          LiftoffRegister src) {
20861cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_bitmask");
20871cb0ef41Sopenharmony_ci}
20881cb0ef41Sopenharmony_ci
20891cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_shl(LiftoffRegister dst, LiftoffRegister lhs,
20901cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
20911cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_shl");
20921cb0ef41Sopenharmony_ci}
20931cb0ef41Sopenharmony_ci
20941cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_shli(LiftoffRegister dst, LiftoffRegister lhs,
20951cb0ef41Sopenharmony_ci                                       int32_t rhs) {
20961cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_shli");
20971cb0ef41Sopenharmony_ci}
20981cb0ef41Sopenharmony_ci
20991cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_shr_s(LiftoffRegister dst,
21001cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
21011cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
21021cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_shr_s");
21031cb0ef41Sopenharmony_ci}
21041cb0ef41Sopenharmony_ci
21051cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_shri_s(LiftoffRegister dst,
21061cb0ef41Sopenharmony_ci                                         LiftoffRegister lhs, int32_t rhs) {
21071cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_shri_s");
21081cb0ef41Sopenharmony_ci}
21091cb0ef41Sopenharmony_ci
21101cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_shr_u(LiftoffRegister dst,
21111cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
21121cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
21131cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_shr_u");
21141cb0ef41Sopenharmony_ci}
21151cb0ef41Sopenharmony_ci
21161cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_shri_u(LiftoffRegister dst,
21171cb0ef41Sopenharmony_ci                                         LiftoffRegister lhs, int32_t rhs) {
21181cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_shri_u");
21191cb0ef41Sopenharmony_ci}
21201cb0ef41Sopenharmony_ci
21211cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_add(LiftoffRegister dst, LiftoffRegister lhs,
21221cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
21231cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_add");
21241cb0ef41Sopenharmony_ci}
21251cb0ef41Sopenharmony_ci
21261cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_add_sat_s(LiftoffRegister dst,
21271cb0ef41Sopenharmony_ci                                            LiftoffRegister lhs,
21281cb0ef41Sopenharmony_ci                                            LiftoffRegister rhs) {
21291cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_add_sat_s");
21301cb0ef41Sopenharmony_ci}
21311cb0ef41Sopenharmony_ci
21321cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_add_sat_u(LiftoffRegister dst,
21331cb0ef41Sopenharmony_ci                                            LiftoffRegister lhs,
21341cb0ef41Sopenharmony_ci                                            LiftoffRegister rhs) {
21351cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_add_sat_u");
21361cb0ef41Sopenharmony_ci}
21371cb0ef41Sopenharmony_ci
21381cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_sub(LiftoffRegister dst, LiftoffRegister lhs,
21391cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
21401cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_sub");
21411cb0ef41Sopenharmony_ci}
21421cb0ef41Sopenharmony_ci
21431cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_sub_sat_s(LiftoffRegister dst,
21441cb0ef41Sopenharmony_ci                                            LiftoffRegister lhs,
21451cb0ef41Sopenharmony_ci                                            LiftoffRegister rhs) {
21461cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_sub_sat_s");
21471cb0ef41Sopenharmony_ci}
21481cb0ef41Sopenharmony_ci
21491cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_sub_sat_u(LiftoffRegister dst,
21501cb0ef41Sopenharmony_ci                                            LiftoffRegister lhs,
21511cb0ef41Sopenharmony_ci                                            LiftoffRegister rhs) {
21521cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_sub_sat_u");
21531cb0ef41Sopenharmony_ci}
21541cb0ef41Sopenharmony_ci
21551cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_min_s(LiftoffRegister dst,
21561cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
21571cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
21581cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_min_s");
21591cb0ef41Sopenharmony_ci}
21601cb0ef41Sopenharmony_ci
21611cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_min_u(LiftoffRegister dst,
21621cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
21631cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
21641cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_min_u");
21651cb0ef41Sopenharmony_ci}
21661cb0ef41Sopenharmony_ci
21671cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_max_s(LiftoffRegister dst,
21681cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
21691cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
21701cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_max_s");
21711cb0ef41Sopenharmony_ci}
21721cb0ef41Sopenharmony_ci
21731cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_max_u(LiftoffRegister dst,
21741cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
21751cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
21761cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_max_u");
21771cb0ef41Sopenharmony_ci}
21781cb0ef41Sopenharmony_ci
21791cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_popcnt(LiftoffRegister dst,
21801cb0ef41Sopenharmony_ci                                         LiftoffRegister src) {
21811cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_popcnt");
21821cb0ef41Sopenharmony_ci}
21831cb0ef41Sopenharmony_ci
21841cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_neg(LiftoffRegister dst,
21851cb0ef41Sopenharmony_ci                                      LiftoffRegister src) {
21861cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_neg");
21871cb0ef41Sopenharmony_ci}
21881cb0ef41Sopenharmony_ci
21891cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_alltrue(LiftoffRegister dst,
21901cb0ef41Sopenharmony_ci                                          LiftoffRegister src) {
21911cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_alltrue");
21921cb0ef41Sopenharmony_ci}
21931cb0ef41Sopenharmony_ci
21941cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_bitmask(LiftoffRegister dst,
21951cb0ef41Sopenharmony_ci                                          LiftoffRegister src) {
21961cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_bitmask");
21971cb0ef41Sopenharmony_ci}
21981cb0ef41Sopenharmony_ci
21991cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_shl(LiftoffRegister dst, LiftoffRegister lhs,
22001cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
22011cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_shl");
22021cb0ef41Sopenharmony_ci}
22031cb0ef41Sopenharmony_ci
22041cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_shli(LiftoffRegister dst, LiftoffRegister lhs,
22051cb0ef41Sopenharmony_ci                                       int32_t rhs) {
22061cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_shli");
22071cb0ef41Sopenharmony_ci}
22081cb0ef41Sopenharmony_ci
22091cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_shr_s(LiftoffRegister dst,
22101cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
22111cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
22121cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_shr_s");
22131cb0ef41Sopenharmony_ci}
22141cb0ef41Sopenharmony_ci
22151cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_shri_s(LiftoffRegister dst,
22161cb0ef41Sopenharmony_ci                                         LiftoffRegister lhs, int32_t rhs) {
22171cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_shri_s");
22181cb0ef41Sopenharmony_ci}
22191cb0ef41Sopenharmony_ci
22201cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_shr_u(LiftoffRegister dst,
22211cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
22221cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
22231cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_shr_u");
22241cb0ef41Sopenharmony_ci}
22251cb0ef41Sopenharmony_ci
22261cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_shri_u(LiftoffRegister dst,
22271cb0ef41Sopenharmony_ci                                         LiftoffRegister lhs, int32_t rhs) {
22281cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_shri_u");
22291cb0ef41Sopenharmony_ci}
22301cb0ef41Sopenharmony_ci
22311cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_add(LiftoffRegister dst, LiftoffRegister lhs,
22321cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
22331cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_add");
22341cb0ef41Sopenharmony_ci}
22351cb0ef41Sopenharmony_ci
22361cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_add_sat_s(LiftoffRegister dst,
22371cb0ef41Sopenharmony_ci                                            LiftoffRegister lhs,
22381cb0ef41Sopenharmony_ci                                            LiftoffRegister rhs) {
22391cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_add_sat_s");
22401cb0ef41Sopenharmony_ci}
22411cb0ef41Sopenharmony_ci
22421cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_add_sat_u(LiftoffRegister dst,
22431cb0ef41Sopenharmony_ci                                            LiftoffRegister lhs,
22441cb0ef41Sopenharmony_ci                                            LiftoffRegister rhs) {
22451cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_add_sat_u");
22461cb0ef41Sopenharmony_ci}
22471cb0ef41Sopenharmony_ci
22481cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_sub(LiftoffRegister dst, LiftoffRegister lhs,
22491cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
22501cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_sub");
22511cb0ef41Sopenharmony_ci}
22521cb0ef41Sopenharmony_ci
22531cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_sub_sat_s(LiftoffRegister dst,
22541cb0ef41Sopenharmony_ci                                            LiftoffRegister lhs,
22551cb0ef41Sopenharmony_ci                                            LiftoffRegister rhs) {
22561cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_sub_sat_s");
22571cb0ef41Sopenharmony_ci}
22581cb0ef41Sopenharmony_ci
22591cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_sub_sat_u(LiftoffRegister dst,
22601cb0ef41Sopenharmony_ci                                            LiftoffRegister lhs,
22611cb0ef41Sopenharmony_ci                                            LiftoffRegister rhs) {
22621cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_sub_sat_u");
22631cb0ef41Sopenharmony_ci}
22641cb0ef41Sopenharmony_ci
22651cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_mul(LiftoffRegister dst, LiftoffRegister lhs,
22661cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
22671cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_mul");
22681cb0ef41Sopenharmony_ci}
22691cb0ef41Sopenharmony_ci
22701cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_min_s(LiftoffRegister dst,
22711cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
22721cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
22731cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_min_s");
22741cb0ef41Sopenharmony_ci}
22751cb0ef41Sopenharmony_ci
22761cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_min_u(LiftoffRegister dst,
22771cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
22781cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
22791cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_min_u");
22801cb0ef41Sopenharmony_ci}
22811cb0ef41Sopenharmony_ci
22821cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_max_s(LiftoffRegister dst,
22831cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
22841cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
22851cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_max_s");
22861cb0ef41Sopenharmony_ci}
22871cb0ef41Sopenharmony_ci
22881cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_max_u(LiftoffRegister dst,
22891cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
22901cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
22911cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_max_u");
22921cb0ef41Sopenharmony_ci}
22931cb0ef41Sopenharmony_ci
22941cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_neg(LiftoffRegister dst,
22951cb0ef41Sopenharmony_ci                                      LiftoffRegister src) {
22961cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_neg");
22971cb0ef41Sopenharmony_ci}
22981cb0ef41Sopenharmony_ci
22991cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_alltrue(LiftoffRegister dst,
23001cb0ef41Sopenharmony_ci                                          LiftoffRegister src) {
23011cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_alltrue");
23021cb0ef41Sopenharmony_ci}
23031cb0ef41Sopenharmony_ci
23041cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_bitmask(LiftoffRegister dst,
23051cb0ef41Sopenharmony_ci                                          LiftoffRegister src) {
23061cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_bitmask");
23071cb0ef41Sopenharmony_ci}
23081cb0ef41Sopenharmony_ci
23091cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_shl(LiftoffRegister dst, LiftoffRegister lhs,
23101cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
23111cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_shl");
23121cb0ef41Sopenharmony_ci}
23131cb0ef41Sopenharmony_ci
23141cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_shli(LiftoffRegister dst, LiftoffRegister lhs,
23151cb0ef41Sopenharmony_ci                                       int32_t rhs) {
23161cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_shli");
23171cb0ef41Sopenharmony_ci}
23181cb0ef41Sopenharmony_ci
23191cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_shr_s(LiftoffRegister dst,
23201cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
23211cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
23221cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_shr_s");
23231cb0ef41Sopenharmony_ci}
23241cb0ef41Sopenharmony_ci
23251cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_shri_s(LiftoffRegister dst,
23261cb0ef41Sopenharmony_ci                                         LiftoffRegister lhs, int32_t rhs) {
23271cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_shri_s");
23281cb0ef41Sopenharmony_ci}
23291cb0ef41Sopenharmony_ci
23301cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_shr_u(LiftoffRegister dst,
23311cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
23321cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
23331cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_shr_u");
23341cb0ef41Sopenharmony_ci}
23351cb0ef41Sopenharmony_ci
23361cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_shri_u(LiftoffRegister dst,
23371cb0ef41Sopenharmony_ci                                         LiftoffRegister lhs, int32_t rhs) {
23381cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_shri_u");
23391cb0ef41Sopenharmony_ci}
23401cb0ef41Sopenharmony_ci
23411cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_add(LiftoffRegister dst, LiftoffRegister lhs,
23421cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
23431cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_add");
23441cb0ef41Sopenharmony_ci}
23451cb0ef41Sopenharmony_ci
23461cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_sub(LiftoffRegister dst, LiftoffRegister lhs,
23471cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
23481cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_sub");
23491cb0ef41Sopenharmony_ci}
23501cb0ef41Sopenharmony_ci
23511cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_mul(LiftoffRegister dst, LiftoffRegister lhs,
23521cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
23531cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_mul");
23541cb0ef41Sopenharmony_ci}
23551cb0ef41Sopenharmony_ci
23561cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_min_s(LiftoffRegister dst,
23571cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
23581cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
23591cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_min_s");
23601cb0ef41Sopenharmony_ci}
23611cb0ef41Sopenharmony_ci
23621cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_min_u(LiftoffRegister dst,
23631cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
23641cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
23651cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_min_u");
23661cb0ef41Sopenharmony_ci}
23671cb0ef41Sopenharmony_ci
23681cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_max_s(LiftoffRegister dst,
23691cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
23701cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
23711cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_max_s");
23721cb0ef41Sopenharmony_ci}
23731cb0ef41Sopenharmony_ci
23741cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_max_u(LiftoffRegister dst,
23751cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
23761cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
23771cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_max_u");
23781cb0ef41Sopenharmony_ci}
23791cb0ef41Sopenharmony_ci
23801cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_dot_i16x8_s(LiftoffRegister dst,
23811cb0ef41Sopenharmony_ci                                              LiftoffRegister lhs,
23821cb0ef41Sopenharmony_ci                                              LiftoffRegister rhs) {
23831cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_dot_i16x8_s");
23841cb0ef41Sopenharmony_ci}
23851cb0ef41Sopenharmony_ci
23861cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_neg(LiftoffRegister dst,
23871cb0ef41Sopenharmony_ci                                      LiftoffRegister src) {
23881cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_neg");
23891cb0ef41Sopenharmony_ci}
23901cb0ef41Sopenharmony_ci
23911cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_alltrue(LiftoffRegister dst,
23921cb0ef41Sopenharmony_ci                                          LiftoffRegister src) {
23931cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_alltrue");
23941cb0ef41Sopenharmony_ci}
23951cb0ef41Sopenharmony_ci
23961cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_bitmask(LiftoffRegister dst,
23971cb0ef41Sopenharmony_ci                                          LiftoffRegister src) {
23981cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_bitmask");
23991cb0ef41Sopenharmony_ci}
24001cb0ef41Sopenharmony_ci
24011cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_shl(LiftoffRegister dst, LiftoffRegister lhs,
24021cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
24031cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_shl");
24041cb0ef41Sopenharmony_ci}
24051cb0ef41Sopenharmony_ci
24061cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_shli(LiftoffRegister dst, LiftoffRegister lhs,
24071cb0ef41Sopenharmony_ci                                       int32_t rhs) {
24081cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_shli");
24091cb0ef41Sopenharmony_ci}
24101cb0ef41Sopenharmony_ci
24111cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_shr_s(LiftoffRegister dst,
24121cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
24131cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
24141cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_shr_s");
24151cb0ef41Sopenharmony_ci}
24161cb0ef41Sopenharmony_ci
24171cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_shri_s(LiftoffRegister dst,
24181cb0ef41Sopenharmony_ci                                         LiftoffRegister lhs, int32_t rhs) {
24191cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_shri_s");
24201cb0ef41Sopenharmony_ci}
24211cb0ef41Sopenharmony_ci
24221cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_shr_u(LiftoffRegister dst,
24231cb0ef41Sopenharmony_ci                                        LiftoffRegister lhs,
24241cb0ef41Sopenharmony_ci                                        LiftoffRegister rhs) {
24251cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_shr_u");
24261cb0ef41Sopenharmony_ci}
24271cb0ef41Sopenharmony_ci
24281cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_shri_u(LiftoffRegister dst,
24291cb0ef41Sopenharmony_ci                                         LiftoffRegister lhs, int32_t rhs) {
24301cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_shri_u");
24311cb0ef41Sopenharmony_ci}
24321cb0ef41Sopenharmony_ci
24331cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_add(LiftoffRegister dst, LiftoffRegister lhs,
24341cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
24351cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_add");
24361cb0ef41Sopenharmony_ci}
24371cb0ef41Sopenharmony_ci
24381cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_sub(LiftoffRegister dst, LiftoffRegister lhs,
24391cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
24401cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_sub");
24411cb0ef41Sopenharmony_ci}
24421cb0ef41Sopenharmony_ci
24431cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_mul(LiftoffRegister dst, LiftoffRegister lhs,
24441cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
24451cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_mul");
24461cb0ef41Sopenharmony_ci}
24471cb0ef41Sopenharmony_ci
24481cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
24491cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
24501cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_gt_s");
24511cb0ef41Sopenharmony_ci}
24521cb0ef41Sopenharmony_ci
24531cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
24541cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
24551cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_ge_s");
24561cb0ef41Sopenharmony_ci}
24571cb0ef41Sopenharmony_ci
24581cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_abs(LiftoffRegister dst,
24591cb0ef41Sopenharmony_ci                                      LiftoffRegister src) {
24601cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_abs");
24611cb0ef41Sopenharmony_ci}
24621cb0ef41Sopenharmony_ci
24631cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_neg(LiftoffRegister dst,
24641cb0ef41Sopenharmony_ci                                      LiftoffRegister src) {
24651cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_neg");
24661cb0ef41Sopenharmony_ci}
24671cb0ef41Sopenharmony_ci
24681cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_sqrt(LiftoffRegister dst,
24691cb0ef41Sopenharmony_ci                                       LiftoffRegister src) {
24701cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_sqrt");
24711cb0ef41Sopenharmony_ci}
24721cb0ef41Sopenharmony_ci
24731cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_f32x4_ceil(LiftoffRegister dst,
24741cb0ef41Sopenharmony_ci                                       LiftoffRegister src) {
24751cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_ceil");
24761cb0ef41Sopenharmony_ci  return true;
24771cb0ef41Sopenharmony_ci}
24781cb0ef41Sopenharmony_ci
24791cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_f32x4_floor(LiftoffRegister dst,
24801cb0ef41Sopenharmony_ci                                        LiftoffRegister src) {
24811cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_floor");
24821cb0ef41Sopenharmony_ci  return true;
24831cb0ef41Sopenharmony_ci}
24841cb0ef41Sopenharmony_ci
24851cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_f32x4_trunc(LiftoffRegister dst,
24861cb0ef41Sopenharmony_ci                                        LiftoffRegister src) {
24871cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_trunc");
24881cb0ef41Sopenharmony_ci  return true;
24891cb0ef41Sopenharmony_ci}
24901cb0ef41Sopenharmony_ci
24911cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_f32x4_nearest_int(LiftoffRegister dst,
24921cb0ef41Sopenharmony_ci                                              LiftoffRegister src) {
24931cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_nearest_int");
24941cb0ef41Sopenharmony_ci  return true;
24951cb0ef41Sopenharmony_ci}
24961cb0ef41Sopenharmony_ci
24971cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_add(LiftoffRegister dst, LiftoffRegister lhs,
24981cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
24991cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_add");
25001cb0ef41Sopenharmony_ci}
25011cb0ef41Sopenharmony_ci
25021cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_sub(LiftoffRegister dst, LiftoffRegister lhs,
25031cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
25041cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_sub");
25051cb0ef41Sopenharmony_ci}
25061cb0ef41Sopenharmony_ci
25071cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_mul(LiftoffRegister dst, LiftoffRegister lhs,
25081cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
25091cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_mul");
25101cb0ef41Sopenharmony_ci}
25111cb0ef41Sopenharmony_ci
25121cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_div(LiftoffRegister dst, LiftoffRegister lhs,
25131cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
25141cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_div");
25151cb0ef41Sopenharmony_ci}
25161cb0ef41Sopenharmony_ci
25171cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_min(LiftoffRegister dst, LiftoffRegister lhs,
25181cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
25191cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_min");
25201cb0ef41Sopenharmony_ci}
25211cb0ef41Sopenharmony_ci
25221cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_max(LiftoffRegister dst, LiftoffRegister lhs,
25231cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
25241cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_max");
25251cb0ef41Sopenharmony_ci}
25261cb0ef41Sopenharmony_ci
25271cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_pmin(LiftoffRegister dst, LiftoffRegister lhs,
25281cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
25291cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_pmin");
25301cb0ef41Sopenharmony_ci}
25311cb0ef41Sopenharmony_ci
25321cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_pmax(LiftoffRegister dst, LiftoffRegister lhs,
25331cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
25341cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_pmax");
25351cb0ef41Sopenharmony_ci}
25361cb0ef41Sopenharmony_ci
25371cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_abs(LiftoffRegister dst,
25381cb0ef41Sopenharmony_ci                                      LiftoffRegister src) {
25391cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_abs");
25401cb0ef41Sopenharmony_ci}
25411cb0ef41Sopenharmony_ci
25421cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_neg(LiftoffRegister dst,
25431cb0ef41Sopenharmony_ci                                      LiftoffRegister src) {
25441cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_neg");
25451cb0ef41Sopenharmony_ci}
25461cb0ef41Sopenharmony_ci
25471cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_sqrt(LiftoffRegister dst,
25481cb0ef41Sopenharmony_ci                                       LiftoffRegister src) {
25491cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_sqrt");
25501cb0ef41Sopenharmony_ci}
25511cb0ef41Sopenharmony_ci
25521cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_f64x2_ceil(LiftoffRegister dst,
25531cb0ef41Sopenharmony_ci                                       LiftoffRegister src) {
25541cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_ceil");
25551cb0ef41Sopenharmony_ci  return true;
25561cb0ef41Sopenharmony_ci}
25571cb0ef41Sopenharmony_ci
25581cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_f64x2_floor(LiftoffRegister dst,
25591cb0ef41Sopenharmony_ci                                        LiftoffRegister src) {
25601cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_floor");
25611cb0ef41Sopenharmony_ci  return true;
25621cb0ef41Sopenharmony_ci}
25631cb0ef41Sopenharmony_ci
25641cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_f64x2_trunc(LiftoffRegister dst,
25651cb0ef41Sopenharmony_ci                                        LiftoffRegister src) {
25661cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_trunc");
25671cb0ef41Sopenharmony_ci  return true;
25681cb0ef41Sopenharmony_ci}
25691cb0ef41Sopenharmony_ci
25701cb0ef41Sopenharmony_cibool LiftoffAssembler::emit_f64x2_nearest_int(LiftoffRegister dst,
25711cb0ef41Sopenharmony_ci                                              LiftoffRegister src) {
25721cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_nearest_int");
25731cb0ef41Sopenharmony_ci  return true;
25741cb0ef41Sopenharmony_ci}
25751cb0ef41Sopenharmony_ci
25761cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_add(LiftoffRegister dst, LiftoffRegister lhs,
25771cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
25781cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_add");
25791cb0ef41Sopenharmony_ci}
25801cb0ef41Sopenharmony_ci
25811cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_sub(LiftoffRegister dst, LiftoffRegister lhs,
25821cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
25831cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_sub");
25841cb0ef41Sopenharmony_ci}
25851cb0ef41Sopenharmony_ci
25861cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_mul(LiftoffRegister dst, LiftoffRegister lhs,
25871cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
25881cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_mul");
25891cb0ef41Sopenharmony_ci}
25901cb0ef41Sopenharmony_ci
25911cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_div(LiftoffRegister dst, LiftoffRegister lhs,
25921cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
25931cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_div");
25941cb0ef41Sopenharmony_ci}
25951cb0ef41Sopenharmony_ci
25961cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_min(LiftoffRegister dst, LiftoffRegister lhs,
25971cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
25981cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_min");
25991cb0ef41Sopenharmony_ci}
26001cb0ef41Sopenharmony_ci
26011cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_max(LiftoffRegister dst, LiftoffRegister lhs,
26021cb0ef41Sopenharmony_ci                                      LiftoffRegister rhs) {
26031cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_max");
26041cb0ef41Sopenharmony_ci}
26051cb0ef41Sopenharmony_ci
26061cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_pmin(LiftoffRegister dst, LiftoffRegister lhs,
26071cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
26081cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_pmin");
26091cb0ef41Sopenharmony_ci}
26101cb0ef41Sopenharmony_ci
26111cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_pmax(LiftoffRegister dst, LiftoffRegister lhs,
26121cb0ef41Sopenharmony_ci                                       LiftoffRegister rhs) {
26131cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_pmax");
26141cb0ef41Sopenharmony_ci}
26151cb0ef41Sopenharmony_ci
26161cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_convert_low_i32x4_s(LiftoffRegister dst,
26171cb0ef41Sopenharmony_ci                                                      LiftoffRegister src) {
26181cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_convert_low_i32x4_s");
26191cb0ef41Sopenharmony_ci}
26201cb0ef41Sopenharmony_ci
26211cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_convert_low_i32x4_u(LiftoffRegister dst,
26221cb0ef41Sopenharmony_ci                                                      LiftoffRegister src) {
26231cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_convert_low_i32x4_u");
26241cb0ef41Sopenharmony_ci}
26251cb0ef41Sopenharmony_ci
26261cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_promote_low_f32x4(LiftoffRegister dst,
26271cb0ef41Sopenharmony_ci                                                    LiftoffRegister src) {
26281cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_promote_low_f32x4");
26291cb0ef41Sopenharmony_ci}
26301cb0ef41Sopenharmony_ci
26311cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_sconvert_f32x4(LiftoffRegister dst,
26321cb0ef41Sopenharmony_ci                                                 LiftoffRegister src) {
26331cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_sconvert_f32x4");
26341cb0ef41Sopenharmony_ci}
26351cb0ef41Sopenharmony_ci
26361cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_uconvert_f32x4(LiftoffRegister dst,
26371cb0ef41Sopenharmony_ci                                                 LiftoffRegister src) {
26381cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_uconvert_f32x4");
26391cb0ef41Sopenharmony_ci}
26401cb0ef41Sopenharmony_ci
26411cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_trunc_sat_f64x2_s_zero(LiftoffRegister dst,
26421cb0ef41Sopenharmony_ci                                                         LiftoffRegister src) {
26431cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_trunc_sat_f64x2_s_zero");
26441cb0ef41Sopenharmony_ci}
26451cb0ef41Sopenharmony_ci
26461cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_trunc_sat_f64x2_u_zero(LiftoffRegister dst,
26471cb0ef41Sopenharmony_ci                                                         LiftoffRegister src) {
26481cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_trunc_sat_f64x2_u_zero");
26491cb0ef41Sopenharmony_ci}
26501cb0ef41Sopenharmony_ci
26511cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_sconvert_i32x4(LiftoffRegister dst,
26521cb0ef41Sopenharmony_ci                                                 LiftoffRegister src) {
26531cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_sconvert_i32x4");
26541cb0ef41Sopenharmony_ci}
26551cb0ef41Sopenharmony_ci
26561cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_uconvert_i32x4(LiftoffRegister dst,
26571cb0ef41Sopenharmony_ci                                                 LiftoffRegister src) {
26581cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_uconvert_i32x4");
26591cb0ef41Sopenharmony_ci}
26601cb0ef41Sopenharmony_ci
26611cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_demote_f64x2_zero(LiftoffRegister dst,
26621cb0ef41Sopenharmony_ci                                                    LiftoffRegister src) {
26631cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_demote_f64x2_zero");
26641cb0ef41Sopenharmony_ci}
26651cb0ef41Sopenharmony_ci
26661cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_sconvert_i16x8(LiftoffRegister dst,
26671cb0ef41Sopenharmony_ci                                                 LiftoffRegister lhs,
26681cb0ef41Sopenharmony_ci                                                 LiftoffRegister rhs) {
26691cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_sconvert_i16x8");
26701cb0ef41Sopenharmony_ci}
26711cb0ef41Sopenharmony_ci
26721cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_uconvert_i16x8(LiftoffRegister dst,
26731cb0ef41Sopenharmony_ci                                                 LiftoffRegister lhs,
26741cb0ef41Sopenharmony_ci                                                 LiftoffRegister rhs) {
26751cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_uconvert_i16x8");
26761cb0ef41Sopenharmony_ci}
26771cb0ef41Sopenharmony_ci
26781cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_sconvert_i32x4(LiftoffRegister dst,
26791cb0ef41Sopenharmony_ci                                                 LiftoffRegister lhs,
26801cb0ef41Sopenharmony_ci                                                 LiftoffRegister rhs) {
26811cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_sconvert_i32x4");
26821cb0ef41Sopenharmony_ci}
26831cb0ef41Sopenharmony_ci
26841cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_uconvert_i32x4(LiftoffRegister dst,
26851cb0ef41Sopenharmony_ci                                                 LiftoffRegister lhs,
26861cb0ef41Sopenharmony_ci                                                 LiftoffRegister rhs) {
26871cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_uconvert_i32x4");
26881cb0ef41Sopenharmony_ci}
26891cb0ef41Sopenharmony_ci
26901cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_sconvert_i8x16_low(LiftoffRegister dst,
26911cb0ef41Sopenharmony_ci                                                     LiftoffRegister src) {
26921cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_sconvert_i8x16_low");
26931cb0ef41Sopenharmony_ci}
26941cb0ef41Sopenharmony_ci
26951cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_sconvert_i8x16_high(LiftoffRegister dst,
26961cb0ef41Sopenharmony_ci                                                      LiftoffRegister src) {
26971cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_sconvert_i8x16_high");
26981cb0ef41Sopenharmony_ci}
26991cb0ef41Sopenharmony_ci
27001cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_uconvert_i8x16_low(LiftoffRegister dst,
27011cb0ef41Sopenharmony_ci                                                     LiftoffRegister src) {
27021cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_uconvert_i8x16_low");
27031cb0ef41Sopenharmony_ci}
27041cb0ef41Sopenharmony_ci
27051cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_uconvert_i8x16_high(LiftoffRegister dst,
27061cb0ef41Sopenharmony_ci                                                      LiftoffRegister src) {
27071cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_uconvert_i8x16_high");
27081cb0ef41Sopenharmony_ci}
27091cb0ef41Sopenharmony_ci
27101cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_sconvert_i16x8_low(LiftoffRegister dst,
27111cb0ef41Sopenharmony_ci                                                     LiftoffRegister src) {
27121cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_sconvert_i16x8_low");
27131cb0ef41Sopenharmony_ci}
27141cb0ef41Sopenharmony_ci
27151cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_sconvert_i16x8_high(LiftoffRegister dst,
27161cb0ef41Sopenharmony_ci                                                      LiftoffRegister src) {
27171cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_sconvert_i16x8_high");
27181cb0ef41Sopenharmony_ci}
27191cb0ef41Sopenharmony_ci
27201cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_uconvert_i16x8_low(LiftoffRegister dst,
27211cb0ef41Sopenharmony_ci                                                     LiftoffRegister src) {
27221cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_uconvert_i16x8_low");
27231cb0ef41Sopenharmony_ci}
27241cb0ef41Sopenharmony_ci
27251cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_uconvert_i16x8_high(LiftoffRegister dst,
27261cb0ef41Sopenharmony_ci                                                      LiftoffRegister src) {
27271cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_uconvert_i16x8_high");
27281cb0ef41Sopenharmony_ci}
27291cb0ef41Sopenharmony_ci
27301cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_sconvert_i32x4_low(LiftoffRegister dst,
27311cb0ef41Sopenharmony_ci                                                     LiftoffRegister src) {
27321cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_sconvert_i32x4_low");
27331cb0ef41Sopenharmony_ci}
27341cb0ef41Sopenharmony_ci
27351cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_sconvert_i32x4_high(LiftoffRegister dst,
27361cb0ef41Sopenharmony_ci                                                      LiftoffRegister src) {
27371cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_sconvert_i32x4_high");
27381cb0ef41Sopenharmony_ci}
27391cb0ef41Sopenharmony_ci
27401cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_uconvert_i32x4_low(LiftoffRegister dst,
27411cb0ef41Sopenharmony_ci                                                     LiftoffRegister src) {
27421cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_uconvert_i32x4_low");
27431cb0ef41Sopenharmony_ci}
27441cb0ef41Sopenharmony_ci
27451cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_uconvert_i32x4_high(LiftoffRegister dst,
27461cb0ef41Sopenharmony_ci                                                      LiftoffRegister src) {
27471cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_uconvert_i32x4_high");
27481cb0ef41Sopenharmony_ci}
27491cb0ef41Sopenharmony_ci
27501cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_rounding_average_u(LiftoffRegister dst,
27511cb0ef41Sopenharmony_ci                                                     LiftoffRegister lhs,
27521cb0ef41Sopenharmony_ci                                                     LiftoffRegister rhs) {
27531cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_rounding_average_u");
27541cb0ef41Sopenharmony_ci}
27551cb0ef41Sopenharmony_ci
27561cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_rounding_average_u(LiftoffRegister dst,
27571cb0ef41Sopenharmony_ci                                                     LiftoffRegister lhs,
27581cb0ef41Sopenharmony_ci                                                     LiftoffRegister rhs) {
27591cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_rounding_average_u");
27601cb0ef41Sopenharmony_ci}
27611cb0ef41Sopenharmony_ci
27621cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_abs(LiftoffRegister dst,
27631cb0ef41Sopenharmony_ci                                      LiftoffRegister src) {
27641cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_abs");
27651cb0ef41Sopenharmony_ci}
27661cb0ef41Sopenharmony_ci
27671cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_abs(LiftoffRegister dst,
27681cb0ef41Sopenharmony_ci                                      LiftoffRegister src) {
27691cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_abs");
27701cb0ef41Sopenharmony_ci}
27711cb0ef41Sopenharmony_ci
27721cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_abs(LiftoffRegister dst,
27731cb0ef41Sopenharmony_ci                                      LiftoffRegister src) {
27741cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_abs");
27751cb0ef41Sopenharmony_ci}
27761cb0ef41Sopenharmony_ci
27771cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_extract_lane_s(LiftoffRegister dst,
27781cb0ef41Sopenharmony_ci                                                 LiftoffRegister lhs,
27791cb0ef41Sopenharmony_ci                                                 uint8_t imm_lane_idx) {
27801cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_extract_lane_s");
27811cb0ef41Sopenharmony_ci}
27821cb0ef41Sopenharmony_ci
27831cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_extract_lane_u(LiftoffRegister dst,
27841cb0ef41Sopenharmony_ci                                                 LiftoffRegister lhs,
27851cb0ef41Sopenharmony_ci                                                 uint8_t imm_lane_idx) {
27861cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_extract_lane_u");
27871cb0ef41Sopenharmony_ci}
27881cb0ef41Sopenharmony_ci
27891cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_extract_lane_s(LiftoffRegister dst,
27901cb0ef41Sopenharmony_ci                                                 LiftoffRegister lhs,
27911cb0ef41Sopenharmony_ci                                                 uint8_t imm_lane_idx) {
27921cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_extract_lane_s");
27931cb0ef41Sopenharmony_ci}
27941cb0ef41Sopenharmony_ci
27951cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_extract_lane_u(LiftoffRegister dst,
27961cb0ef41Sopenharmony_ci                                                 LiftoffRegister lhs,
27971cb0ef41Sopenharmony_ci                                                 uint8_t imm_lane_idx) {
27981cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_extract_lane_u");
27991cb0ef41Sopenharmony_ci}
28001cb0ef41Sopenharmony_ci
28011cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_extract_lane(LiftoffRegister dst,
28021cb0ef41Sopenharmony_ci                                               LiftoffRegister lhs,
28031cb0ef41Sopenharmony_ci                                               uint8_t imm_lane_idx) {
28041cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_extract_lane");
28051cb0ef41Sopenharmony_ci}
28061cb0ef41Sopenharmony_ci
28071cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_extract_lane(LiftoffRegister dst,
28081cb0ef41Sopenharmony_ci                                               LiftoffRegister lhs,
28091cb0ef41Sopenharmony_ci                                               uint8_t imm_lane_idx) {
28101cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_extract_lane");
28111cb0ef41Sopenharmony_ci}
28121cb0ef41Sopenharmony_ci
28131cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_extract_lane(LiftoffRegister dst,
28141cb0ef41Sopenharmony_ci                                               LiftoffRegister lhs,
28151cb0ef41Sopenharmony_ci                                               uint8_t imm_lane_idx) {
28161cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_extract_lane");
28171cb0ef41Sopenharmony_ci}
28181cb0ef41Sopenharmony_ci
28191cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_extract_lane(LiftoffRegister dst,
28201cb0ef41Sopenharmony_ci                                               LiftoffRegister lhs,
28211cb0ef41Sopenharmony_ci                                               uint8_t imm_lane_idx) {
28221cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_extract_lane");
28231cb0ef41Sopenharmony_ci}
28241cb0ef41Sopenharmony_ci
28251cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i8x16_replace_lane(LiftoffRegister dst,
28261cb0ef41Sopenharmony_ci                                               LiftoffRegister src1,
28271cb0ef41Sopenharmony_ci                                               LiftoffRegister src2,
28281cb0ef41Sopenharmony_ci                                               uint8_t imm_lane_idx) {
28291cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i8x16_replace_lane");
28301cb0ef41Sopenharmony_ci}
28311cb0ef41Sopenharmony_ci
28321cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i16x8_replace_lane(LiftoffRegister dst,
28331cb0ef41Sopenharmony_ci                                               LiftoffRegister src1,
28341cb0ef41Sopenharmony_ci                                               LiftoffRegister src2,
28351cb0ef41Sopenharmony_ci                                               uint8_t imm_lane_idx) {
28361cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i16x8_replace_lane");
28371cb0ef41Sopenharmony_ci}
28381cb0ef41Sopenharmony_ci
28391cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i32x4_replace_lane(LiftoffRegister dst,
28401cb0ef41Sopenharmony_ci                                               LiftoffRegister src1,
28411cb0ef41Sopenharmony_ci                                               LiftoffRegister src2,
28421cb0ef41Sopenharmony_ci                                               uint8_t imm_lane_idx) {
28431cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i32x4_replace_lane");
28441cb0ef41Sopenharmony_ci}
28451cb0ef41Sopenharmony_ci
28461cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_i64x2_replace_lane(LiftoffRegister dst,
28471cb0ef41Sopenharmony_ci                                               LiftoffRegister src1,
28481cb0ef41Sopenharmony_ci                                               LiftoffRegister src2,
28491cb0ef41Sopenharmony_ci                                               uint8_t imm_lane_idx) {
28501cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_i64x2_replace_lane");
28511cb0ef41Sopenharmony_ci}
28521cb0ef41Sopenharmony_ci
28531cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f32x4_replace_lane(LiftoffRegister dst,
28541cb0ef41Sopenharmony_ci                                               LiftoffRegister src1,
28551cb0ef41Sopenharmony_ci                                               LiftoffRegister src2,
28561cb0ef41Sopenharmony_ci                                               uint8_t imm_lane_idx) {
28571cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f32x4_replace_lane");
28581cb0ef41Sopenharmony_ci}
28591cb0ef41Sopenharmony_ci
28601cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_f64x2_replace_lane(LiftoffRegister dst,
28611cb0ef41Sopenharmony_ci                                               LiftoffRegister src1,
28621cb0ef41Sopenharmony_ci                                               LiftoffRegister src2,
28631cb0ef41Sopenharmony_ci                                               uint8_t imm_lane_idx) {
28641cb0ef41Sopenharmony_ci  bailout(kSimd, "emit_f64x2_replace_lane");
28651cb0ef41Sopenharmony_ci}
28661cb0ef41Sopenharmony_ci
28671cb0ef41Sopenharmony_civoid LiftoffAssembler::StackCheck(Label* ool_code, Register limit_address) {
28681cb0ef41Sopenharmony_ci  TurboAssembler::Ld_d(limit_address, MemOperand(limit_address, 0));
28691cb0ef41Sopenharmony_ci  TurboAssembler::Branch(ool_code, ule, sp, Operand(limit_address));
28701cb0ef41Sopenharmony_ci}
28711cb0ef41Sopenharmony_ci
28721cb0ef41Sopenharmony_civoid LiftoffAssembler::CallTrapCallbackForTesting() {
28731cb0ef41Sopenharmony_ci  PrepareCallCFunction(0, GetUnusedRegister(kGpReg, {}).gp());
28741cb0ef41Sopenharmony_ci  CallCFunction(ExternalReference::wasm_call_trap_callback_for_testing(), 0);
28751cb0ef41Sopenharmony_ci}
28761cb0ef41Sopenharmony_ci
28771cb0ef41Sopenharmony_civoid LiftoffAssembler::AssertUnreachable(AbortReason reason) {
28781cb0ef41Sopenharmony_ci  if (FLAG_debug_code) Abort(reason);
28791cb0ef41Sopenharmony_ci}
28801cb0ef41Sopenharmony_ci
28811cb0ef41Sopenharmony_civoid LiftoffAssembler::PushRegisters(LiftoffRegList regs) {
28821cb0ef41Sopenharmony_ci  LiftoffRegList gp_regs = regs & kGpCacheRegList;
28831cb0ef41Sopenharmony_ci  unsigned num_gp_regs = gp_regs.GetNumRegsSet();
28841cb0ef41Sopenharmony_ci  if (num_gp_regs) {
28851cb0ef41Sopenharmony_ci    unsigned offset = num_gp_regs * kSystemPointerSize;
28861cb0ef41Sopenharmony_ci    addi_d(sp, sp, -offset);
28871cb0ef41Sopenharmony_ci    while (!gp_regs.is_empty()) {
28881cb0ef41Sopenharmony_ci      LiftoffRegister reg = gp_regs.GetFirstRegSet();
28891cb0ef41Sopenharmony_ci      offset -= kSystemPointerSize;
28901cb0ef41Sopenharmony_ci      St_d(reg.gp(), MemOperand(sp, offset));
28911cb0ef41Sopenharmony_ci      gp_regs.clear(reg);
28921cb0ef41Sopenharmony_ci    }
28931cb0ef41Sopenharmony_ci    DCHECK_EQ(offset, 0);
28941cb0ef41Sopenharmony_ci  }
28951cb0ef41Sopenharmony_ci  LiftoffRegList fp_regs = regs & kFpCacheRegList;
28961cb0ef41Sopenharmony_ci  unsigned num_fp_regs = fp_regs.GetNumRegsSet();
28971cb0ef41Sopenharmony_ci  if (num_fp_regs) {
28981cb0ef41Sopenharmony_ci    unsigned slot_size = 8;
28991cb0ef41Sopenharmony_ci    addi_d(sp, sp, -(num_fp_regs * slot_size));
29001cb0ef41Sopenharmony_ci    unsigned offset = 0;
29011cb0ef41Sopenharmony_ci    while (!fp_regs.is_empty()) {
29021cb0ef41Sopenharmony_ci      LiftoffRegister reg = fp_regs.GetFirstRegSet();
29031cb0ef41Sopenharmony_ci      TurboAssembler::Fst_d(reg.fp(), MemOperand(sp, offset));
29041cb0ef41Sopenharmony_ci      fp_regs.clear(reg);
29051cb0ef41Sopenharmony_ci      offset += slot_size;
29061cb0ef41Sopenharmony_ci    }
29071cb0ef41Sopenharmony_ci    DCHECK_EQ(offset, num_fp_regs * slot_size);
29081cb0ef41Sopenharmony_ci  }
29091cb0ef41Sopenharmony_ci}
29101cb0ef41Sopenharmony_ci
29111cb0ef41Sopenharmony_civoid LiftoffAssembler::PopRegisters(LiftoffRegList regs) {
29121cb0ef41Sopenharmony_ci  LiftoffRegList fp_regs = regs & kFpCacheRegList;
29131cb0ef41Sopenharmony_ci  unsigned fp_offset = 0;
29141cb0ef41Sopenharmony_ci  while (!fp_regs.is_empty()) {
29151cb0ef41Sopenharmony_ci    LiftoffRegister reg = fp_regs.GetFirstRegSet();
29161cb0ef41Sopenharmony_ci    TurboAssembler::Fld_d(reg.fp(), MemOperand(sp, fp_offset));
29171cb0ef41Sopenharmony_ci    fp_regs.clear(reg);
29181cb0ef41Sopenharmony_ci    fp_offset += 8;
29191cb0ef41Sopenharmony_ci  }
29201cb0ef41Sopenharmony_ci  if (fp_offset) addi_d(sp, sp, fp_offset);
29211cb0ef41Sopenharmony_ci  LiftoffRegList gp_regs = regs & kGpCacheRegList;
29221cb0ef41Sopenharmony_ci  unsigned gp_offset = 0;
29231cb0ef41Sopenharmony_ci  while (!gp_regs.is_empty()) {
29241cb0ef41Sopenharmony_ci    LiftoffRegister reg = gp_regs.GetLastRegSet();
29251cb0ef41Sopenharmony_ci    Ld_d(reg.gp(), MemOperand(sp, gp_offset));
29261cb0ef41Sopenharmony_ci    gp_regs.clear(reg);
29271cb0ef41Sopenharmony_ci    gp_offset += kSystemPointerSize;
29281cb0ef41Sopenharmony_ci  }
29291cb0ef41Sopenharmony_ci  addi_d(sp, sp, gp_offset);
29301cb0ef41Sopenharmony_ci}
29311cb0ef41Sopenharmony_ci
29321cb0ef41Sopenharmony_civoid LiftoffAssembler::RecordSpillsInSafepoint(
29331cb0ef41Sopenharmony_ci    SafepointTableBuilder::Safepoint& safepoint, LiftoffRegList all_spills,
29341cb0ef41Sopenharmony_ci    LiftoffRegList ref_spills, int spill_offset) {
29351cb0ef41Sopenharmony_ci  int spill_space_size = 0;
29361cb0ef41Sopenharmony_ci  while (!all_spills.is_empty()) {
29371cb0ef41Sopenharmony_ci    LiftoffRegister reg = all_spills.GetFirstRegSet();
29381cb0ef41Sopenharmony_ci    if (ref_spills.has(reg)) {
29391cb0ef41Sopenharmony_ci      safepoint.DefineTaggedStackSlot(spill_offset);
29401cb0ef41Sopenharmony_ci    }
29411cb0ef41Sopenharmony_ci    all_spills.clear(reg);
29421cb0ef41Sopenharmony_ci    ++spill_offset;
29431cb0ef41Sopenharmony_ci    spill_space_size += kSystemPointerSize;
29441cb0ef41Sopenharmony_ci  }
29451cb0ef41Sopenharmony_ci  // Record the number of additional spill slots.
29461cb0ef41Sopenharmony_ci  RecordOolSpillSpaceSize(spill_space_size);
29471cb0ef41Sopenharmony_ci}
29481cb0ef41Sopenharmony_ci
29491cb0ef41Sopenharmony_civoid LiftoffAssembler::DropStackSlotsAndRet(uint32_t num_stack_slots) {
29501cb0ef41Sopenharmony_ci  DCHECK_LT(num_stack_slots,
29511cb0ef41Sopenharmony_ci            (1 << 16) / kSystemPointerSize);  // 16 bit immediate
29521cb0ef41Sopenharmony_ci  Drop(static_cast<int>(num_stack_slots));
29531cb0ef41Sopenharmony_ci  Ret();
29541cb0ef41Sopenharmony_ci}
29551cb0ef41Sopenharmony_ci
29561cb0ef41Sopenharmony_civoid LiftoffAssembler::CallC(const ValueKindSig* sig,
29571cb0ef41Sopenharmony_ci                             const LiftoffRegister* args,
29581cb0ef41Sopenharmony_ci                             const LiftoffRegister* rets,
29591cb0ef41Sopenharmony_ci                             ValueKind out_argument_kind, int stack_bytes,
29601cb0ef41Sopenharmony_ci                             ExternalReference ext_ref) {
29611cb0ef41Sopenharmony_ci  addi_d(sp, sp, -stack_bytes);
29621cb0ef41Sopenharmony_ci
29631cb0ef41Sopenharmony_ci  int arg_bytes = 0;
29641cb0ef41Sopenharmony_ci  for (ValueKind param_kind : sig->parameters()) {
29651cb0ef41Sopenharmony_ci    liftoff::Store(this, sp, arg_bytes, *args++, param_kind);
29661cb0ef41Sopenharmony_ci    arg_bytes += value_kind_size(param_kind);
29671cb0ef41Sopenharmony_ci  }
29681cb0ef41Sopenharmony_ci  DCHECK_LE(arg_bytes, stack_bytes);
29691cb0ef41Sopenharmony_ci
29701cb0ef41Sopenharmony_ci  // Pass a pointer to the buffer with the arguments to the C function.
29711cb0ef41Sopenharmony_ci  // On LoongArch, the first argument is passed in {a0}.
29721cb0ef41Sopenharmony_ci  constexpr Register kFirstArgReg = a0;
29731cb0ef41Sopenharmony_ci  mov(kFirstArgReg, sp);
29741cb0ef41Sopenharmony_ci
29751cb0ef41Sopenharmony_ci  // Now call the C function.
29761cb0ef41Sopenharmony_ci  constexpr int kNumCCallArgs = 1;
29771cb0ef41Sopenharmony_ci  PrepareCallCFunction(kNumCCallArgs, kScratchReg);
29781cb0ef41Sopenharmony_ci  CallCFunction(ext_ref, kNumCCallArgs);
29791cb0ef41Sopenharmony_ci
29801cb0ef41Sopenharmony_ci  // Move return value to the right register.
29811cb0ef41Sopenharmony_ci  const LiftoffRegister* next_result_reg = rets;
29821cb0ef41Sopenharmony_ci  if (sig->return_count() > 0) {
29831cb0ef41Sopenharmony_ci    DCHECK_EQ(1, sig->return_count());
29841cb0ef41Sopenharmony_ci    constexpr Register kReturnReg = a0;
29851cb0ef41Sopenharmony_ci    if (kReturnReg != next_result_reg->gp()) {
29861cb0ef41Sopenharmony_ci      Move(*next_result_reg, LiftoffRegister(kReturnReg), sig->GetReturn(0));
29871cb0ef41Sopenharmony_ci    }
29881cb0ef41Sopenharmony_ci    ++next_result_reg;
29891cb0ef41Sopenharmony_ci  }
29901cb0ef41Sopenharmony_ci
29911cb0ef41Sopenharmony_ci  // Load potential output value from the buffer on the stack.
29921cb0ef41Sopenharmony_ci  if (out_argument_kind != kVoid) {
29931cb0ef41Sopenharmony_ci    liftoff::Load(this, *next_result_reg, MemOperand(sp, 0), out_argument_kind);
29941cb0ef41Sopenharmony_ci  }
29951cb0ef41Sopenharmony_ci
29961cb0ef41Sopenharmony_ci  addi_d(sp, sp, stack_bytes);
29971cb0ef41Sopenharmony_ci}
29981cb0ef41Sopenharmony_ci
29991cb0ef41Sopenharmony_civoid LiftoffAssembler::CallNativeWasmCode(Address addr) {
30001cb0ef41Sopenharmony_ci  Call(addr, RelocInfo::WASM_CALL);
30011cb0ef41Sopenharmony_ci}
30021cb0ef41Sopenharmony_ci
30031cb0ef41Sopenharmony_civoid LiftoffAssembler::TailCallNativeWasmCode(Address addr) {
30041cb0ef41Sopenharmony_ci  Jump(addr, RelocInfo::WASM_CALL);
30051cb0ef41Sopenharmony_ci}
30061cb0ef41Sopenharmony_ci
30071cb0ef41Sopenharmony_civoid LiftoffAssembler::CallIndirect(const ValueKindSig* sig,
30081cb0ef41Sopenharmony_ci                                    compiler::CallDescriptor* call_descriptor,
30091cb0ef41Sopenharmony_ci                                    Register target) {
30101cb0ef41Sopenharmony_ci  if (target == no_reg) {
30111cb0ef41Sopenharmony_ci    Pop(kScratchReg);
30121cb0ef41Sopenharmony_ci    Call(kScratchReg);
30131cb0ef41Sopenharmony_ci  } else {
30141cb0ef41Sopenharmony_ci    Call(target);
30151cb0ef41Sopenharmony_ci  }
30161cb0ef41Sopenharmony_ci}
30171cb0ef41Sopenharmony_ci
30181cb0ef41Sopenharmony_civoid LiftoffAssembler::TailCallIndirect(Register target) {
30191cb0ef41Sopenharmony_ci  if (target == no_reg) {
30201cb0ef41Sopenharmony_ci    Pop(kScratchReg);
30211cb0ef41Sopenharmony_ci    Jump(kScratchReg);
30221cb0ef41Sopenharmony_ci  } else {
30231cb0ef41Sopenharmony_ci    Jump(target);
30241cb0ef41Sopenharmony_ci  }
30251cb0ef41Sopenharmony_ci}
30261cb0ef41Sopenharmony_ci
30271cb0ef41Sopenharmony_civoid LiftoffAssembler::CallRuntimeStub(WasmCode::RuntimeStubId sid) {
30281cb0ef41Sopenharmony_ci  // A direct call to a wasm runtime stub defined in this module.
30291cb0ef41Sopenharmony_ci  // Just encode the stub index. This will be patched at relocation.
30301cb0ef41Sopenharmony_ci  Call(static_cast<Address>(sid), RelocInfo::WASM_STUB_CALL);
30311cb0ef41Sopenharmony_ci}
30321cb0ef41Sopenharmony_ci
30331cb0ef41Sopenharmony_civoid LiftoffAssembler::AllocateStackSlot(Register addr, uint32_t size) {
30341cb0ef41Sopenharmony_ci  addi_d(sp, sp, -size);
30351cb0ef41Sopenharmony_ci  TurboAssembler::Move(addr, sp);
30361cb0ef41Sopenharmony_ci}
30371cb0ef41Sopenharmony_ci
30381cb0ef41Sopenharmony_civoid LiftoffAssembler::DeallocateStackSlot(uint32_t size) {
30391cb0ef41Sopenharmony_ci  addi_d(sp, sp, size);
30401cb0ef41Sopenharmony_ci}
30411cb0ef41Sopenharmony_ci
30421cb0ef41Sopenharmony_civoid LiftoffAssembler::MaybeOSR() {}
30431cb0ef41Sopenharmony_ci
30441cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_set_if_nan(Register dst, FPURegister src,
30451cb0ef41Sopenharmony_ci                                       ValueKind kind) {
30461cb0ef41Sopenharmony_ci  UseScratchRegisterScope temps(this);
30471cb0ef41Sopenharmony_ci  Register scratch = temps.Acquire();
30481cb0ef41Sopenharmony_ci  Label not_nan;
30491cb0ef41Sopenharmony_ci  if (kind == kF32) {
30501cb0ef41Sopenharmony_ci    CompareIsNanF32(src, src);
30511cb0ef41Sopenharmony_ci  } else {
30521cb0ef41Sopenharmony_ci    DCHECK_EQ(kind, kF64);
30531cb0ef41Sopenharmony_ci    CompareIsNanF64(src, src);
30541cb0ef41Sopenharmony_ci  }
30551cb0ef41Sopenharmony_ci  BranchFalseShortF(&not_nan);
30561cb0ef41Sopenharmony_ci  li(scratch, 1);
30571cb0ef41Sopenharmony_ci  St_w(scratch, MemOperand(dst, 0));
30581cb0ef41Sopenharmony_ci  bind(&not_nan);
30591cb0ef41Sopenharmony_ci}
30601cb0ef41Sopenharmony_ci
30611cb0ef41Sopenharmony_civoid LiftoffAssembler::emit_s128_set_if_nan(Register dst, LiftoffRegister src,
30621cb0ef41Sopenharmony_ci                                            Register tmp_gp,
30631cb0ef41Sopenharmony_ci                                            LiftoffRegister tmp_s128,
30641cb0ef41Sopenharmony_ci                                            ValueKind lane_kind) {
30651cb0ef41Sopenharmony_ci  UNIMPLEMENTED();
30661cb0ef41Sopenharmony_ci}
30671cb0ef41Sopenharmony_ci
30681cb0ef41Sopenharmony_civoid LiftoffStackSlots::Construct(int param_slots) {
30691cb0ef41Sopenharmony_ci  DCHECK_LT(0, slots_.size());
30701cb0ef41Sopenharmony_ci  SortInPushOrder();
30711cb0ef41Sopenharmony_ci  int last_stack_slot = param_slots;
30721cb0ef41Sopenharmony_ci  for (auto& slot : slots_) {
30731cb0ef41Sopenharmony_ci    const int stack_slot = slot.dst_slot_;
30741cb0ef41Sopenharmony_ci    int stack_decrement = (last_stack_slot - stack_slot) * kSystemPointerSize;
30751cb0ef41Sopenharmony_ci    DCHECK_LT(0, stack_decrement);
30761cb0ef41Sopenharmony_ci    last_stack_slot = stack_slot;
30771cb0ef41Sopenharmony_ci    const LiftoffAssembler::VarState& src = slot.src_;
30781cb0ef41Sopenharmony_ci    switch (src.loc()) {
30791cb0ef41Sopenharmony_ci      case LiftoffAssembler::VarState::kStack:
30801cb0ef41Sopenharmony_ci        if (src.kind() != kS128) {
30811cb0ef41Sopenharmony_ci          asm_->AllocateStackSpace(stack_decrement - kSystemPointerSize);
30821cb0ef41Sopenharmony_ci          asm_->Ld_d(kScratchReg, liftoff::GetStackSlot(slot.src_offset_));
30831cb0ef41Sopenharmony_ci          asm_->Push(kScratchReg);
30841cb0ef41Sopenharmony_ci        } else {
30851cb0ef41Sopenharmony_ci          asm_->AllocateStackSpace(stack_decrement - kSimd128Size);
30861cb0ef41Sopenharmony_ci          asm_->Ld_d(kScratchReg, liftoff::GetStackSlot(slot.src_offset_ - 8));
30871cb0ef41Sopenharmony_ci          asm_->Push(kScratchReg);
30881cb0ef41Sopenharmony_ci          asm_->Ld_d(kScratchReg, liftoff::GetStackSlot(slot.src_offset_));
30891cb0ef41Sopenharmony_ci          asm_->Push(kScratchReg);
30901cb0ef41Sopenharmony_ci        }
30911cb0ef41Sopenharmony_ci        break;
30921cb0ef41Sopenharmony_ci      case LiftoffAssembler::VarState::kRegister: {
30931cb0ef41Sopenharmony_ci        int pushed_bytes = SlotSizeInBytes(slot);
30941cb0ef41Sopenharmony_ci        asm_->AllocateStackSpace(stack_decrement - pushed_bytes);
30951cb0ef41Sopenharmony_ci        liftoff::push(asm_, src.reg(), src.kind());
30961cb0ef41Sopenharmony_ci        break;
30971cb0ef41Sopenharmony_ci      }
30981cb0ef41Sopenharmony_ci      case LiftoffAssembler::VarState::kIntConst: {
30991cb0ef41Sopenharmony_ci        asm_->AllocateStackSpace(stack_decrement - kSystemPointerSize);
31001cb0ef41Sopenharmony_ci        asm_->li(kScratchReg, Operand(src.i32_const()));
31011cb0ef41Sopenharmony_ci        asm_->Push(kScratchReg);
31021cb0ef41Sopenharmony_ci        break;
31031cb0ef41Sopenharmony_ci      }
31041cb0ef41Sopenharmony_ci    }
31051cb0ef41Sopenharmony_ci  }
31061cb0ef41Sopenharmony_ci}
31071cb0ef41Sopenharmony_ci
31081cb0ef41Sopenharmony_ci}  // namespace wasm
31091cb0ef41Sopenharmony_ci}  // namespace internal
31101cb0ef41Sopenharmony_ci}  // namespace v8
31111cb0ef41Sopenharmony_ci
31121cb0ef41Sopenharmony_ci#endif  // V8_WASM_BASELINE_LOONG64_LIFTOFF_ASSEMBLER_LOONG64_H_
3113