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