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