33#if V8_ENABLE_WEBASSEMBLY
154 DCHECK_EQ(0, constant.ToFloat64().AsUint64());
157 return Immediate(constant.ToInt32(), constant.rmode());
178 static_assert(0 ==
static_cast<int>(
times_1));
179 static_assert(1 ==
static_cast<int>(
times_2));
180 static_assert(2 ==
static_cast<int>(
times_4));
181 static_assert(3 ==
static_cast<int>(
times_8));
182 int scale =
static_cast<int>(mode -
one);
287class OutOfLineLoadFloat32NaN final :
public OutOfLineCode {
289 OutOfLineLoadFloat32NaN(CodeGenerator*
gen, XMMRegister
result)
292 void Generate() final {
293 __ Xorps(result_, result_);
294 __ Divss(result_, result_);
301class OutOfLineLoadFloat64NaN final :
public OutOfLineCode {
303 OutOfLineLoadFloat64NaN(CodeGenerator*
gen, XMMRegister
result)
306 void Generate() final {
307 __ Xorpd(result_, result_);
308 __ Divsd(result_, result_);
315class OutOfLineTruncateDoubleToI final :
public OutOfLineCode {
317 OutOfLineTruncateDoubleToI(CodeGenerator*
gen, Register
result,
319 UnwindingInfoWriter* unwinding_info_writer)
320 : OutOfLineCode(
gen),
323#if V8_ENABLE_WEBASSEMBLY
324 stub_mode_(stub_mode),
331 void Generate() final {
336#if V8_ENABLE_WEBASSEMBLY
337 if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) {
341 __ near_call(
static_cast<intptr_t
>(Builtin::kDoubleToI),
350 __ CallBuiltin(Builtin::kDoubleToI);
361#if V8_ENABLE_WEBASSEMBLY
369class OutOfLineRecordWrite final :
public OutOfLineCode {
371 OutOfLineRecordWrite(
376 : OutOfLineCode(
gen),
383#if V8_ENABLE_WEBASSEMBLY
384 stub_mode_(stub_mode),
392#if V8_ENABLE_STICKY_MARK_BITS_BOOL
393 Label* stub_call() {
return &stub_call_; }
396 void Generate() final {
400 mode_ != RecordWriteMode::kValueIsIndirectPointer) {
406 if (
mode_ != RecordWriteMode::kValueIsIndirectPointer) {
407#if V8_ENABLE_STICKY_MARK_BITS_BOOL
409 Label stub_call_with_decompressed_value;
413 __ jmp(&stub_call_with_decompressed_value);
415 __ bind(&stub_call_);
417 mode_ != RecordWriteMode::kValueIsIndirectPointer) {
421 __ bind(&stub_call_with_decompressed_value);
424 MemoryChunk::kPointersToHereAreInterestingMask, zero,
431 SaveFPRegsMode const save_fp_mode = frame()->DidAllocateDoubleRegisters()
432 ? SaveFPRegsMode::kSave
433 : SaveFPRegsMode::kIgnore;
435 if (
mode_ == RecordWriteMode::kValueIsEphemeronKey) {
437 }
else if (
mode_ == RecordWriteMode::kValueIsIndirectPointer) {
443#if V8_ENABLE_WEBASSEMBLY
444 }
else if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) {
449 StubCallMode::kCallWasmRuntimeStub);
463#if V8_ENABLE_WEBASSEMBLY
464 StubCallMode
const stub_mode_;
468#if V8_ENABLE_STICKY_MARK_BITS_BOOL
473template <std::memory_order order>
474int EmitStore(MacroAssembler* masm, Operand operand, Register value,
476 int store_instr_offset;
477 if (order == std::memory_order_relaxed) {
478 store_instr_offset = masm->pc_offset();
481 masm->movb(operand, value);
484 masm->movw(operand, value);
487 masm->movl(operand, value);
490 masm->movq(operand, value);
493 masm->StoreTaggedField(operand, value);
496 masm->StoreSandboxedPointerField(operand, value);
499 masm->StoreIndirectPointerField(operand, value);
504 return store_instr_offset;
507 DCHECK_EQ(order, std::memory_order_seq_cst);
511 store_instr_offset = masm->pc_offset();
516 store_instr_offset = masm->pc_offset();
521 store_instr_offset = masm->pc_offset();
526 store_instr_offset = masm->pc_offset();
530 store_instr_offset = masm->pc_offset();
531 masm->AtomicStoreTaggedField(operand, value);
536 return store_instr_offset;
539template <std::memory_order order>
540int EmitStore(MacroAssembler* masm, Operand operand, Immediate value,
544int EmitStore<std::memory_order_relaxed>(MacroAssembler* masm, Operand operand,
547 int store_instr_offset = masm->pc_offset();
550 masm->movb(operand, value);
553 masm->movw(operand, value);
556 masm->movl(operand, value);
559 masm->movq(operand, value);
562 masm->StoreTaggedField(operand, value);
567 return store_instr_offset;
570#if V8_ENABLE_WEBASSEMBLY
571class WasmOutOfLineTrap :
public OutOfLineCode {
573 WasmOutOfLineTrap(CodeGenerator*
gen, Instruction*
instr)
576 void Generate()
override {
577 X64OperandConverter
i(
gen_, instr_);
579 static_cast<TrapId
>(
i.InputInt32(instr_->InputCount() - 1));
580 GenerateWithTrapId(trap_id);
586 void GenerateWithTrapId(TrapId trap_id) { GenerateCallToTrap(trap_id); }
589 void GenerateCallToTrap(TrapId trap_id) {
590 gen_->AssembleSourcePosition(instr_);
594 __ near_call(
static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL);
595 ReferenceMap* reference_map =
gen_->zone()->New<ReferenceMap>(
gen_->zone());
596 gen_->RecordSafepoint(reference_map);
597 __ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap);
603void RecordTrapInfoIfNeeded(
Zone* zone, CodeGenerator* codegen,
609 codegen->RecordProtectedInstruction(
pc);
615void RecordTrapInfoIfNeeded(
Zone* zone, CodeGenerator* codegen,
624void EmitMemoryProbeForTrapHandlerIfNeeded(MacroAssembler* masm,
625 Register scratch, Operand operand,
627#if V8_ENABLE_WEBASSEMBLY && V8_TRAP_HANDLER_SUPPORTED
634 mode == StubCallMode::kCallWasmRuntimeStub) {
637 masm->movb(scratch, operand);
640 masm->movw(scratch, operand);
643 masm->movl(scratch, operand);
646 masm->movq(scratch, operand);
655class OutOfLineTSANStore :
public OutOfLineCode {
657 OutOfLineTSANStore(CodeGenerator*
gen, Operand operand, Register value,
658 Register scratch0, StubCallMode stub_mode,
int size,
659 std::memory_order order)
660 : OutOfLineCode(
gen),
664#if V8_ENABLE_WEBASSEMBLY
665 stub_mode_(stub_mode),
668 memory_order_(order),
673 void Generate() final {
674 const SaveFPRegsMode save_fp_mode = frame()->DidAllocateDoubleRegisters()
675 ? SaveFPRegsMode::kSave
676 : SaveFPRegsMode::kIgnore;
679#if V8_ENABLE_WEBASSEMBLY
680 if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) {
685 StubCallMode::kCallWasmRuntimeStub,
692 StubCallMode::kCallBuiltinPointer, memory_order_);
699#if V8_ENABLE_WEBASSEMBLY
703 const std::memory_order memory_order_;
707void EmitTSANStoreOOL(
Zone* zone, CodeGenerator* codegen, MacroAssembler* masm,
708 Operand operand, Register value_reg,
710 std::memory_order order) {
716 DCHECK_NE(codegen->code_kind(), CodeKind::FOR_TESTING);
719 auto tsan_ool = zone->New<OutOfLineTSANStore>(codegen, operand, value_reg,
721 masm->jmp(tsan_ool->entry());
722 masm->bind(tsan_ool->exit());
725template <std::memory_order order>
726Register GetTSANValueRegister(MacroAssembler* masm, Register value,
727 X64OperandConverter&
i,
732 masm->movq(value_reg, value);
733 masm->EncodeSandboxedPointer(value_reg);
741 FieldOperand(value, ExposedTrustedObject::kSelfIndirectPointerOffset));
747template <std::memory_order order>
748Register GetTSANValueRegister(MacroAssembler* masm, Immediate value,
749 X64OperandConverter&
i,
753Register GetTSANValueRegister<std::memory_order_relaxed>(
754 MacroAssembler* masm, Immediate value, X64OperandConverter&
i,
757 masm->movq(value_reg, value);
760 masm->EncodeSandboxedPointer(value_reg);
764 masm->movl(value_reg,
766 ExposedTrustedObject::kSelfIndirectPointerOffset));
771template <std::memory_order order,
typename ValueT>
772void EmitTSANAwareStore(
Zone* zone, CodeGenerator* codegen,
773 MacroAssembler* masm, Operand operand, ValueT value,
781 if (codegen->code_kind() != CodeKind::FOR_TESTING) {
782 if (
instr->HasMemoryAccessMode()) {
783 RecordTrapInfoIfNeeded(zone, codegen,
instr->opcode(),
instr,
787 EmitMemoryProbeForTrapHandlerIfNeeded(masm,
i.TempRegister(0), operand,
788 stub_call_mode, size);
789 Register value_reg = GetTSANValueRegister<order>(masm, value,
i, rep);
790 EmitTSANStoreOOL(zone, codegen, masm, operand, value_reg,
i, stub_call_mode,
793 int store_instr_offset = EmitStore<order>(masm, operand, value, rep);
794 if (
instr->HasMemoryAccessMode()) {
795 RecordTrapInfoIfNeeded(zone, codegen,
instr->opcode(),
instr,
801class OutOfLineTSANRelaxedLoad final :
public OutOfLineCode {
803 OutOfLineTSANRelaxedLoad(CodeGenerator*
gen, Operand operand,
804 Register scratch0, StubCallMode stub_mode,
int size)
805 : OutOfLineCode(
gen),
808#if V8_ENABLE_WEBASSEMBLY
809 stub_mode_(stub_mode),
815 void Generate() final {
816 const SaveFPRegsMode save_fp_mode = frame()->DidAllocateDoubleRegisters()
817 ? SaveFPRegsMode::kSave
818 : SaveFPRegsMode::kIgnore;
821#if V8_ENABLE_WEBASSEMBLY
822 if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) {
827 StubCallMode::kCallWasmRuntimeStub);
833 StubCallMode::kCallBuiltinPointer);
839#if V8_ENABLE_WEBASSEMBLY
846void EmitTSANRelaxedLoadOOLIfNeeded(
Zone* zone, CodeGenerator* codegen,
847 MacroAssembler* masm, Operand operand,
855 if (codegen->code_kind() == CodeKind::FOR_TESTING)
return;
858 auto tsan_ool = zone->New<OutOfLineTSANRelaxedLoad>(codegen, operand,
860 masm->jmp(tsan_ool->entry());
861 masm->bind(tsan_ool->exit());
865template <std::memory_order order,
typename ValueT>
866void EmitTSANAwareStore(
Zone* zone, CodeGenerator* codegen,
867 MacroAssembler* masm, Operand operand, ValueT value,
870 DCHECK(order == std::memory_order_relaxed ||
871 order == std::memory_order_seq_cst);
872 int store_instr_off = EmitStore<order>(masm, operand, value, rep);
873 if (
instr->HasMemoryAccessMode()) {
874 RecordTrapInfoIfNeeded(zone, codegen,
instr->opcode(),
instr,
879void EmitTSANRelaxedLoadOOLIfNeeded(
Zone* zone, CodeGenerator* codegen,
880 MacroAssembler* masm, Operand operand,
887#define ASSEMBLE_UNOP(asm_instr) \
889 if (instr->Output()->IsRegister()) { \
890 __ asm_instr(i.OutputRegister()); \
892 __ asm_instr(i.OutputOperand()); \
896#define ASSEMBLE_BINOP(asm_instr) \
898 if (HasAddressingMode(instr)) { \
900 Operand right = i.MemoryOperand(&index); \
901 __ asm_instr(i.InputRegister(0), right); \
903 if (HasImmediateInput(instr, 1)) { \
904 if (HasRegisterInput(instr, 0)) { \
905 __ asm_instr(i.InputRegister(0), i.InputImmediate(1)); \
907 __ asm_instr(i.InputOperand(0), i.InputImmediate(1)); \
910 if (HasRegisterInput(instr, 1)) { \
911 __ asm_instr(i.InputRegister(0), i.InputRegister(1)); \
913 __ asm_instr(i.InputRegister(0), i.InputOperand(1)); \
919#define ASSEMBLE_COMPARE(cmp_instr, test_instr) \
921 if (HasAddressingMode(instr)) { \
923 Operand left = i.MemoryOperand(&index); \
924 if (HasImmediateInput(instr, index)) { \
925 __ cmp_instr(left, i.InputImmediate(index)); \
927 __ cmp_instr(left, i.InputRegister(index)); \
930 if (HasImmediateInput(instr, 1)) { \
931 Immediate right = i.InputImmediate(1); \
932 if (HasRegisterInput(instr, 0)) { \
933 if (right.value() == 0) { \
934 __ test_instr(i.InputRegister(0), i.InputRegister(0)); \
936 __ cmp_instr(i.InputRegister(0), right); \
939 __ cmp_instr(i.InputOperand(0), right); \
942 if (HasRegisterInput(instr, 1)) { \
943 __ cmp_instr(i.InputRegister(0), i.InputRegister(1)); \
945 __ cmp_instr(i.InputRegister(0), i.InputOperand(1)); \
951#define ASSEMBLE_TEST(asm_instr) \
953 if (HasAddressingMode(instr)) { \
955 Operand left = i.MemoryOperand(&index); \
956 if (HasImmediateInput(instr, index)) { \
957 __ asm_instr(left, i.InputImmediate(index)); \
959 __ asm_instr(left, i.InputRegister(index)); \
962 if (HasImmediateInput(instr, 1)) { \
963 if (HasRegisterInput(instr, 0)) { \
964 __ asm_instr(i.InputRegister(0), i.InputImmediate(1)); \
966 __ asm_instr(i.InputOperand(0), i.InputImmediate(1)); \
969 if (HasRegisterInput(instr, 1)) { \
970 __ asm_instr(i.InputRegister(0), i.InputRegister(1)); \
972 __ asm_instr(i.InputRegister(0), i.InputOperand(1)); \
978#define ASSEMBLE_MULT(asm_instr) \
980 if (HasImmediateInput(instr, 1)) { \
981 if (HasRegisterInput(instr, 0)) { \
982 __ asm_instr(i.OutputRegister(), i.InputRegister(0), \
983 i.InputImmediate(1)); \
985 __ asm_instr(i.OutputRegister(), i.InputOperand(0), \
986 i.InputImmediate(1)); \
989 if (HasRegisterInput(instr, 1)) { \
990 __ asm_instr(i.OutputRegister(), i.InputRegister(1)); \
992 __ asm_instr(i.OutputRegister(), i.InputOperand(1)); \
997#define ASSEMBLE_SHIFT(asm_instr, width) \
999 if (HasImmediateInput(instr, 1)) { \
1000 if (instr->Output()->IsRegister()) { \
1001 __ asm_instr(i.OutputRegister(), Immediate(i.InputInt##width(1))); \
1003 __ asm_instr(i.OutputOperand(), Immediate(i.InputInt##width(1))); \
1006 if (instr->Output()->IsRegister()) { \
1007 __ asm_instr##_cl(i.OutputRegister()); \
1009 __ asm_instr##_cl(i.OutputOperand()); \
1014#define ASSEMBLE_MOVX(asm_instr) \
1016 if (HasAddressingMode(instr)) { \
1017 __ asm_instr(i.OutputRegister(), i.MemoryOperand()); \
1018 } else if (HasRegisterInput(instr, 0)) { \
1019 __ asm_instr(i.OutputRegister(), i.InputRegister(0)); \
1021 __ asm_instr(i.OutputRegister(), i.InputOperand(0)); \
1025#define ASSEMBLE_SSE_BINOP(asm_instr) \
1027 if (HasAddressingMode(instr)) { \
1029 Operand right = i.MemoryOperand(&index); \
1030 __ asm_instr(i.InputDoubleRegister(0), right); \
1032 if (instr->InputAt(1)->IsFPRegister()) { \
1033 __ asm_instr(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); \
1035 __ asm_instr(i.InputDoubleRegister(0), i.InputOperand(1)); \
1040#define ASSEMBLE_SSE_UNOP(asm_instr) \
1042 if (instr->InputAt(0)->IsFPRegister()) { \
1043 __ asm_instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \
1045 __ asm_instr(i.OutputDoubleRegister(), i.InputOperand(0)); \
1049#define ASSEMBLE_AVX_BINOP(asm_instr) \
1051 CpuFeatureScope avx_scope(masm(), AVX); \
1052 if (HasAddressingMode(instr)) { \
1054 Operand right = i.MemoryOperand(&index); \
1055 __ asm_instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0), right); \
1057 if (instr->InputAt(1)->IsFPRegister()) { \
1058 __ asm_instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0), \
1059 i.InputDoubleRegister(1)); \
1061 __ asm_instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0), \
1062 i.InputOperand(1)); \
1067#define ASSEMBLE_IEEE754_BINOP(name) \
1069 __ PrepareCallCFunction(2); \
1070 __ CallCFunction(ExternalReference::ieee754_##name##_function(), 2); \
1073#define ASSEMBLE_IEEE754_UNOP(name) \
1075 __ PrepareCallCFunction(1); \
1076 __ CallCFunction(ExternalReference::ieee754_##name##_function(), 1); \
1079#define ASSEMBLE_ATOMIC_BINOP(bin_inst, mov_inst, cmpxchg_inst) \
1083 RecordTrapInfoIfNeeded(zone(), this, opcode, instr, __ pc_offset()); \
1084 __ mov_inst(rax, i.MemoryOperand(1)); \
1085 __ movl(i.TempRegister(0), rax); \
1086 __ bin_inst(i.TempRegister(0), i.InputRegister(0)); \
1088 __ cmpxchg_inst(i.MemoryOperand(1), i.TempRegister(0)); \
1089 __ j(not_equal, &binop); \
1092#define ASSEMBLE_ATOMIC64_BINOP(bin_inst, mov_inst, cmpxchg_inst) \
1096 RecordTrapInfoIfNeeded(zone(), this, opcode, instr, __ pc_offset()); \
1097 __ mov_inst(rax, i.MemoryOperand(1)); \
1098 __ movq(i.TempRegister(0), rax); \
1099 __ bin_inst(i.TempRegister(0), i.InputRegister(0)); \
1101 __ cmpxchg_inst(i.MemoryOperand(1), i.TempRegister(0)); \
1102 __ j(not_equal, &binop); \
1108#define ASSEMBLE_SIMD_BINOP(opcode) \
1110 if (CpuFeatures::IsSupported(AVX)) { \
1111 CpuFeatureScope avx_scope(masm(), AVX); \
1112 __ v##opcode(i.OutputSimd128Register(), i.InputSimd128Register(0), \
1113 i.InputSimd128Register(1)); \
1115 DCHECK_EQ(i.OutputSimd128Register(), i.InputSimd128Register(0)); \
1116 __ opcode(i.OutputSimd128Register(), i.InputSimd128Register(1)); \
1120#define ASSEMBLE_SIMD_F16x8_BINOP(instr) \
1122 CpuFeatureScope f16c_scope(masm(), F16C); \
1123 CpuFeatureScope avx_scope(masm(), AVX); \
1124 YMMRegister tmp1 = i.TempSimd256Register(0); \
1125 YMMRegister tmp2 = i.TempSimd256Register(1); \
1126 __ vcvtph2ps(tmp1, i.InputSimd128Register(0)); \
1127 __ vcvtph2ps(tmp2, i.InputSimd128Register(1)); \
1128 __ instr(tmp2, tmp1, tmp2); \
1129 __ vcvtps2ph(i.OutputSimd128Register(), tmp2, 0); \
1132#define ASSEMBLE_SIMD_F16x8_RELOP(instr) \
1134 CpuFeatureScope f16c_scope(masm(), F16C); \
1135 CpuFeatureScope avx_scope(masm(), AVX); \
1136 YMMRegister tmp1 = i.TempSimd256Register(0); \
1137 YMMRegister tmp2 = i.TempSimd256Register(1); \
1138 __ vcvtph2ps(tmp1, i.InputSimd128Register(0)); \
1139 __ vcvtph2ps(tmp2, i.InputSimd128Register(1)); \
1140 __ instr(tmp2, tmp1, tmp2); \
1141 __ vpackssdw(i.OutputSimd128Register(), tmp2, tmp2); \
1144#define ASSEMBLE_SIMD256_BINOP(opcode, cpu_feature) \
1146 CpuFeatureScope avx_scope(masm(), cpu_feature); \
1147 __ v##opcode(i.OutputSimd256Register(), i.InputSimd256Register(0), \
1148 i.InputSimd256Register(1)); \
1151#define ASSEMBLE_SIMD_INSTR(opcode, dst_operand, index) \
1153 if (instr->InputAt(index)->IsSimd128Register()) { \
1154 __ opcode(dst_operand, i.InputSimd128Register(index)); \
1156 __ opcode(dst_operand, i.InputOperand(index)); \
1160#define ASSEMBLE_SIMD_IMM_INSTR(opcode, dst_operand, index, imm) \
1162 if (instr->InputAt(index)->IsSimd128Register()) { \
1163 __ opcode(dst_operand, i.InputSimd128Register(index), imm); \
1165 __ opcode(dst_operand, i.InputOperand(index), imm); \
1169#define ASSEMBLE_SIMD_PUNPCK_SHUFFLE(opcode) \
1171 XMMRegister dst = i.OutputSimd128Register(); \
1172 uint8_t input_index = instr->InputCount() == 2 ? 1 : 0; \
1173 if (CpuFeatures::IsSupported(AVX)) { \
1174 CpuFeatureScope avx_scope(masm(), AVX); \
1175 DCHECK(instr->InputAt(input_index)->IsSimd128Register()); \
1176 __ v##opcode(dst, i.InputSimd128Register(0), \
1177 i.InputSimd128Register(input_index)); \
1179 DCHECK_EQ(dst, i.InputSimd128Register(0)); \
1180 ASSEMBLE_SIMD_INSTR(opcode, dst, input_index); \
1184#define ASSEMBLE_SIMD_IMM_SHUFFLE(opcode, imm) \
1186 XMMRegister dst = i.OutputSimd128Register(); \
1187 XMMRegister src = i.InputSimd128Register(0); \
1188 if (CpuFeatures::IsSupported(AVX)) { \
1189 CpuFeatureScope avx_scope(masm(), AVX); \
1190 DCHECK(instr->InputAt(1)->IsSimd128Register()); \
1191 __ v##opcode(dst, src, i.InputSimd128Register(1), imm); \
1193 DCHECK_EQ(dst, src); \
1194 if (instr->InputAt(1)->IsSimd128Register()) { \
1195 __ opcode(dst, i.InputSimd128Register(1), imm); \
1197 __ opcode(dst, i.InputOperand(1), imm); \
1202#define ASSEMBLE_SIMD_ALL_TRUE(opcode) \
1204 Register dst = i.OutputRegister(); \
1205 __ xorq(dst, dst); \
1206 __ Pxor(kScratchDoubleReg, kScratchDoubleReg); \
1207 __ opcode(kScratchDoubleReg, i.InputSimd128Register(0)); \
1208 __ Ptest(kScratchDoubleReg, kScratchDoubleReg); \
1209 __ setcc(equal, dst); \
1215#define ASSEMBLE_SIMD_SHIFT(opcode, width) \
1217 XMMRegister dst = i.OutputSimd128Register(); \
1218 if (HasImmediateInput(instr, 1)) { \
1219 if (CpuFeatures::IsSupported(AVX)) { \
1220 CpuFeatureScope avx_scope(masm(), AVX); \
1221 __ v##opcode(dst, i.InputSimd128Register(0), \
1222 uint8_t{i.InputInt##width(1)}); \
1224 DCHECK_EQ(dst, i.InputSimd128Register(0)); \
1225 __ opcode(dst, uint8_t{i.InputInt##width(1)}); \
1228 constexpr int mask = (1 << width) - 1; \
1229 __ movq(kScratchRegister, i.InputRegister(1)); \
1230 __ andq(kScratchRegister, Immediate(mask)); \
1231 __ Movq(kScratchDoubleReg, kScratchRegister); \
1232 if (CpuFeatures::IsSupported(AVX)) { \
1233 CpuFeatureScope avx_scope(masm(), AVX); \
1234 __ v##opcode(dst, i.InputSimd128Register(0), kScratchDoubleReg); \
1236 DCHECK_EQ(dst, i.InputSimd128Register(0)); \
1237 __ opcode(dst, kScratchDoubleReg); \
1242#define ASSEMBLE_SIMD256_SHIFT(opcode, width) \
1244 CpuFeatureScope avx_scope(masm(), AVX2); \
1245 YMMRegister src = i.InputSimd256Register(0); \
1246 YMMRegister dst = i.OutputSimd256Register(); \
1247 if (HasImmediateInput(instr, 1)) { \
1248 __ v##opcode(dst, src, uint8_t{i.InputInt##width(1)}); \
1250 constexpr int mask = (1 << width) - 1; \
1251 __ movq(kScratchRegister, i.InputRegister(1)); \
1252 __ andq(kScratchRegister, Immediate(mask)); \
1253 __ Movq(kScratchDoubleReg, kScratchRegister); \
1254 __ v##opcode(dst, src, kScratchDoubleReg); \
1258#define ASSEMBLE_PINSR(ASM_INSTR) \
1260 XMMRegister dst = i.OutputSimd128Register(); \
1261 XMMRegister src = i.InputSimd128Register(0); \
1262 uint8_t laneidx = i.InputUint8(1); \
1263 uint32_t load_offset; \
1264 if (HasAddressingMode(instr)) { \
1265 __ ASM_INSTR(dst, src, i.MemoryOperand(2), laneidx, &load_offset); \
1266 } else if (instr->InputAt(2)->IsFPRegister()) { \
1267 __ Movq(kScratchRegister, i.InputDoubleRegister(2)); \
1268 __ ASM_INSTR(dst, src, kScratchRegister, laneidx, &load_offset); \
1269 } else if (instr->InputAt(2)->IsRegister()) { \
1270 __ ASM_INSTR(dst, src, i.InputRegister(2), laneidx, &load_offset); \
1272 __ ASM_INSTR(dst, src, i.InputOperand(2), laneidx, &load_offset); \
1274 RecordTrapInfoIfNeeded(zone(), this, opcode, instr, load_offset); \
1277#define ASSEMBLE_SEQ_CST_STORE(rep) \
1279 Register value = i.InputRegister(0); \
1280 Operand operand = i.MemoryOperand(1); \
1281 EmitTSANAwareStore<std::memory_order_seq_cst>( \
1282 zone(), this, masm(), operand, value, i, DetermineStubCallMode(), rep, \
1301void AdjustStackPointerForTailCall(Instruction*
instr,
1302 MacroAssembler* assembler, Linkage*
linkage,
1303 OptimizedCompilationInfo* info,
1304 FrameAccessState* state,
1305 int new_slot_above_sp,
1306 bool allow_shrinkage =
true) {
1307 int stack_slot_delta;
1318 DCHECK_EQ(state->frame()->GetReturnSlotCount(), 0);
1319 stack_slot_delta = (state->frame()->GetTotalFrameSlotCount() -
1324 int current_sp_offset = state->GetSPToFPSlotCount() +
1326 stack_slot_delta = new_slot_above_sp - current_sp_offset;
1329 if (stack_slot_delta > 0) {
1331 state->IncreaseSPDelta(stack_slot_delta);
1332 }
else if (allow_shrinkage && stack_slot_delta < 0) {
1334 state->IncreaseSPDelta(stack_slot_delta);
1338void SetupSimdImmediateInRegister(MacroAssembler* assembler, uint32_t* imms,
1344void SetupSimd256ImmediateInRegister(MacroAssembler* assembler, uint32_t* imms,
1345 YMMRegister
reg, XMMRegister scratch) {
1347 [imms](uint32_t v) {
return v == imms[0]; });
1349 assembler->Move(scratch, imms[0]);
1350 CpuFeatureScope avx_scope(assembler, AVX2);
1351 assembler->vpbroadcastd(
reg, scratch);
1355 assembler->Move(scratch,
make_uint64(imms[7], imms[6]),
1357 CpuFeatureScope avx_scope(assembler, AVX2);
1358 assembler->vinserti128(
reg,
reg, scratch, uint8_t{1});
1365 int first_unused_slot_offset) {
1367 ZoneVector<MoveOperands*> pushes(
zone());
1370 if (!pushes.empty() &&
1372 first_unused_slot_offset)) {
1374 X64OperandConverter g(
this,
instr);
1375 for (
auto move : pushes) {
1376 LocationOperand destination_location(
1378 InstructionOperand
source(move->source());
1381 destination_location.index());
1382 if (source.IsStackSlot()) {
1384 __ Push(g.SlotToOperand(source_location.index()));
1385 }
else if (source.IsRegister()) {
1387 __ Push(source_location.GetRegister());
1388 }
else if (source.IsImmediate()) {
1389 __ Push(Immediate(ImmediateOperand::cast(source).inline_int32_value()));
1404 int first_unused_slot_offset) {
1411 __ ComputeCodeStartAddress(rbx);
1416#ifdef V8_ENABLE_LEAPTIERING
1418void CodeGenerator::AssembleDispatchHandleRegisterCheck() {
1419 DCHECK(
linkage()->GetIncomingDescriptor()->IsJSFunctionCall());
1435 __ LoadParameterCountFromJSDispatchTable(
1438 __ Assert(
equal, AbortReason::kWrongFunctionDispatchHandle);
1464 if (
info()->shadow_stack_compliant_lazy_deopt() &&
1472 Instruction*
instr) {
1473 X64OperandConverter
i(
this,
instr);
1479 Register
reg =
i.OutputRegister(
instr->OutputCount() - 1);
1482 switch (arch_opcode) {
1483 case kX64TraceInstruction: {
1484 __ emit_trace_instruction(
i.InputImmediate(0));
1487 case kArchCallCodeObject: {
1494 i.InputCodeEntrypointTag(
instr->CodeEnrypointTagInputIndex());
1498 __ LoadCodeInstructionStart(
reg,
reg, tag);
1506 case kArchCallBuiltinPointer: {
1508 Register builtin_index =
i.InputRegister(0);
1509 __ CallBuiltinByIndex(builtin_index);
1515#if V8_ENABLE_WEBASSEMBLY
1516 case kArchCallWasmFunction:
1517 case kArchCallWasmFunctionIndirect: {
1518 if (arch_opcode == kArchCallWasmFunction) {
1522 Constant constant =
i.ToConstant(
instr->InputAt(0));
1525 __ near_call(wasm_code, constant.rmode());
1527 __ Call(wasm_code, constant.rmode());
1532 __ CallWasmCodePointer(
1534 i.InputInt64(
instr->WasmSignatureHashInputIndex()));
1541 case kArchTailCallWasm:
1542 case kArchTailCallWasmIndirect: {
1543 if (arch_opcode == kArchTailCallWasm) {
1545 Constant constant =
i.ToConstant(
instr->InputAt(0));
1548 __ near_jmp(wasm_code, constant.rmode());
1555 __ CallWasmCodePointer(
1557 i.InputInt64(
instr->WasmSignatureHashInputIndex()),
1566 case kArchTailCallCodeObject: {
1573 i.InputCodeEntrypointTag(
instr->CodeEnrypointTagInputIndex());
1577 __ LoadCodeInstructionStart(
reg,
reg, tag);
1585 case kArchTailCallAddress: {
1597 case kArchCallJSFunction: {
1601 __ cmp_tagged(rsi,
FieldOperand(func, JSFunction::kContextOffset));
1605 uint32_t num_arguments =
1606 i.InputUint32(
instr->JSCallArgumentCountInputIndex());
1607 __ CallJSFunction(func, num_arguments);
1613 case kArchPrepareCallCFunction: {
1617 __ PrepareCallCFunction(num_parameters);
1620 case kArchSaveCallerRegisters: {
1634 case kArchRestoreCallerRegisters: {
1647 case kArchPrepareTailCall:
1650 case kArchCallCFunctionWithFrameState:
1651 case kArchCallCFunction: {
1654 Label return_location;
1656#if V8_ENABLE_WEBASSEMBLY
1657 if (
linkage()->GetIncomingDescriptor()->IsWasmCapiFunction()) {
1660 __ movq(
MemOperand(rbp, WasmExitFrameConstants::kCallingPCOffset),
1667 ExternalReference ref =
i.InputExternalReference(0);
1668 pc_offset =
__ CallCFunction(ref, num_gp_parameters + num_fp_parameters,
1669 set_isolate_data_slots, &return_location);
1673 __ CallCFunction(func, num_gp_parameters + num_fp_parameters,
1674 set_isolate_data_slots, &return_location);
1679 bool const needs_frame_state =
1680 (arch_opcode == kArchCallCFunctionWithFrameState);
1681 if (needs_frame_state) {
1708 case kArchBinarySearchSwitch:
1711 case kArchTableSwitch:
1715 __ RecordComment(
reinterpret_cast<const char*
>(
i.InputInt64(0)),
1718 case kArchAbortCSADcheck:
1719 DCHECK(
i.InputRegister(0) == rdx);
1724 __ CallBuiltin(Builtin::kAbortCSADcheck);
1729 case kArchDebugBreak:
1732 case kArchThrowTerminator:
1738 case kArchDeoptimize: {
1739 DeoptimizationExit* exit =
1741 __ jmp(exit->label());
1747 case kArchFramePointer:
1748 __ movq(
i.OutputRegister(), rbp);
1750#if V8_ENABLE_WEBASSEMBLY
1751 case kArchStackPointer:
1752 __ movq(
i.OutputRegister(), rsp);
1754 case kArchSetStackPointer:
1755 if (
instr->InputAt(0)->IsRegister()) {
1756 __ movq(rsp,
i.InputRegister(0));
1758 __ movq(rsp,
i.InputOperand(0));
1762 case kArchParentFramePointer:
1764 __ movq(
i.OutputRegister(), Operand(rbp, 0));
1766 __ movq(
i.OutputRegister(), rbp);
1769 case kArchStackPointerGreaterThan: {
1779 __ leaq(lhs_register, Operand(rsp,
static_cast<int32_t>(
offset) * -1));
1782 constexpr size_t kValueIndex = 0;
1783 if (HasAddressingMode(
instr)) {
1784 __ cmpq(lhs_register,
i.MemoryOperand(kValueIndex));
1786 __ cmpq(lhs_register,
i.InputRegister(kValueIndex));
1790 case kArchStackCheckOffset:
1793 case kArchTruncateDoubleToI: {
1794 auto result =
i.OutputRegister();
1795 auto input =
i.InputDoubleRegister(0);
1796 auto ool =
zone()->
New<OutOfLineTruncateDoubleToI>(
1803 __ j(overflow, ool->entry());
1804 __ bind(ool->exit());
1808 case kArchStoreWithWriteBarrier:
1809 case kArchAtomicStoreWithWriteBarrier: {
1817 Operand operand =
i.MemoryOperand(&index);
1818 Register value =
i.InputRegister(index);
1826 __ Check(
not_equal, AbortReason::kOperandIsCleared);
1829 auto ool =
zone()->
New<OutOfLineRecordWrite>(
this, object, operand,
value,
1830 scratch0, scratch1,
mode,
1832 if (arch_opcode == kArchStoreWithWriteBarrier) {
1833 EmitTSANAwareStore<std::memory_order_relaxed>(
1837 DCHECK_EQ(arch_opcode, kArchAtomicStoreWithWriteBarrier);
1838 EmitTSANAwareStore<std::memory_order_seq_cst>(
1843 __ JumpIfSmi(value, ool->exit());
1845#if V8_ENABLE_STICKY_MARK_BITS_BOOL
1848 __ CheckMarkBit(
object, scratch0, scratch1,
carry, ool->entry());
1851 __ CheckPageFlag(
object, scratch0,
1855 __ bind(ool->exit());
1858 case kArchStoreIndirectWithWriteBarrier: {
1863 Operand operand =
i.MemoryOperand(&index);
1864 Register value =
i.InputRegister(index++);
1871 auto ool =
zone()->
New<OutOfLineRecordWrite>(
1872 this, object, operand,
value, scratch0, scratch1,
mode,
1874 EmitTSANAwareStore<std::memory_order_relaxed>(
1877 __ JumpIfMarking(ool->entry());
1878 __ bind(ool->exit());
1887 case kArchStackSlot: {
1891 __ leaq(
i.OutputRegister(), Operand(base,
offset.offset()));
1894 case kIeee754Float64Acos:
1897 case kIeee754Float64Acosh:
1900 case kIeee754Float64Asin:
1903 case kIeee754Float64Asinh:
1906 case kIeee754Float64Atan:
1909 case kIeee754Float64Atanh:
1912 case kIeee754Float64Atan2:
1915 case kIeee754Float64Cbrt:
1918 case kIeee754Float64Cos:
1921 case kIeee754Float64Cosh:
1924 case kIeee754Float64Exp:
1927 case kIeee754Float64Expm1:
1930 case kIeee754Float64Log:
1933 case kIeee754Float64Log1p:
1936 case kIeee754Float64Log2:
1939 case kIeee754Float64Log10:
1942 case kIeee754Float64Pow:
1945 case kIeee754Float64Sin:
1948 case kIeee754Float64Sinh:
1951 case kIeee754Float64Tan:
1954 case kIeee754Float64Tanh:
2037 case kX64ImulHigh32:
2039 __ imull(
i.InputRegister(1));
2041 __ imull(
i.InputOperand(1));
2044 case kX64UmulHigh32:
2046 __ mull(
i.InputRegister(1));
2048 __ mull(
i.InputOperand(1));
2051 case kX64ImulHigh64:
2053 __ imulq(
i.InputRegister(1));
2055 __ imulq(
i.InputOperand(1));
2058 case kX64UmulHigh64:
2060 __ mulq(
i.InputRegister(1));
2062 __ mulq(
i.InputOperand(1));
2067 __ idivl(
i.InputRegister(1));
2071 __ idivq(
i.InputRegister(1));
2075 __ divl(
i.InputRegister(1));
2079 __ divq(
i.InputRegister(1));
2137 __ Lzcntq(
i.OutputRegister(),
i.InputRegister(0));
2139 __ Lzcntq(
i.OutputRegister(),
i.InputOperand(0));
2144 __ Lzcntl(
i.OutputRegister(),
i.InputRegister(0));
2146 __ Lzcntl(
i.OutputRegister(),
i.InputOperand(0));
2151 __ Tzcntq(
i.OutputRegister(),
i.InputRegister(0));
2153 __ Tzcntq(
i.OutputRegister(),
i.InputOperand(0));
2158 __ Tzcntl(
i.OutputRegister(),
i.InputRegister(0));
2160 __ Tzcntl(
i.OutputRegister(),
i.InputOperand(0));
2165 __ Popcntq(
i.OutputRegister(),
i.InputRegister(0));
2167 __ Popcntq(
i.OutputRegister(),
i.InputOperand(0));
2172 __ Popcntl(
i.OutputRegister(),
i.InputRegister(0));
2174 __ Popcntl(
i.OutputRegister(),
i.InputOperand(0));
2178 __ bswapq(
i.OutputRegister());
2181 __ bswapl(
i.OutputRegister());
2183 case kSSEFloat32Cmp:
2186 case kSSEFloat32Add:
2190 case kSSEFloat32Sub:
2194 case kSSEFloat32Mul:
2198 case kSSEFloat32Div:
2203 __ movaps(
i.OutputDoubleRegister(),
i.OutputDoubleRegister());
2205 case kSSEFloat32Sqrt:
2208 case kSSEFloat32ToFloat64:
2211 case kSSEFloat32Round: {
2212 CpuFeatureScope sse_scope(
masm(), SSE4_1);
2215 __ Roundss(
i.OutputDoubleRegister(),
i.InputDoubleRegister(0), mode);
2218 case kSSEFloat32ToInt32:
2219 if (
instr->InputAt(0)->IsFPRegister()) {
2220 __ Cvttss2si(
i.OutputRegister(),
i.InputDoubleRegister(0));
2222 __ Cvttss2si(
i.OutputRegister(),
i.InputOperand(0));
2225 case kSSEFloat32ToUint32: {
2226 if (
instr->InputAt(0)->IsFPRegister()) {
2227 __ Cvttss2siq(
i.OutputRegister(),
i.InputDoubleRegister(0));
2229 __ Cvttss2siq(
i.OutputRegister(),
i.InputOperand(0));
2233 case kSSEFloat64Cmp:
2236 case kSSEFloat64Add:
2240 case kSSEFloat64Sub:
2244 case kSSEFloat64Mul:
2248 case kSSEFloat64Div:
2253 __ Movapd(
i.OutputDoubleRegister(),
i.OutputDoubleRegister());
2255 case kSSEFloat64Mod: {
2260 __ Movsd(Operand(rsp, 0),
i.InputDoubleRegister(1));
2261 __ fld_d(Operand(rsp, 0));
2262 __ Movsd(Operand(rsp, 0),
i.InputDoubleRegister(0));
2263 __ fld_d(Operand(rsp, 0));
2273 CpuFeatureScope sahf_scope(
masm(), SAHF);
2276 __ shrl(rax, Immediate(8));
2277 __ andl(rax, Immediate(0xFF));
2288 __ fstp_d(Operand(rsp, 0));
2289 __ Movsd(
i.OutputDoubleRegister(), Operand(rsp, 0));
2295 case kSSEFloat32Max: {
2296 Label compare_swap, done_compare;
2297 if (
instr->InputAt(1)->IsFPRegister()) {
2298 __ Ucomiss(
i.InputDoubleRegister(0),
i.InputDoubleRegister(1));
2300 __ Ucomiss(
i.InputDoubleRegister(0),
i.InputOperand(1));
2303 zone()->
New<OutOfLineLoadFloat32NaN>(
this,
i.OutputDoubleRegister());
2310 __ bind(&compare_swap);
2311 if (
instr->InputAt(1)->IsFPRegister()) {
2312 __ Movss(
i.InputDoubleRegister(0),
i.InputDoubleRegister(1));
2314 __ Movss(
i.InputDoubleRegister(0),
i.InputOperand(1));
2316 __ bind(&done_compare);
2317 __ bind(ool->exit());
2320 case kSSEFloat32Min: {
2321 Label compare_swap, done_compare;
2322 if (
instr->InputAt(1)->IsFPRegister()) {
2323 __ Ucomiss(
i.InputDoubleRegister(0),
i.InputDoubleRegister(1));
2325 __ Ucomiss(
i.InputDoubleRegister(0),
i.InputOperand(1));
2328 zone()->
New<OutOfLineLoadFloat32NaN>(
this,
i.OutputDoubleRegister());
2332 if (
instr->InputAt(1)->IsFPRegister()) {
2340 __ bind(&compare_swap);
2341 if (
instr->InputAt(1)->IsFPRegister()) {
2342 __ Movss(
i.InputDoubleRegister(0),
i.InputDoubleRegister(1));
2344 __ Movss(
i.InputDoubleRegister(0),
i.InputOperand(1));
2346 __ bind(&done_compare);
2347 __ bind(ool->exit());
2350 case kSSEFloat64Max: {
2351 Label compare_swap, done_compare;
2352 if (
instr->InputAt(1)->IsFPRegister()) {
2353 __ Ucomisd(
i.InputDoubleRegister(0),
i.InputDoubleRegister(1));
2355 __ Ucomisd(
i.InputDoubleRegister(0),
i.InputOperand(1));
2358 zone()->
New<OutOfLineLoadFloat64NaN>(
this,
i.OutputDoubleRegister());
2365 __ bind(&compare_swap);
2366 if (
instr->InputAt(1)->IsFPRegister()) {
2367 __ Movsd(
i.InputDoubleRegister(0),
i.InputDoubleRegister(1));
2369 __ Movsd(
i.InputDoubleRegister(0),
i.InputOperand(1));
2371 __ bind(&done_compare);
2372 __ bind(ool->exit());
2375 case kSSEFloat64Min: {
2376 Label compare_swap, done_compare;
2377 if (
instr->InputAt(1)->IsFPRegister()) {
2378 __ Ucomisd(
i.InputDoubleRegister(0),
i.InputDoubleRegister(1));
2380 __ Ucomisd(
i.InputDoubleRegister(0),
i.InputOperand(1));
2383 zone()->
New<OutOfLineLoadFloat64NaN>(
this,
i.OutputDoubleRegister());
2387 if (
instr->InputAt(1)->IsFPRegister()) {
2395 __ bind(&compare_swap);
2396 if (
instr->InputAt(1)->IsFPRegister()) {
2397 __ Movsd(
i.InputDoubleRegister(0),
i.InputDoubleRegister(1));
2399 __ Movsd(
i.InputDoubleRegister(0),
i.InputOperand(1));
2401 __ bind(&done_compare);
2402 __ bind(ool->exit());
2405 case kSSEFloat64Sqrt:
2408 case kSSEFloat64Round: {
2409 CpuFeatureScope sse_scope(
masm(), SSE4_1);
2412 __ Roundsd(
i.OutputDoubleRegister(),
i.InputDoubleRegister(0), mode);
2415 case kSSEFloat64ToFloat16RawBits: {
2416 XMMRegister tmp_dst =
i.TempDoubleRegister(0);
2417 __ Cvtpd2ph(tmp_dst,
i.InputDoubleRegister(0),
i.TempRegister(1));
2418 __ Pextrw(
i.OutputRegister(), tmp_dst,
static_cast<uint8_t
>(0));
2421 case kSSEFloat16RawBitsToFloat64: {
2422 XMMRegister tmp_dst =
i.TempDoubleRegister(0);
2424 __ Movq(tmp_dst,
i.InputRegister(0));
2425 __ Cvtph2pd(
i.OutputDoubleRegister(), tmp_dst);
2428 case kSSEFloat64ToFloat32:
2431 case kSSEFloat64ToInt32: {
2432 Register output_reg =
i.OutputRegister(0);
2433 if (
instr->OutputCount() == 1) {
2434 if (
instr->InputAt(0)->IsFPRegister()) {
2435 __ Cvttsd2si(
i.OutputRegister(),
i.InputDoubleRegister(0));
2437 __ Cvttsd2si(
i.OutputRegister(),
i.InputOperand(0));
2442 Register success_reg =
i.OutputRegister(1);
2445 if (
instr->InputAt(0)->IsFPRegister()) {
2447 __ Cvttsd2si(output_reg,
i.InputDoubleRegister(0));
2452 __ Cvttsd2si(output_reg, rounded);
2455 __ Cvtlsi2sd(converted_back, output_reg);
2458 __ Cmpeqsd(converted_back, rounded);
2459 __ Movq(success_reg, converted_back);
2460 __ And(success_reg, Immediate(1));
2463 if (
instr->InputAt(0)->IsFPRegister()) {
2464 __ Cvttsd2si(
i.OutputRegister(0),
i.InputDoubleRegister(0));
2466 __ Cvttsd2si(
i.OutputRegister(0),
i.InputOperand(0));
2468 __ Move(success_reg, 1);
2472 if (
instr->InputAt(0)->IsFPRegister()) {
2481 __ cmpl(output_reg, Immediate(1));
2486 __ Move(success_reg, 0);
2491 case kSSEFloat64ToUint32: {
2494 if (
instr->OutputCount() > 1)
__ Move(
i.OutputRegister(1), 0);
2495 if (
instr->InputAt(0)->IsFPRegister()) {
2496 __ Cvttsd2ui(
i.OutputRegister(),
i.InputDoubleRegister(0), &fail);
2498 __ Cvttsd2ui(
i.OutputRegister(),
i.InputOperand(0), &fail);
2503 if (
instr->OutputCount() > 1)
__ Move(
i.OutputRegister(1), 1);
2507 case kSSEFloat32ToInt64: {
2508 Register output_reg =
i.OutputRegister(0);
2509 if (
instr->OutputCount() == 1) {
2510 if (
instr->InputAt(0)->IsFPRegister()) {
2511 __ Cvttss2siq(output_reg,
i.InputDoubleRegister(0));
2513 __ Cvttss2siq(output_reg,
i.InputOperand(0));
2518 Register success_reg =
i.OutputRegister(1);
2521 if (
instr->InputAt(0)->IsFPRegister()) {
2523 __ Cvttss2siq(output_reg,
i.InputDoubleRegister(0));
2528 __ Cvttss2siq(output_reg, rounded);
2531 __ Cvtqsi2ss(converted_back, output_reg);
2534 __ Cmpeqss(converted_back, rounded);
2535 __ Movq(success_reg, converted_back);
2536 __ And(success_reg, Immediate(1));
2539 if (
instr->InputAt(0)->IsFPRegister()) {
2540 __ Cvttss2siq(
i.OutputRegister(),
i.InputDoubleRegister(0));
2542 __ Cvttss2siq(
i.OutputRegister(),
i.InputOperand(0));
2544 __ Move(success_reg, 1);
2548 if (
instr->InputAt(0)->IsFPRegister()) {
2557 __ cmpq(output_reg, Immediate(1));
2562 __ Move(success_reg, 0);
2567 case kSSEFloat64ToInt64: {
2568 Register output_reg =
i.OutputRegister(0);
2569 if (
instr->OutputCount() == 1) {
2570 if (
instr->InputAt(0)->IsFPRegister()) {
2571 __ Cvttsd2siq(output_reg,
i.InputDoubleRegister(0));
2573 __ Cvttsd2siq(output_reg,
i.InputOperand(0));
2578 Register success_reg =
i.OutputRegister(1);
2581 if (
instr->InputAt(0)->IsFPRegister()) {
2583 __ Cvttsd2siq(output_reg,
i.InputDoubleRegister(0));
2588 __ Cvttsd2siq(output_reg, rounded);
2591 __ Cvtqsi2sd(converted_back, output_reg);
2594 __ Cmpeqsd(converted_back, rounded);
2595 __ Movq(success_reg, converted_back);
2596 __ And(success_reg, Immediate(1));
2599 if (
instr->InputAt(0)->IsFPRegister()) {
2600 __ Cvttsd2siq(
i.OutputRegister(0),
i.InputDoubleRegister(0));
2602 __ Cvttsd2siq(
i.OutputRegister(0),
i.InputOperand(0));
2604 __ Move(success_reg, 1);
2608 if (
instr->InputAt(0)->IsFPRegister()) {
2617 __ cmpq(output_reg, Immediate(1));
2622 __ Move(success_reg, 0);
2627 case kSSEFloat32ToUint64: {
2630 if (
instr->OutputCount() > 1)
__ Move(
i.OutputRegister(1), 0);
2631 if (
instr->InputAt(0)->IsFPRegister()) {
2632 __ Cvttss2uiq(
i.OutputRegister(),
i.InputDoubleRegister(0), &fail);
2634 __ Cvttss2uiq(
i.OutputRegister(),
i.InputOperand(0), &fail);
2636 if (
instr->OutputCount() > 1)
__ Move(
i.OutputRegister(1), 1);
2640 case kSSEFloat64ToUint64: {
2643 if (
instr->OutputCount() > 1)
__ Move(
i.OutputRegister(1), 0);
2644 if (
instr->InputAt(0)->IsFPRegister()) {
2645 __ Cvttsd2uiq(
i.OutputRegister(),
i.InputDoubleRegister(0), &fail);
2647 __ Cvttsd2uiq(
i.OutputRegister(),
i.InputOperand(0), &fail);
2649 if (
instr->OutputCount() > 1)
__ Move(
i.OutputRegister(1), 1);
2653 case kSSEInt32ToFloat64:
2655 __ Cvtlsi2sd(
i.OutputDoubleRegister(),
i.InputRegister(0));
2657 __ Cvtlsi2sd(
i.OutputDoubleRegister(),
i.InputOperand(0));
2660 case kSSEInt32ToFloat32:
2662 __ Cvtlsi2ss(
i.OutputDoubleRegister(),
i.InputRegister(0));
2664 __ Cvtlsi2ss(
i.OutputDoubleRegister(),
i.InputOperand(0));
2667 case kSSEInt64ToFloat32:
2669 __ Cvtqsi2ss(
i.OutputDoubleRegister(),
i.InputRegister(0));
2671 __ Cvtqsi2ss(
i.OutputDoubleRegister(),
i.InputOperand(0));
2674 case kSSEInt64ToFloat64:
2676 __ Cvtqsi2sd(
i.OutputDoubleRegister(),
i.InputRegister(0));
2678 __ Cvtqsi2sd(
i.OutputDoubleRegister(),
i.InputOperand(0));
2681 case kSSEUint64ToFloat32:
2683 __ Cvtqui2ss(
i.OutputDoubleRegister(),
i.InputRegister(0));
2685 __ Cvtqui2ss(
i.OutputDoubleRegister(),
i.InputOperand(0));
2688 case kSSEUint64ToFloat64:
2690 __ Cvtqui2sd(
i.OutputDoubleRegister(),
i.InputRegister(0));
2692 __ Cvtqui2sd(
i.OutputDoubleRegister(),
i.InputOperand(0));
2695 case kSSEUint32ToFloat64:
2697 __ Cvtlui2sd(
i.OutputDoubleRegister(),
i.InputRegister(0));
2699 __ Cvtlui2sd(
i.OutputDoubleRegister(),
i.InputOperand(0));
2702 case kSSEUint32ToFloat32:
2704 __ Cvtlui2ss(
i.OutputDoubleRegister(),
i.InputRegister(0));
2706 __ Cvtlui2ss(
i.OutputDoubleRegister(),
i.InputOperand(0));
2709 case kSSEFloat64ExtractLowWord32:
2710 if (
instr->InputAt(0)->IsFPStackSlot()) {
2711 __ movl(
i.OutputRegister(),
i.InputOperand(0));
2713 __ Movd(
i.OutputRegister(),
i.InputDoubleRegister(0));
2716 case kSSEFloat64ExtractHighWord32:
2717 if (
instr->InputAt(0)->IsFPStackSlot()) {
2720 __ Pextrd(
i.OutputRegister(),
i.InputDoubleRegister(0), 1);
2723 case kSSEFloat64InsertLowWord32:
2725 __ Pinsrd(
i.OutputDoubleRegister(),
i.InputRegister(1), 0);
2727 __ Pinsrd(
i.OutputDoubleRegister(),
i.InputOperand(1), 0);
2730 case kSSEFloat64InsertHighWord32:
2732 __ Pinsrd(
i.OutputDoubleRegister(),
i.InputRegister(1), 1);
2734 __ Pinsrd(
i.OutputDoubleRegister(),
i.InputOperand(1), 1);
2737 case kSSEFloat64LoadLowWord32:
2739 __ Movd(
i.OutputDoubleRegister(),
i.InputRegister(0));
2741 __ Movd(
i.OutputDoubleRegister(),
i.InputOperand(0));
2744 case kAVXFloat32Cmp: {
2745 CpuFeatureScope avx_scope(
masm(), AVX);
2746 if (
instr->InputAt(1)->IsFPRegister()) {
2747 __ vucomiss(
i.InputDoubleRegister(0),
i.InputDoubleRegister(1));
2749 __ vucomiss(
i.InputDoubleRegister(0),
i.InputOperand(1));
2753 case kAVXFloat32Add:
2757 case kAVXFloat32Sub:
2761 case kAVXFloat32Mul:
2765 case kAVXFloat32Div:
2770 __ Movaps(
i.OutputDoubleRegister(),
i.OutputDoubleRegister());
2772 case kAVXFloat64Cmp: {
2773 CpuFeatureScope avx_scope(
masm(), AVX);
2774 if (
instr->InputAt(1)->IsFPRegister()) {
2775 __ vucomisd(
i.InputDoubleRegister(0),
i.InputDoubleRegister(1));
2777 __ vucomisd(
i.InputDoubleRegister(0),
i.InputOperand(1));
2781 case kAVXFloat64Add:
2785 case kAVXFloat64Sub:
2789 case kAVXFloat64Mul:
2793 case kAVXFloat64Div:
2798 __ Movapd(
i.OutputDoubleRegister(),
i.OutputDoubleRegister());
2800 case kX64Float32Abs: {
2801 __ Absps(
i.OutputDoubleRegister(),
i.InputDoubleRegister(0),
2805 case kX64Float32Neg: {
2806 __ Negps(
i.OutputDoubleRegister(),
i.InputDoubleRegister(0),
2812 VectorLength vec_len = VectorLengthField::decode(opcode);
2813 if (vec_len == kV128) {
2814 switch (lane_size) {
2817 CpuFeatureScope avx_scope(
masm(), AVX);
2818 __ Absph(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
2824 __ Absps(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
2830 __ Abspd(
i.OutputDoubleRegister(),
i.InputDoubleRegister(0),
2837 }
else if (vec_len == kV256) {
2838 switch (lane_size) {
2841 YMMRegister dst =
i.OutputSimd256Register();
2842 YMMRegister src =
i.InputSimd256Register(0);
2843 CpuFeatureScope avx_scope(
masm(), AVX2);
2850 __ vpcmpeqd(dst, dst, dst);
2851 __ vpsrld(dst, dst, uint8_t{1});
2852 __ vpand(dst, dst, src);
2858 YMMRegister dst =
i.OutputSimd256Register();
2859 YMMRegister src =
i.InputSimd256Register(0);
2860 CpuFeatureScope avx_scope(
masm(), AVX2);
2867 __ vpcmpeqq(dst, dst, dst);
2868 __ vpsrlq(dst, dst, uint8_t{1});
2869 __ vpand(dst, dst, src);
2881 case kX64Float64Abs: {
2882 __ Abspd(
i.OutputDoubleRegister(),
i.InputDoubleRegister(0),
2888 VectorLength vec_len = VectorLengthField::decode(opcode);
2889 if (vec_len == kV128) {
2890 switch (lane_size) {
2893 CpuFeatureScope avx_scope(
masm(), AVX);
2894 __ Negph(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
2900 __ Negps(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
2906 __ Negpd(
i.OutputDoubleRegister(),
i.InputDoubleRegister(0),
2913 }
else if (vec_len == kV256) {
2914 switch (lane_size) {
2917 YMMRegister dst =
i.OutputSimd256Register();
2918 YMMRegister src =
i.InputSimd256Register(0);
2919 CpuFeatureScope avx_scope(
masm(), AVX2);
2926 __ vpcmpeqd(dst, dst, dst);
2927 __ vpslld(dst, dst, uint8_t{31});
2928 __ vxorps(dst, dst, src);
2934 YMMRegister dst =
i.OutputSimd256Register();
2935 YMMRegister src =
i.InputSimd256Register(0);
2936 CpuFeatureScope avx_scope(
masm(), AVX2);
2943 __ vpcmpeqq(dst, dst, dst);
2944 __ vpsllq(dst, dst, uint8_t{31});
2945 __ vxorpd(dst, dst, src);
2957 case kX64Float64Neg: {
2958 __ Negpd(
i.OutputDoubleRegister(),
i.InputDoubleRegister(0),
2962 case kSSEFloat64SilenceNaN:
2969 __ AssertZeroExtended(
i.OutputRegister());
2974 __ AssertZeroExtended(
i.OutputRegister());
2983 __ AssertZeroExtended(
i.OutputRegister());
2987 Operand operand =
i.MemoryOperand(&index);
2989 Immediate
value(Immediate(
i.InputInt8(index)));
2990 EmitTSANAwareStore<std::memory_order_relaxed>(
2995 EmitTSANAwareStore<std::memory_order_relaxed>(
3004 __ AssertZeroExtended(
i.OutputRegister());
3009 __ AssertZeroExtended(
i.OutputRegister());
3018 __ AssertZeroExtended(
i.OutputRegister());
3022 Operand operand =
i.MemoryOperand(&index);
3024 Immediate
value(Immediate(
i.InputInt16(index)));
3025 EmitTSANAwareStore<std::memory_order_relaxed>(
3030 EmitTSANAwareStore<std::memory_order_relaxed>(
3037 if (
instr->HasOutput()) {
3039 if (HasAddressingMode(
instr)) {
3040 Operand address(
i.MemoryOperand());
3041 __ movl(
i.OutputRegister(), address);
3042 EmitTSANRelaxedLoadOOLIfNeeded(
zone(),
this,
masm(), address,
i,
3046 __ movl(
i.OutputRegister(),
i.InputRegister(0));
3048 __ movl(
i.OutputRegister(),
i.InputOperand(0));
3051 __ AssertZeroExtended(
i.OutputRegister());
3054 Operand operand =
i.MemoryOperand(&index);
3056 Immediate
value(
i.InputImmediate(index));
3057 EmitTSANAwareStore<std::memory_order_relaxed>(
3062 EmitTSANAwareStore<std::memory_order_relaxed>(
3072 case kX64MovqDecompressTaggedSigned: {
3075 Operand address(
i.MemoryOperand());
3076 __ DecompressTaggedSigned(
i.OutputRegister(), address);
3077 EmitTSANRelaxedLoadOOLIfNeeded(
zone(),
this,
masm(), address,
i,
3081 case kX64MovqDecompressTagged: {
3084 Operand address(
i.MemoryOperand());
3085 __ DecompressTagged(
i.OutputRegister(), address);
3086 EmitTSANRelaxedLoadOOLIfNeeded(
zone(),
this,
masm(), address,
i,
3090 case kX64MovqCompressTagged: {
3095 Operand operand =
i.MemoryOperand(&index);
3097 Immediate
value(
i.InputImmediate(index));
3098 EmitTSANAwareStore<std::memory_order_relaxed>(
3103 EmitTSANAwareStore<std::memory_order_relaxed>(
3109 case kX64MovqDecompressProtected: {
3111 Operand address(
i.MemoryOperand());
3112 __ DecompressProtected(
i.OutputRegister(), address);
3113 EmitTSANRelaxedLoadOOLIfNeeded(
zone(),
this,
masm(), address,
i,
3117 case kX64MovqStoreIndirectPointer: {
3120 Operand operand =
i.MemoryOperand(&index);
3123 EmitTSANAwareStore<std::memory_order_relaxed>(
3128 case kX64MovqDecodeSandboxedPointer: {
3130 Operand address(
i.MemoryOperand());
3132 __ movq(dst, address);
3133 __ DecodeSandboxedPointer(dst);
3134 EmitTSANRelaxedLoadOOLIfNeeded(
zone(),
this,
masm(), address,
i,
3139 case kX64MovqEncodeSandboxedPointer: {
3142 Operand operand =
i.MemoryOperand(&index);
3145 EmitTSANAwareStore<std::memory_order_relaxed>(
3151 if (
instr->HasOutput()) {
3153 Operand address(
i.MemoryOperand());
3154 __ movq(
i.OutputRegister(), address);
3155 EmitTSANRelaxedLoadOOLIfNeeded(
zone(),
this,
masm(), address,
i,
3159 Operand operand =
i.MemoryOperand(&index);
3161 Immediate
value(
i.InputImmediate(index));
3162 EmitTSANAwareStore<std::memory_order_relaxed>(
3167 EmitTSANAwareStore<std::memory_order_relaxed>(
3175 if (
instr->HasOutput()) {
3176 CpuFeatureScope f16c_scope(
masm(), F16C);
3177 CpuFeatureScope avx2_scope(
masm(), AVX2);
3178 __ vpbroadcastw(
i.OutputDoubleRegister(),
i.MemoryOperand());
3179 __ vcvtph2ps(
i.OutputDoubleRegister(),
i.OutputDoubleRegister());
3181 CpuFeatureScope f16c_scope(
masm(), F16C);
3183 Operand operand =
i.MemoryOperand(&index);
3190 if (
instr->HasOutput()) {
3191 __ Movss(
i.OutputDoubleRegister(),
i.MemoryOperand());
3194 Operand operand =
i.MemoryOperand(&index);
3195 __ Movss(operand,
i.InputDoubleRegister(index));
3200 if (
instr->HasOutput()) {
3201 __ Movsd(
i.OutputDoubleRegister(),
i.MemoryOperand());
3204 Operand operand =
i.MemoryOperand(&index);
3205 __ Movsd(operand,
i.InputDoubleRegister(index));
3211 if (
instr->HasOutput()) {
3212 __ Movdqu(
i.OutputSimd128Register(),
i.MemoryOperand());
3215 Operand operand =
i.MemoryOperand(&index);
3216 __ Movdqu(operand,
i.InputSimd128Register(index));
3221 if (
instr->InputAt(0)->IsFPStackSlot()) {
3222 __ movl(
i.OutputRegister(),
i.InputOperand(0));
3224 __ Movd(
i.OutputRegister(),
i.InputDoubleRegister(0));
3228 if (
instr->InputAt(0)->IsFPStackSlot()) {
3229 __ movq(
i.OutputRegister(),
i.InputOperand(0));
3231 __ Movq(
i.OutputRegister(),
i.InputDoubleRegister(0));
3236 __ Movd(
i.OutputDoubleRegister(),
i.InputRegister(0));
3238 __ Movss(
i.OutputDoubleRegister(),
i.InputOperand(0));
3243 __ Movq(
i.OutputDoubleRegister(),
i.InputRegister(0));
3245 __ Movsd(
i.OutputDoubleRegister(),
i.InputOperand(0));
3253 if (
i.InputRegister(0) ==
i.OutputRegister()) {
3254 if (mode == kMode_MRI) {
3255 int32_t constant_summand =
i.InputInt32(1);
3257 if (constant_summand > 0) {
3258 __ addl(
i.OutputRegister(), Immediate(constant_summand));
3260 __ subl(
i.OutputRegister(),
3263 }
else if (mode == kMode_MR1) {
3264 if (
i.InputRegister(1) ==
i.OutputRegister()) {
3265 __ shll(
i.OutputRegister(), Immediate(1));
3267 __ addl(
i.OutputRegister(),
i.InputRegister(1));
3269 }
else if (mode == kMode_M2) {
3270 __ shll(
i.OutputRegister(), Immediate(1));
3271 }
else if (mode == kMode_M4) {
3272 __ shll(
i.OutputRegister(), Immediate(2));
3273 }
else if (mode == kMode_M8) {
3274 __ shll(
i.OutputRegister(), Immediate(3));
3276 __ leal(
i.OutputRegister(),
i.MemoryOperand());
3278 }
else if (mode == kMode_MR1 &&
3279 i.InputRegister(1) ==
i.OutputRegister()) {
3280 __ addl(
i.OutputRegister(),
i.InputRegister(0));
3282 __ leal(
i.OutputRegister(),
i.MemoryOperand());
3284 __ AssertZeroExtended(
i.OutputRegister());
3292 if (
i.InputRegister(0) ==
i.OutputRegister()) {
3293 if (mode == kMode_MRI) {
3294 int32_t constant_summand =
i.InputInt32(1);
3295 if (constant_summand > 0) {
3296 __ addq(
i.OutputRegister(), Immediate(constant_summand));
3297 }
else if (constant_summand < 0) {
3298 __ subq(
i.OutputRegister(), Immediate(-constant_summand));
3300 }
else if (mode == kMode_MR1) {
3301 if (
i.InputRegister(1) ==
i.OutputRegister()) {
3302 __ shlq(
i.OutputRegister(), Immediate(1));
3304 __ addq(
i.OutputRegister(),
i.InputRegister(1));
3306 }
else if (mode == kMode_M2) {
3307 __ shlq(
i.OutputRegister(), Immediate(1));
3308 }
else if (mode == kMode_M4) {
3309 __ shlq(
i.OutputRegister(), Immediate(2));
3310 }
else if (mode == kMode_M8) {
3311 __ shlq(
i.OutputRegister(), Immediate(3));
3313 __ leaq(
i.OutputRegister(),
i.MemoryOperand());
3315 }
else if (mode == kMode_MR1 &&
3316 i.InputRegister(1) ==
i.OutputRegister()) {
3317 __ addq(
i.OutputRegister(),
i.InputRegister(0));
3319 __ leaq(
i.OutputRegister(),
i.MemoryOperand());
3324 __ decl(
i.OutputRegister());
3327 __ incl(
i.OutputRegister());
3330 int stack_decrement =
i.InputInt32(0);
3334 if (HasAddressingMode(
instr)) {
3337 Operand operand =
i.MemoryOperand(&index);
3341 __ pushq(
i.InputImmediate(1));
3343 InstructionOperand* input =
instr->InputAt(1);
3344 if (input->IsRegister()) {
3346 __ pushq(
i.InputRegister(1));
3347 }
else if (input->IsFloatRegister() || input->IsDoubleRegister()) {
3349 __ AllocateStackSpace(stack_decrement);
3350 __ Movsd(Operand(rsp, 0),
i.InputDoubleRegister(1));
3351 }
else if (input->IsSimd128Register()) {
3353 __ AllocateStackSpace(stack_decrement);
3355 __ Movups(Operand(rsp, 0),
i.InputSimd128Register(1));
3356 }
else if (input->IsStackSlot() || input->IsFloatStackSlot() ||
3357 input->IsDoubleStackSlot()) {
3359 __ pushq(
i.InputOperand(1));
3361 DCHECK(input->IsSimd128StackSlot());
3365 __ AllocateStackSpace(stack_decrement);
3378 }
else if (
instr->InputAt(0)->IsFPRegister()) {
3382 i.InputDoubleRegister(0));
3386 i.InputFloatRegister(0));
3394 int reverse_slot =
i.InputInt32(0);
3397 if (
instr->OutputAt(0)->IsFPRegister()) {
3400 __ Movsd(
i.OutputDoubleRegister(), Operand(rbp,
offset));
3402 __ Movss(
i.OutputFloatRegister(), Operand(rbp,
offset));
3405 __ Movdqu(
i.OutputSimd128Register(), Operand(rbp,
offset));
3408 __ movq(
i.OutputRegister(), Operand(rbp,
offset));
3414 VectorLength vec_len = VectorLengthField::decode(opcode);
3415 if (vec_len == kV128) {
3416 switch (lane_size) {
3418 CpuFeatureScope f16c_scope(
masm(), F16C);
3419 CpuFeatureScope avx2_scope(
masm(), AVX2);
3420 __ vcvtps2ph(
i.OutputDoubleRegister(0),
i.InputDoubleRegister(0),
3422 __ vpbroadcastw(
i.OutputSimd128Register(),
3423 i.OutputDoubleRegister(0));
3428 __ F32x4Splat(
i.OutputSimd128Register(),
i.InputDoubleRegister(0));
3433 XMMRegister dst =
i.OutputSimd128Register();
3434 if (
instr->InputAt(0)->IsFPRegister()) {
3435 __ Movddup(dst,
i.InputDoubleRegister(0));
3437 __ Movddup(dst,
i.InputOperand(0));
3445 }
else if (vec_len == kV256) {
3446 switch (lane_size) {
3449 __ F32x8Splat(
i.OutputSimd256Register(),
i.InputFloatRegister(0));
3454 __ F64x4Splat(
i.OutputSimd256Register(),
i.InputDoubleRegister(0));
3465 case kX64FExtractLane: {
3467 VectorLength vec_len = VectorLengthField::decode(opcode);
3468 if (vec_len == kV128) {
3469 switch (lane_size) {
3472 CpuFeatureScope f16c_scope(
masm(), F16C);
3473 CpuFeatureScope avx_scope(
masm(), AVX);
3477 __ vcvtph2ps(
i.OutputFloatRegister(),
i.OutputFloatRegister());
3482 __ F32x4ExtractLane(
i.OutputFloatRegister(),
3483 i.InputSimd128Register(0),
i.InputUint8(1));
3488 __ F64x2ExtractLane(
i.OutputDoubleRegister(),
3489 i.InputDoubleRegister(0),
i.InputUint8(1));
3501 case kX64FReplaceLane: {
3503 VectorLength vec_len = VectorLengthField::decode(opcode);
3504 if (vec_len == kV128) {
3505 switch (lane_size) {
3508 CpuFeatureScope f16c_scope(
masm(), F16C);
3509 CpuFeatureScope avx_scope(
masm(), AVX);
3512 __ vpinsrw(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
3520 uint8_t select =
i.InputInt8(1) << 4 & 0x30;
3521 if (
instr->InputAt(2)->IsFPRegister()) {
3522 __ Insertps(
i.OutputSimd128Register(),
i.InputDoubleRegister(2),
3525 __ Insertps(
i.OutputSimd128Register(),
i.InputOperand(2), select);
3531 __ F64x2ReplaceLane(
i.OutputSimd128Register(),
3532 i.InputSimd128Register(0),
3533 i.InputDoubleRegister(2),
i.InputInt8(1));
3547 VectorLength vec_len = VectorLengthField::decode(opcode);
3548 if (vec_len == kV128) {
3549 XMMRegister dst =
i.OutputSimd128Register();
3550 XMMRegister src =
i.InputSimd128Register(0);
3551 switch (lane_size) {
3554 CpuFeatureScope f16c_scope(
masm(), F16C);
3555 CpuFeatureScope avx_scope(
masm(), AVX);
3564 __ Sqrtps(dst, src);
3569 __ Sqrtpd(dst, src);
3575 }
else if (vec_len == kV256) {
3576 YMMRegister dst =
i.OutputSimd256Register();
3577 YMMRegister src =
i.InputSimd256Register(0);
3578 CpuFeatureScope avx_scope(
masm(), AVX);
3579 switch (lane_size) {
3582 __ vsqrtps(dst, src);
3587 __ vsqrtpd(dst, src);
3600 VectorLength vec_len = VectorLengthField::decode(opcode);
3601 if (vec_len == kV128) {
3602 switch (lane_size) {
3620 }
else if (vec_len == kV256) {
3621 switch (lane_size) {
3642 VectorLength vec_len = VectorLengthField::decode(opcode);
3643 if (vec_len == kV128) {
3644 switch (lane_size) {
3662 }
else if (vec_len == kV256) {
3663 switch (lane_size) {
3684 VectorLength vec_len = VectorLengthField::decode(opcode);
3685 if (vec_len == kV128) {
3686 switch (lane_size) {
3704 }
else if (vec_len == kV256) {
3705 switch (lane_size) {
3727 VectorLength vec_len = VectorLengthField::decode(opcode);
3728 if (vec_len == kV128) {
3729 switch (lane_size) {
3747 }
else if (vec_len == kV256) {
3748 switch (lane_size) {
3769 VectorLength vec_len = VectorLengthField::decode(opcode);
3770 if (vec_len == kV128) {
3771 switch (lane_size) {
3778 __ F16x8Min(ydst,
i.InputSimd128Register(0),
3779 i.InputSimd128Register(1),
i.TempSimd256Register(0),
3780 i.TempSimd256Register(1));
3785 __ F32x4Min(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
3792 DCHECK_EQ(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
3793 __ F64x2Min(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
3800 }
else if (vec_len == kV256) {
3801 switch (lane_size) {
3804 __ F32x8Min(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
3810 DCHECK_EQ(
i.OutputSimd256Register(),
i.InputSimd256Register(0));
3811 __ F64x4Min(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
3825 VectorLength vec_len = VectorLengthField::decode(opcode);
3826 if (vec_len == kV128) {
3827 switch (lane_size) {
3834 __ F16x8Max(ydst,
i.InputSimd128Register(0),
3835 i.InputSimd128Register(1),
i.TempSimd256Register(0),
3836 i.TempSimd256Register(1));
3841 __ F32x4Max(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
3848 DCHECK_EQ(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
3849 __ F64x2Max(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
3856 }
else if (vec_len == kV256) {
3857 switch (lane_size) {
3860 __ F32x8Max(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
3866 DCHECK_EQ(
i.OutputSimd256Register(),
i.InputSimd256Register(0));
3867 __ F64x4Max(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
3881 VectorLength vec_len = VectorLengthField::decode(opcode);
3882 if (vec_len == kV128) {
3883 switch (lane_size) {
3902 }
else if (vec_len == kV256) {
3903 switch (lane_size) {
3924 VectorLength vec_len = VectorLengthField::decode(opcode);
3925 if (vec_len == kV128) {
3926 switch (lane_size) {
3945 }
else if (vec_len == kV256) {
3946 switch (lane_size) {
3967 VectorLength vec_len = VectorLengthField::decode(opcode);
3968 if (vec_len == kV128) {
3969 switch (lane_size) {
3988 }
else if (vec_len == kV256) {
3989 switch (lane_size) {
4010 VectorLength vec_len = VectorLengthField::decode(opcode);
4011 if (vec_len == kV128) {
4012 switch (lane_size) {
4031 }
else if (vec_len == kV256) {
4032 switch (lane_size) {
4051 case kX64F64x2Qfma: {
4052 __ F64x2Qfma(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
4053 i.InputSimd128Register(1),
i.InputSimd128Register(2),
4057 case kX64F64x2Qfms: {
4058 __ F64x2Qfms(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
4059 i.InputSimd128Register(1),
i.InputSimd128Register(2),
4063 case kX64F64x4Qfma: {
4064 __ F64x4Qfma(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
4065 i.InputSimd256Register(1),
i.InputSimd256Register(2),
4069 case kX64F64x4Qfms: {
4070 __ F64x4Qfms(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
4071 i.InputSimd256Register(1),
i.InputSimd256Register(2),
4075 case kX64F64x2ConvertLowI32x4S: {
4076 __ Cvtdq2pd(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
4079 case kX64F64x4ConvertI32x4S: {
4080 CpuFeatureScope avx_scope(
masm(), AVX);
4081 __ vcvtdq2pd(
i.OutputSimd256Register(),
i.InputSimd128Register(0));
4084 case kX64F64x2ConvertLowI32x4U: {
4085 __ F64x2ConvertLowI32x4U(
i.OutputSimd128Register(),
4089 case kX64F64x2PromoteLowF32x4: {
4090 if (HasAddressingMode(
instr)) {
4092 __ Cvtps2pd(
i.OutputSimd128Register(),
i.MemoryOperand());
4094 __ Cvtps2pd(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
4098 case kX64F32x4DemoteF64x2Zero: {
4099 __ Cvtpd2ps(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
4102 case kX64F32x4DemoteF64x4: {
4103 CpuFeatureScope avx_scope(
masm(), AVX);
4104 __ vcvtpd2ps(
i.OutputSimd128Register(),
i.InputSimd256Register(0));
4107 case kX64I32x4TruncSatF64x2SZero: {
4108 __ I32x4TruncSatF64x2SZero(
i.OutputSimd128Register(),
4113 case kX64I32x4TruncSatF64x2UZero: {
4114 __ I32x4TruncSatF64x2UZero(
i.OutputSimd128Register(),
4119 case kX64F32x4SConvertI32x4: {
4120 __ Cvtdq2ps(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
4123 case kX64F32x8SConvertI32x8: {
4124 CpuFeatureScope avx_scope(
masm(), AVX);
4125 __ vcvtdq2ps(
i.OutputSimd256Register(),
i.InputSimd256Register(0));
4128 case kX64I16x8SConvertF16x8: {
4129 CpuFeatureScope avx_scope(
masm(), AVX);
4130 CpuFeatureScope f16c_scope(
masm(), F16C);
4131 CpuFeatureScope avx2_scope(
masm(), AVX2);
4139 case kX64I16x8UConvertF16x8: {
4140 CpuFeatureScope avx_scope(
masm(), AVX);
4141 CpuFeatureScope f16c_scope(
masm(), F16C);
4142 CpuFeatureScope avx2_scope(
masm(), AVX2);
4149 case kX64F16x8SConvertI16x8: {
4150 CpuFeatureScope f16c_scope(
masm(), F16C);
4151 CpuFeatureScope avx_scope(
masm(), AVX);
4152 CpuFeatureScope avx2_scope(
masm(), AVX2);
4158 case kX64F16x8UConvertI16x8: {
4159 CpuFeatureScope f16c_scope(
masm(), F16C);
4160 CpuFeatureScope avx_scope(
masm(), AVX);
4161 CpuFeatureScope avx2_scope(
masm(), AVX2);
4167 case kX64F16x8DemoteF32x4Zero: {
4168 CpuFeatureScope f16c_scope(
masm(), F16C);
4169 __ vcvtps2ph(
i.OutputSimd128Register(),
i.InputSimd128Register(0), 0);
4172 case kX64F16x8DemoteF64x2Zero: {
4173 CpuFeatureScope f16c_scope(
masm(), F16C);
4174 CpuFeatureScope avx_scope(
masm(), AVX);
4176 XMMRegister ftmp =
i.TempSimd128Register(1);
4177 XMMRegister ftmp2 =
i.TempSimd128Register(2);
4178 XMMRegister dst =
i.OutputSimd128Register();
4179 XMMRegister src =
i.InputSimd128Register(0);
4180 __ F64x2ExtractLane(ftmp, src, 1);
4182 __ Cvtpd2ph(ftmp2, ftmp, tmp);
4183 __ Cvtpd2ph(dst, src, tmp);
4184 __ vmovd(tmp, ftmp2);
4185 __ vpinsrw(dst, dst, tmp, 1);
4187 __ pxor(ftmp, ftmp);
4189 __ F64x2ReplaceLane(dst, dst, ftmp, 1);
4190 __ vinsertps(dst, dst, ftmp, (1 << 4) & 0x30);
4193 case kX64F32x4PromoteLowF16x8: {
4194 CpuFeatureScope f16c_scope(
masm(), F16C);
4195 __ vcvtph2ps(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
4198 case kX64F32x4UConvertI32x4: {
4199 DCHECK_EQ(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
4201 XMMRegister dst =
i.OutputSimd128Register();
4206 __ Psrld(dst, uint8_t{1});
4207 __ Cvtdq2ps(dst, dst);
4212 case kX64F32x8UConvertI32x8: {
4213 DCHECK_EQ(
i.OutputSimd256Register(),
i.InputSimd256Register(0));
4215 CpuFeatureScope avx_scope(
masm(), AVX);
4216 CpuFeatureScope avx2_scope(
masm(), AVX2);
4217 YMMRegister dst =
i.OutputSimd256Register();
4225 __ vpsrld(dst, dst, uint8_t{1});
4226 __ vcvtdq2ps(dst, dst);
4227 __ vaddps(dst, dst, dst);
4231 case kX64F32x4Qfma: {
4232 __ F32x4Qfma(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
4233 i.InputSimd128Register(1),
i.InputSimd128Register(2),
4237 case kX64F32x4Qfms: {
4238 __ F32x4Qfms(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
4239 i.InputSimd128Register(1),
i.InputSimd128Register(2),
4243 case kX64F32x8Qfma: {
4244 __ F32x8Qfma(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
4245 i.InputSimd256Register(1),
i.InputSimd256Register(2),
4249 case kX64F32x8Qfms: {
4250 __ F32x8Qfms(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
4251 i.InputSimd256Register(1),
i.InputSimd256Register(2),
4255 case kX64F16x8Qfma: {
4258 __ F16x8Qfma(ydst,
i.InputSimd128Register(0),
i.InputSimd128Register(1),
4259 i.InputSimd128Register(2),
i.TempSimd256Register(0),
4260 i.TempSimd256Register(1));
4263 case kX64F16x8Qfms: {
4266 __ F16x8Qfms(ydst,
i.InputSimd128Register(0),
i.InputSimd128Register(1),
4267 i.InputSimd128Register(2),
i.TempSimd256Register(0),
4268 i.TempSimd256Register(1));
4272 VectorLength vec_len = VectorLengthField::decode(opcode);
4273 if (vec_len == kV128) {
4275 }
else if (vec_len == kV256) {
4283 VectorLength vec_len = VectorLengthField::decode(opcode);
4284 if (vec_len == kV128) {
4286 }
else if (vec_len == kV256) {
4294 DCHECK_EQ(VectorLengthField::decode(opcode), kV128);
4299 DCHECK_EQ(VectorLengthField::decode(opcode), kV128);
4303 case kX64F32x8Pmin: {
4304 YMMRegister dst =
i.OutputSimd256Register();
4305 CpuFeatureScope avx_scope(
masm(), AVX);
4306 __ vminps(dst,
i.InputSimd256Register(0),
i.InputSimd256Register(1));
4309 case kX64F32x8Pmax: {
4310 YMMRegister dst =
i.OutputSimd256Register();
4311 CpuFeatureScope avx_scope(
masm(), AVX);
4312 __ vmaxps(dst,
i.InputSimd256Register(0),
i.InputSimd256Register(1));
4315 case kX64F64x4Pmin: {
4316 YMMRegister dst =
i.OutputSimd256Register();
4317 CpuFeatureScope avx_scope(
masm(), AVX);
4318 __ vminpd(dst,
i.InputSimd256Register(0),
i.InputSimd256Register(1));
4321 case kX64F64x4Pmax: {
4322 YMMRegister dst =
i.OutputSimd256Register();
4323 CpuFeatureScope avx_scope(
masm(), AVX);
4324 __ vmaxpd(dst,
i.InputSimd256Register(0),
i.InputSimd256Register(1));
4327 case kX64F32x4Round: {
4330 __ Roundps(
i.OutputSimd128Register(),
i.InputSimd128Register(0), mode);
4333 case kX64F16x8Round: {
4334 CpuFeatureScope f16c_scope(
masm(), F16C);
4335 CpuFeatureScope avx_scope(
masm(), AVX);
4343 case kX64F64x2Round: {
4346 __ Roundpd(
i.OutputSimd128Register(),
i.InputSimd128Register(0), mode);
4350 VectorLength vec_len = VectorLengthField::decode(opcode);
4351 if (vec_len == kV128) {
4353 }
else if (vec_len == kV256) {
4361 VectorLength vec_len = VectorLengthField::decode(opcode);
4362 if (vec_len == kV128) {
4364 }
else if (vec_len == kV256) {
4373 VectorLength vec_len = VectorLengthField::decode(opcode);
4374 if (vec_len == kV128) {
4375 switch (lane_size) {
4378 XMMRegister dst =
i.OutputSimd128Register();
4388 XMMRegister dst =
i.OutputSimd128Register();
4390 __ I16x8Splat(dst,
i.InputRegister(0));
4392 __ I16x8Splat(dst,
i.InputOperand(0));
4398 XMMRegister dst =
i.OutputSimd128Register();
4400 __ Movd(dst,
i.InputRegister(0));
4404 __ Movd(dst,
i.InputOperand(0));
4406 __ Pshufd(dst, dst, uint8_t{0x0});
4411 XMMRegister dst =
i.OutputSimd128Register();
4413 __ Movq(dst,
i.InputRegister(0));
4414 __ Movddup(dst, dst);
4416 __ Movddup(dst,
i.InputOperand(0));
4424 }
else if (vec_len == kV256) {
4425 switch (lane_size) {
4428 YMMRegister dst =
i.OutputSimd256Register();
4430 __ I8x32Splat(dst,
i.InputRegister(0));
4432 __ I8x32Splat(dst,
i.InputOperand(0));
4438 YMMRegister dst =
i.OutputSimd256Register();
4440 __ I16x16Splat(dst,
i.InputRegister(0));
4442 __ I16x16Splat(dst,
i.InputOperand(0));
4448 YMMRegister dst =
i.OutputSimd256Register();
4450 __ I32x8Splat(dst,
i.InputRegister(0));
4452 __ I32x8Splat(dst,
i.InputOperand(0));
4458 YMMRegister dst =
i.OutputSimd256Register();
4460 __ I64x4Splat(dst,
i.InputRegister(0));
4462 __ I64x4Splat(dst,
i.InputOperand(0));
4474 case kX64IExtractLane: {
4476 VectorLength vec_len = VectorLengthField::decode(opcode);
4477 if (vec_len == kV128) {
4478 switch (lane_size) {
4481 __ Pextrd(
i.OutputRegister(),
i.InputSimd128Register(0),
4487 __ Pextrq(
i.OutputRegister(),
i.InputSimd128Register(0),
4502 VectorLength vec_len = VectorLengthField::decode(opcode);
4503 if (vec_len == kV128) {
4504 XMMRegister dst =
i.OutputSimd128Register();
4505 XMMRegister src =
i.InputSimd128Register(0);
4506 switch (lane_size) {
4530 }
else if (vec_len == kV256) {
4531 YMMRegister dst =
i.OutputSimd256Register();
4532 YMMRegister src =
i.InputSimd256Register(0);
4533 CpuFeatureScope avx_scope(
masm(), AVX2);
4534 switch (lane_size) {
4537 __ vpabsb(dst, src);
4542 __ vpabsw(dst, src);
4547 __ vpabsd(dst, src);
4565 VectorLength vec_len = VectorLengthField::decode(opcode);
4566 if (vec_len == kV128) {
4567 XMMRegister dst =
i.OutputSimd128Register();
4568 XMMRegister src =
i.InputSimd128Register(0);
4569 switch (lane_size) {
4611 }
else if (vec_len == kV256) {
4612 YMMRegister dst =
i.OutputSimd256Register();
4613 YMMRegister src =
i.InputSimd256Register(0);
4614 CpuFeatureScope avx_scope(
masm(), AVX2);
4615 switch (lane_size) {
4623 __ vpxor(dst, dst, dst);
4624 __ vpsubb(dst, dst, src);
4635 __ vpxor(dst, dst, dst);
4636 __ vpsubw(dst, dst, src);
4647 __ vpxor(dst, dst, dst);
4648 __ vpsubd(dst, dst, src);
4664 case kX64IBitMask: {
4666 VectorLength vec_len = VectorLengthField::decode(opcode);
4667 if (vec_len == kV128) {
4668 switch (lane_size) {
4671 __ Pmovmskb(
i.OutputRegister(),
i.InputSimd128Register(0));
4679 __ shrq(dst, Immediate(8));
4684 __ Movmskps(
i.OutputRegister(),
i.InputSimd128Register(0));
4689 __ Movmskpd(
i.OutputRegister(),
i.InputSimd128Register(0));
4702 VectorLength vec_len = VectorLengthField::decode(opcode);
4703 if (vec_len == kV128) {
4704 switch (lane_size) {
4707 XMMRegister dst =
i.OutputSimd128Register();
4708 XMMRegister src =
i.InputSimd128Register(0);
4740 }
else if (vec_len == kV256) {
4741 switch (lane_size) {
4774 VectorLength vec_len = VectorLengthField::decode(opcode);
4775 if (vec_len == kV128) {
4776 switch (lane_size) {
4779 XMMRegister dst =
i.OutputSimd128Register();
4780 XMMRegister src =
i.InputSimd128Register(0);
4805 XMMRegister dst =
i.OutputSimd128Register();
4806 XMMRegister src =
i.InputSimd128Register(0);
4818 }
else if (vec_len == kV256) {
4819 switch (lane_size) {
4850 VectorLength vec_len = VectorLengthField::decode(opcode);
4851 if (vec_len == kV128) {
4852 switch (lane_size) {
4876 }
else if (vec_len == kV256) {
4877 switch (lane_size) {
4908 VectorLength vec_len = VectorLengthField::decode(opcode);
4909 if (vec_len == kV128) {
4910 switch (lane_size) {
4934 }
else if (vec_len == kV256) {
4935 switch (lane_size) {
4966 VectorLength vec_len = VectorLengthField::decode(opcode);
4967 if (vec_len == kV128) {
4968 switch (lane_size) {
4976 CpuFeatureScope scope(
masm(), SSE4_1);
4982 __ I64x2Mul(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
4983 i.InputSimd128Register(1),
i.TempSimd128Register(0),
4990 }
else if (vec_len == kV256) {
4991 switch (lane_size) {
5004 __ I64x4Mul(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
5005 i.InputSimd256Register(1),
i.TempSimd256Register(0),
5019 VectorLength vec_len = VectorLengthField::decode(opcode);
5020 if (vec_len == kV128) {
5021 switch (lane_size) {
5039 CpuFeatureScope sse_scope(
masm(), SSE4_1);
5046 }
else if (vec_len == kV256) {
5047 switch (lane_size) {
5078 VectorLength vec_len = VectorLengthField::decode(opcode);
5079 if (vec_len == kV128) {
5080 switch (lane_size) {
5082 XMMRegister dst =
i.OutputSimd128Register();
5083 __ Pcmpeqb(dst,
i.InputSimd128Register(1));
5090 XMMRegister dst =
i.OutputSimd128Register();
5091 __ Pcmpeqw(dst,
i.InputSimd128Register(1));
5098 __ Pcmpeqd(
i.OutputSimd128Register(),
i.InputSimd128Register(1));
5105 DCHECK_EQ(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
5106 __ Pcmpeqq(
i.OutputSimd128Register(),
i.InputSimd128Register(1));
5114 }
else if (vec_len == kV256) {
5115 DCHECK_EQ(
i.OutputSimd256Register(),
i.InputSimd256Register(0));
5116 YMMRegister dst =
i.OutputSimd256Register();
5117 CpuFeatureScope avx2_scope(
masm(), AVX2);
5118 switch (lane_size) {
5121 __ vpcmpeqb(dst, dst,
i.InputSimd256Register(1));
5129 __ vpcmpeqw(dst, dst,
i.InputSimd256Register(1));
5137 __ vpcmpeqd(dst, dst,
i.InputSimd256Register(1));
5145 __ vpcmpeqq(dst, dst,
i.InputSimd256Register(1));
5161 VectorLength vec_len = VectorLengthField::decode(opcode);
5162 if (vec_len == kV128) {
5163 switch (lane_size) {
5181 __ I64x2GtS(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
5188 }
else if (vec_len == kV256) {
5189 switch (lane_size) {
5220 VectorLength vec_len = VectorLengthField::decode(opcode);
5221 if (vec_len == kV128) {
5222 switch (lane_size) {
5225 XMMRegister dst =
i.OutputSimd128Register();
5226 XMMRegister src =
i.InputSimd128Register(1);
5227 __ Pminsb(dst, src);
5228 __ Pcmpeqb(dst, src);
5233 XMMRegister dst =
i.OutputSimd128Register();
5234 XMMRegister src =
i.InputSimd128Register(1);
5235 __ Pminsw(dst, src);
5236 __ Pcmpeqw(dst, src);
5241 XMMRegister dst =
i.OutputSimd128Register();
5242 XMMRegister src =
i.InputSimd128Register(1);
5243 __ Pminsd(dst, src);
5244 __ Pcmpeqd(dst, src);
5249 __ I64x2GeS(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
5256 }
else if (vec_len == kV256) {
5257 YMMRegister dst =
i.OutputSimd256Register();
5258 YMMRegister src =
i.InputSimd256Register(1);
5259 CpuFeatureScope avx2_scope(
masm(), AVX2);
5260 switch (lane_size) {
5263 DCHECK_EQ(
i.OutputSimd256Register(),
i.InputSimd256Register(0));
5264 __ vpminsb(dst, dst, src);
5265 __ vpcmpeqb(dst, dst, src);
5270 DCHECK_EQ(
i.OutputSimd256Register(),
i.InputSimd256Register(0));
5271 __ vpminsw(dst, dst, src);
5272 __ vpcmpeqw(dst, dst, src);
5277 DCHECK_EQ(
i.OutputSimd256Register(),
i.InputSimd256Register(0));
5278 __ vpminsd(dst, dst, src);
5279 __ vpcmpeqd(dst, dst, src);
5284 __ vpcmpgtq(dst,
i.InputSimd256Register(1),
5285 i.InputSimd256Register(0));
5301 VectorLength vec_len = VectorLengthField::decode(opcode);
5302 if (vec_len == kV128) {
5303 switch (lane_size) {
5306 XMMRegister dst =
i.OutputSimd128Register();
5307 XMMRegister src =
i.InputSimd128Register(0);
5339 }
else if (vec_len == kV256) {
5340 switch (lane_size) {
5371 case kX64I64x2ExtMulLowI32x4S: {
5372 __ I64x2ExtMul(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
5377 case kX64I64x2ExtMulHighI32x4S: {
5378 __ I64x2ExtMul(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
5384 case kX64I64x2ExtMulLowI32x4U: {
5385 __ I64x2ExtMul(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
5390 case kX64I64x2ExtMulHighI32x4U: {
5391 __ I64x2ExtMul(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
5397 case kX64I64x2SConvertI32x4Low: {
5398 __ Pmovsxdq(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
5401 case kX64I64x2SConvertI32x4High: {
5402 __ I64x2SConvertI32x4High(
i.OutputSimd128Register(),
5403 i.InputSimd128Register(0));
5406 case kX64I64x4SConvertI32x4: {
5407 CpuFeatureScope avx2_scope(
masm(), AVX2);
5408 __ vpmovsxdq(
i.OutputSimd256Register(),
i.InputSimd128Register(0));
5411 case kX64I64x2UConvertI32x4Low: {
5412 __ Pmovzxdq(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
5415 case kX64I64x2UConvertI32x4High: {
5416 __ I64x2UConvertI32x4High(
i.OutputSimd128Register(),
5420 case kX64I64x4UConvertI32x4: {
5421 CpuFeatureScope avx2_scope(
masm(), AVX2);
5422 __ vpmovzxdq(
i.OutputSimd256Register(),
i.InputSimd128Register(0));
5425 case kX64I32x4SConvertF32x4: {
5426 __ I32x4SConvertF32x4(
i.OutputSimd128Register(),
5431 case kX64I32x8SConvertF32x8: {
5432 __ I32x8SConvertF32x8(
i.OutputSimd256Register(),
5437 case kX64I32x4SConvertI16x8Low: {
5438 __ Pmovsxwd(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
5441 case kX64I32x4SConvertI16x8High: {
5442 __ I32x4SConvertI16x8High(
i.OutputSimd128Register(),
5443 i.InputSimd128Register(0));
5446 case kX64I32x8SConvertI16x8: {
5447 CpuFeatureScope avx2_scope(
masm(), AVX2);
5448 __ vpmovsxwd(
i.OutputSimd256Register(),
i.InputSimd128Register(0));
5453 VectorLength vec_len = VectorLengthField::decode(opcode);
5454 if (vec_len == kV128) {
5455 switch (lane_size) {
5458 CpuFeatureScope scope(
masm(), SSE4_1);
5469 CpuFeatureScope scope(
masm(), SSE4_1);
5476 }
else if (vec_len == kV256) {
5477 switch (lane_size) {
5503 VectorLength vec_len = VectorLengthField::decode(opcode);
5504 if (vec_len == kV128) {
5505 switch (lane_size) {
5508 CpuFeatureScope scope(
masm(), SSE4_1);
5519 CpuFeatureScope scope(
masm(), SSE4_1);
5526 }
else if (vec_len == kV256) {
5527 switch (lane_size) {
5551 case kX64I32x4UConvertF32x4: {
5552 DCHECK_EQ(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
5553 XMMRegister dst =
i.OutputSimd128Register();
5554 XMMRegister tmp =
i.TempSimd128Register(0);
5555 XMMRegister tmp2 =
i.TempSimd128Register(1);
5556 __ I32x4TruncF32x4U(dst, dst, tmp, tmp2);
5559 case kX64I32x8UConvertF32x8: {
5560 DCHECK_EQ(
i.OutputSimd256Register(),
i.InputSimd256Register(0));
5561 CpuFeatureScope avx_scope(
masm(), AVX);
5562 CpuFeatureScope avx2_scope(
masm(), AVX2);
5563 YMMRegister dst =
i.OutputSimd256Register();
5564 YMMRegister tmp1 =
i.TempSimd256Register(0);
5565 YMMRegister tmp2 =
i.TempSimd256Register(1);
5567 __ vpxor(tmp2, tmp2, tmp2);
5568 __ vmaxps(dst, dst, tmp2);
5570 __ vpcmpeqd(tmp2, tmp2, tmp2);
5571 __ vpsrld(tmp2, tmp2, uint8_t{1});
5572 __ vcvtdq2ps(tmp2, tmp2);
5576 __ vmovaps(tmp1, dst);
5577 __ vsubps(tmp1, tmp1, tmp2);
5578 __ vcmpleps(tmp2, tmp2, tmp1);
5579 __ vcvttps2dq(tmp1, tmp1);
5580 __ vpxor(tmp1, tmp1, tmp2);
5581 __ vpxor(tmp2, tmp2, tmp2);
5582 __ vpmaxsd(tmp1, tmp1, tmp2);
5584 __ vcvttps2dq(dst, dst);
5586 __ vpaddd(dst, dst, tmp1);
5589 case kX64I32x4UConvertI16x8Low: {
5590 __ Pmovzxwd(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
5593 case kX64I32x4UConvertI16x8High: {
5594 __ I32x4UConvertI16x8High(
i.OutputSimd128Register(),
5598 case kX64I32x8UConvertI16x8: {
5599 CpuFeatureScope avx2_scope(
masm(), AVX2);
5600 __ vpmovzxwd(
i.OutputSimd256Register(),
i.InputSimd128Register(0));
5605 VectorLength vec_len = VectorLengthField::decode(opcode);
5606 if (vec_len == kV128) {
5607 switch (lane_size) {
5615 CpuFeatureScope scope(
masm(), SSE4_1);
5621 CpuFeatureScope scope(
masm(), SSE4_1);
5628 }
else if (vec_len == kV256) {
5629 switch (lane_size) {
5655 VectorLength vec_len = VectorLengthField::decode(opcode);
5656 if (vec_len == kV128) {
5657 switch (lane_size) {
5665 CpuFeatureScope scope(
masm(), SSE4_1);
5671 CpuFeatureScope scope(
masm(), SSE4_1);
5678 }
else if (vec_len == kV256) {
5679 switch (lane_size) {
5705 VectorLength vec_len = VectorLengthField::decode(opcode);
5706 if (vec_len == kV128) {
5707 XMMRegister dst =
i.OutputSimd128Register();
5708 XMMRegister src =
i.InputSimd128Register(1);
5709 switch (lane_size) {
5711 __ Pmaxub(dst, src);
5712 __ Pcmpeqb(dst, src);
5719 __ Pmaxuw(dst, src);
5720 __ Pcmpeqw(dst, src);
5727 __ Pmaxud(dst, src);
5728 __ Pcmpeqd(dst, src);
5736 }
else if (vec_len == kV256) {
5737 DCHECK_EQ(
i.OutputSimd256Register(),
i.InputSimd256Register(0));
5738 YMMRegister dst =
i.OutputSimd256Register();
5739 YMMRegister src =
i.InputSimd256Register(1);
5740 CpuFeatureScope avx2_scope(
masm(), AVX2);
5741 switch (lane_size) {
5744 __ vpmaxub(dst, dst, src);
5745 __ vpcmpeqb(dst, dst, src);
5753 __ vpmaxuw(dst, dst, src);
5754 __ vpcmpeqw(dst, dst, src);
5762 __ vpmaxud(dst, dst, src);
5763 __ vpcmpeqd(dst, dst, src);
5779 VectorLength vec_len = VectorLengthField::decode(opcode);
5780 if (vec_len == kV128) {
5781 XMMRegister dst =
i.OutputSimd128Register();
5782 XMMRegister src =
i.InputSimd128Register(1);
5783 switch (lane_size) {
5786 __ Pminub(dst, src);
5787 __ Pcmpeqb(dst, src);
5792 __ Pminuw(dst, src);
5793 __ Pcmpeqw(dst, src);
5798 __ Pminud(dst, src);
5799 __ Pcmpeqd(dst, src);
5805 }
else if (vec_len == kV256) {
5806 DCHECK_EQ(
i.OutputSimd256Register(),
i.InputSimd256Register(0));
5807 YMMRegister dst =
i.OutputSimd256Register();
5808 YMMRegister src =
i.InputSimd256Register(1);
5809 CpuFeatureScope avx2_scope(
masm(), AVX2);
5810 switch (lane_size) {
5813 __ vpminub(dst, dst, src);
5814 __ vpcmpeqb(dst, dst, src);
5819 __ vpminuw(dst, dst, src);
5820 __ vpcmpeqw(dst, dst, src);
5825 __ vpminud(dst, dst, src);
5826 __ vpcmpeqd(dst, dst, src);
5837 case kX64I32x4DotI16x8S: {
5841 case kX64I32x4DotI8x16I7x16AddS: {
5842 DCHECK_EQ(
i.OutputSimd128Register(),
i.InputSimd128Register(2));
5848 tmp =
i.TempSimd128Register(0);
5850 __ I32x4DotI8x16I7x16AddS(
5851 i.OutputSimd128Register(),
i.InputSimd128Register(0),
5852 i.InputSimd128Register(1),
i.InputSimd128Register(2),
5856 case kX64I32x8DotI8x32I7x32AddS: {
5857 DCHECK_EQ(
i.OutputSimd256Register(),
i.InputSimd256Register(2));
5862 tmp =
i.TempSimd256Register(0);
5864 __ I32x8DotI8x32I7x32AddS(
5865 i.OutputSimd256Register(),
i.InputSimd256Register(0),
5866 i.InputSimd256Register(1),
i.InputSimd256Register(2),
5870 case kX64I32x4ExtAddPairwiseI16x8S: {
5871 __ I32x4ExtAddPairwiseI16x8S(
i.OutputSimd128Register(),
5875 case kX64I32x8ExtAddPairwiseI16x16S: {
5876 __ I32x8ExtAddPairwiseI16x16S(
i.OutputSimd256Register(),
5877 i.InputSimd256Register(0),
5881 case kX64I32x4ExtAddPairwiseI16x8U: {
5882 __ I32x4ExtAddPairwiseI16x8U(
i.OutputSimd128Register(),
5883 i.InputSimd128Register(0),
5887 case kX64I32x8ExtAddPairwiseI16x16U: {
5888 __ I32x8ExtAddPairwiseI16x16U(
i.OutputSimd256Register(),
5889 i.InputSimd256Register(0),
5893 case kX64I32X4ShiftZeroExtendI8x16: {
5894 XMMRegister dst =
i.OutputSimd128Register();
5895 XMMRegister src =
i.InputSimd128Register(0);
5896 uint8_t shift =
i.InputUint8(1);
5898 __ Palignr(dst, src, shift);
5899 __ Pmovzxbd(dst, dst);
5901 __ Pmovzxbd(dst, src);
5905 case kX64S128Const: {
5908 XMMRegister dst =
i.OutputSimd128Register();
5909 uint32_t imm[4] = {};
5910 for (
int j = 0; j < 4; j++) {
5911 imm[j] =
i.InputUint32(j);
5913 SetupSimdImmediateInRegister(
masm(), imm, dst);
5917 VectorLength vec_len = VectorLengthField::decode(opcode);
5918 if (vec_len == kV128) {
5919 XMMRegister dst =
i.OutputSimd128Register();
5921 }
else if (vec_len == kV256) {
5922 YMMRegister dst =
i.OutputSimd256Register();
5923 CpuFeatureScope avx2_scope(
masm(), AVX2);
5924 __ vpxor(dst, dst, dst);
5930 case kX64SAllOnes: {
5931 VectorLength vec_len = VectorLengthField::decode(opcode);
5932 if (vec_len == kV128) {
5933 XMMRegister dst =
i.OutputSimd128Register();
5934 __ Pcmpeqd(dst, dst);
5935 }
else if (vec_len == kV256) {
5936 YMMRegister dst =
i.OutputSimd256Register();
5937 CpuFeatureScope avx2_scope(
masm(), AVX2);
5938 __ vpcmpeqd(dst, dst, dst);
5945 case kX64IExtractLaneS: {
5947 VectorLength vec_len = VectorLengthField::decode(opcode);
5948 if (vec_len == kV128) {
5949 switch (lane_size) {
5953 __ Pextrb(dst,
i.InputSimd128Register(0),
i.InputUint8(1));
5954 __ movsxbl(dst, dst);
5960 __ Pextrw(dst,
i.InputSimd128Register(0),
i.InputUint8(1));
5961 __ movsxwl(dst, dst);
5973 case kX64I16x8SConvertI8x16Low: {
5974 __ Pmovsxbw(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
5977 case kX64I16x8SConvertI8x16High: {
5978 __ I16x8SConvertI8x16High(
i.OutputSimd128Register(),
5979 i.InputSimd128Register(0));
5982 case kX64I16x16SConvertI8x16: {
5983 CpuFeatureScope avx2_scope(
masm(), AVX2);
5984 __ vpmovsxbw(
i.OutputSimd256Register(),
i.InputSimd128Register(0));
5987 case kX64I16x8SConvertI32x4: {
5991 case kX64IAddSatS: {
5993 VectorLength vec_len = VectorLengthField::decode(opcode);
5994 if (vec_len == kV128) {
5995 switch (lane_size) {
6009 }
else if (vec_len == kV256) {
6010 switch (lane_size) {
6029 case kX64ISubSatS: {
6031 VectorLength vec_len = VectorLengthField::decode(opcode);
6032 if (vec_len == kV128) {
6033 switch (lane_size) {
6047 }
else if (vec_len == kV256) {
6048 switch (lane_size) {
6067 case kX64I16x8UConvertI8x16Low: {
6068 __ Pmovzxbw(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
6071 case kX64I16x8UConvertI8x16High: {
6072 __ I16x8UConvertI8x16High(
i.OutputSimd128Register(),
6076 case kX64I16x16UConvertI8x16: {
6077 CpuFeatureScope avx2_scope(
masm(), AVX2);
6078 __ vpmovzxbw(
i.OutputSimd256Register(),
i.InputSimd128Register(0));
6081 case kX64I16x8UConvertI32x4: {
6082 CpuFeatureScope scope(
masm(), SSE4_1);
6086 case kX64IAddSatU: {
6088 VectorLength vec_len = VectorLengthField::decode(opcode);
6089 if (vec_len == kV128) {
6090 switch (lane_size) {
6104 }
else if (vec_len == kV256) {
6105 switch (lane_size) {
6124 case kX64ISubSatU: {
6126 VectorLength vec_len = VectorLengthField::decode(opcode);
6127 if (vec_len == kV128) {
6128 switch (lane_size) {
6142 }
else if (vec_len == kV256) {
6143 switch (lane_size) {
6162 case kX64IRoundingAverageU: {
6164 VectorLength vec_len = VectorLengthField::decode(opcode);
6165 if (vec_len == kV128) {
6166 switch (lane_size) {
6180 }
else if (vec_len == kV256) {
6181 switch (lane_size) {
6200 case kX64I16x8ExtMulLowI8x16S: {
6201 __ I16x8ExtMulLow(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6206 case kX64I16x8ExtMulHighI8x16S: {
6207 __ I16x8ExtMulHighS(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6211 case kX64I16x8ExtMulLowI8x16U: {
6212 __ I16x8ExtMulLow(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6217 case kX64I16x8ExtMulHighI8x16U: {
6218 __ I16x8ExtMulHighU(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6222 case kX64I16x8ExtAddPairwiseI8x16S: {
6223 __ I16x8ExtAddPairwiseI8x16S(
i.OutputSimd128Register(),
6228 case kX64I16x16ExtAddPairwiseI8x32S: {
6229 __ I16x16ExtAddPairwiseI8x32S(
i.OutputSimd256Register(),
6230 i.InputSimd256Register(0),
6234 case kX64I16x8ExtAddPairwiseI8x16U: {
6235 __ I16x8ExtAddPairwiseI8x16U(
i.OutputSimd128Register(),
6239 case kX64I16x16ExtAddPairwiseI8x32U: {
6240 __ I16x16ExtAddPairwiseI8x32U(
i.OutputSimd256Register(),
6241 i.InputSimd256Register(0),
6245 case kX64I16x8Q15MulRSatS: {
6246 __ I16x8Q15MulRSatS(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6250 case kX64I16x8RelaxedQ15MulRS: {
6251 __ Pmulhrsw(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6252 i.InputSimd128Register(1));
6255 case kX64I16x8DotI8x16I7x16S: {
6256 __ I16x8DotI8x16I7x16S(
i.OutputSimd128Register(),
6257 i.InputSimd128Register(0),
6258 i.InputSimd128Register(1));
6261 case kX64I16x16DotI8x32I7x32S: {
6262 CpuFeatureScope avx_scope(
masm(), AVX2);
6263 __ vpmaddubsw(
i.OutputSimd256Register(),
i.InputSimd256Register(1),
6264 i.InputSimd256Register(0));
6270 if (HasAddressingMode(
instr)) {
6271 Operand operand =
i.MemoryOperand(&index);
6272 __ Pextrb(operand,
i.InputSimd128Register(index),
6273 i.InputUint8(index + 1));
6275 __ Pextrb(
i.OutputRegister(),
i.InputSimd128Register(0),
6283 if (HasAddressingMode(
instr)) {
6284 Operand operand =
i.MemoryOperand(&index);
6285 __ Pextrw(operand,
i.InputSimd128Register(index),
6286 i.InputUint8(index + 1));
6288 __ Pextrw(
i.OutputRegister(),
i.InputSimd128Register(0),
6309 case kX64I8x16SConvertI16x8: {
6313 case kX64I8x16UConvertI16x8: {
6317 case kX64I32x4ExtMulLowI16x8S: {
6318 __ I32x4ExtMul(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6324 case kX64I32x4ExtMulHighI16x8S: {
6325 __ I32x4ExtMul(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6331 case kX64I32x4ExtMulLowI16x8U: {
6332 __ I32x4ExtMul(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6338 case kX64I32x4ExtMulHighI16x8U: {
6339 __ I32x4ExtMul(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6346 VectorLength vec_len = VectorLengthField::decode(opcode);
6347 if (vec_len == kV128) {
6349 }
else if (vec_len == kV256) {
6357 VectorLength vec_len = VectorLengthField::decode(opcode);
6358 if (vec_len == kV128) {
6360 }
else if (vec_len == kV256) {
6368 VectorLength vec_len = VectorLengthField::decode(opcode);
6369 if (vec_len == kV128) {
6371 }
else if (vec_len == kV256) {
6379 VectorLength vec_len = VectorLengthField::decode(opcode);
6380 if (vec_len == kV128) {
6381 __ S128Not(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6383 }
else if (vec_len == kV256) {
6384 __ S256Not(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
6392 VectorLength vec_len = VectorLengthField::decode(opcode);
6393 if (vec_len == kV128) {
6394 __ S128Select(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6395 i.InputSimd128Register(1),
i.InputSimd128Register(2),
6397 }
else if (vec_len == kV256) {
6398 __ S256Select(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
6399 i.InputSimd256Register(1),
i.InputSimd256Register(2),
6407 VectorLength vec_len = VectorLengthField::decode(opcode);
6408 if (vec_len == kV128) {
6412 }
else if (vec_len == kV256) {
6421 case kX64I8x16Swizzle: {
6422 __ I8x16Swizzle(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6428 if (
instr->InputCount() == 2 &&
instr->InputAt(1)->IsImmediate()) {
6429 YMMRegister dst =
i.OutputSimd256Register();
6430 YMMRegister src =
i.InputSimd256Register(0);
6431 uint8_t imm =
i.InputUint8(1);
6432 CpuFeatureScope avx2_scope(
masm(), AVX2);
6433 __ vpshufd(dst, src, imm);
6439 case kX64I8x16Shuffle: {
6440 XMMRegister dst =
i.OutputSimd128Register();
6441 XMMRegister tmp_simd =
i.TempSimd128Register(0);
6442 DCHECK_NE(tmp_simd,
i.InputSimd128Register(0));
6443 if (
instr->InputCount() == 5) {
6444 uint32_t
mask[4] = {};
6445 DCHECK_EQ(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
6446 for (
int j = 4; j > 0; j--) {
6447 mask[j - 1] =
i.InputUint32(j);
6450 SetupSimdImmediateInRegister(
masm(),
mask, tmp_simd);
6451 __ Pshufb(dst, tmp_simd);
6453 DCHECK_NE(tmp_simd,
i.InputSimd128Register(1));
6456 uint32_t mask1[4] = {};
6457 for (
int j = 5; j > 1; j--) {
6458 uint32_t lanes =
i.InputUint32(j);
6459 for (
int k = 0; k < 32; k += 8) {
6460 uint8_t lane = lanes >> k;
6461 mask1[j - 2] |= (lane <
kSimd128Size ? lane : 0x80) << k;
6464 SetupSimdImmediateInRegister(
masm(), mask1, tmp_simd);
6466 uint32_t mask2[4] = {};
6467 if (
instr->InputAt(1)->IsSimd128Register()) {
6468 XMMRegister src1 =
i.InputSimd128Register(1);
6469 if (src1 != dst)
__ Movdqa(dst, src1);
6471 __ Movdqu(dst,
i.InputOperand(1));
6473 for (
int j = 5; j > 1; j--) {
6474 uint32_t lanes =
i.InputUint32(j);
6475 for (
int k = 0; k < 32; k += 8) {
6476 uint8_t lane = lanes >> k;
6477 mask2[j - 2] |= (lane >=
kSimd128Size ? (lane & 0x0F) : 0x80) << k;
6480 SetupSimdImmediateInRegister(
masm(), mask2, tmp_simd);
6481 __ Pshufb(dst, tmp_simd);
6486 case kX64I8x16Popcnt: {
6487 __ I8x16Popcnt(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6492 case kX64S128Load8Splat: {
6494 __ S128Load8Splat(
i.OutputSimd128Register(),
i.MemoryOperand(),
6498 case kX64S128Load16Splat: {
6500 __ S128Load16Splat(
i.OutputSimd128Register(),
i.MemoryOperand(),
6504 case kX64S128Load32Splat: {
6506 __ S128Load32Splat(
i.OutputSimd128Register(),
i.MemoryOperand());
6509 case kX64S128Load64Splat: {
6511 __ Movddup(
i.OutputSimd128Register(),
i.MemoryOperand());
6514 case kX64S128Load8x8S: {
6516 __ Pmovsxbw(
i.OutputSimd128Register(),
i.MemoryOperand());
6519 case kX64S128Load8x8U: {
6521 __ Pmovzxbw(
i.OutputSimd128Register(),
i.MemoryOperand());
6524 case kX64S128Load16x4S: {
6526 __ Pmovsxwd(
i.OutputSimd128Register(),
i.MemoryOperand());
6529 case kX64S128Load16x4U: {
6531 __ Pmovzxwd(
i.OutputSimd128Register(),
i.MemoryOperand());
6534 case kX64S128Load32x2S: {
6536 __ Pmovsxdq(
i.OutputSimd128Register(),
i.MemoryOperand());
6539 case kX64S128Load32x2U: {
6541 __ Pmovzxdq(
i.OutputSimd128Register(),
i.MemoryOperand());
6544 case kX64S128Store32Lane: {
6547 Operand operand =
i.MemoryOperand(&index);
6548 uint8_t lane =
i.InputUint8(index + 1);
6549 __ S128Store32Lane(operand,
i.InputSimd128Register(index), lane);
6552 case kX64S128Store64Lane: {
6555 Operand operand =
i.MemoryOperand(&index);
6556 uint8_t lane =
i.InputUint8(index + 1);
6557 __ S128Store64Lane(operand,
i.InputSimd128Register(index), lane);
6561 if (
instr->Output()->IsSimd128Register()) {
6562 __ Shufps(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6563 i.InputSimd128Register(1),
i.InputUint8(2));
6567 CpuFeatureScope scope(
masm(), AVX);
6568 __ vshufps(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
6569 i.InputSimd256Register(1),
i.InputUint8(2));
6573 case kX64S32x4Rotate: {
6574 XMMRegister dst =
i.OutputSimd128Register();
6575 XMMRegister src =
i.InputSimd128Register(0);
6576 uint8_t
mask =
i.InputUint8(1);
6579 __ Shufps(dst, src, src,
mask);
6581 __ Pshufd(dst, src,
mask);
6585 case kX64S32x4Swizzle: {
6591 case kX64S32x4Shuffle: {
6593 uint8_t shuffle =
i.InputUint8(2);
6600 case kX64S16x8Blend: {
6601 CpuFeatureScope scope(
masm(), SSE4_1);
6605 case kX64S16x8HalfShuffle1: {
6606 XMMRegister dst =
i.OutputSimd128Register();
6607 uint8_t mask_lo =
i.InputUint8(1);
6608 uint8_t mask_hi =
i.InputUint8(2);
6609 if (mask_lo != 0xe4) {
6611 if (mask_hi != 0xe4)
__ Pshufhw(dst, dst, mask_hi);
6618 case kX64S16x8HalfShuffle2: {
6619 XMMRegister dst =
i.OutputSimd128Register();
6623 __ Pshufhw(dst, dst,
i.InputUint8(3));
6627 case kX64S8x16Alignr: {
6631 case kX64S16x8Dup: {
6632 XMMRegister dst =
i.OutputSimd128Register();
6633 uint8_t lane =
i.InputInt8(1) & 0x7;
6634 uint8_t lane4 = lane & 0x3;
6635 uint8_t half_dup = lane4 | (lane4 << 2) | (lane4 << 4) | (lane4 << 6);
6638 __ Punpcklqdq(dst, dst);
6641 __ Punpckhqdq(dst, dst);
6645 case kX64S8x16Dup: {
6646 XMMRegister dst =
i.OutputSimd128Register();
6647 uint8_t lane =
i.InputInt8(1) & 0xf;
6650 __ Punpcklbw(dst, dst);
6652 __ Punpckhbw(dst, dst);
6655 uint8_t lane4 = lane & 0x3;
6656 uint8_t half_dup = lane4 | (lane4 << 2) | (lane4 << 4) | (lane4 << 6);
6658 __ Pshuflw(dst, dst, half_dup);
6659 __ Punpcklqdq(dst, dst);
6661 __ Pshufhw(dst, dst, half_dup);
6662 __ Punpckhqdq(dst, dst);
6666 case kX64S64x2UnpackHigh:
6669 case kX64S32x4UnpackHigh:
6672 case kX64S32x8UnpackHigh: {
6673 CpuFeatureScope avx2_scope(
masm(), AVX2);
6674 YMMRegister dst =
i.OutputSimd256Register();
6675 __ vpunpckhdq(dst,
i.InputSimd256Register(0),
i.InputSimd256Register(1));
6678 case kX64S16x8UnpackHigh:
6681 case kX64S8x16UnpackHigh:
6684 case kX64S64x2UnpackLow:
6687 case kX64S32x4UnpackLow:
6690 case kX64S32x8UnpackLow: {
6691 CpuFeatureScope avx2_scope(
masm(), AVX2);
6692 YMMRegister dst =
i.OutputSimd256Register();
6693 __ vpunpckldq(dst,
i.InputSimd256Register(0),
i.InputSimd256Register(1));
6696 case kX64S16x8UnpackLow:
6699 case kX64S8x16UnpackLow:
6702 case kX64S16x8UnzipHigh: {
6703 XMMRegister dst =
i.OutputSimd128Register();
6704 XMMRegister src2 = dst;
6706 if (
instr->InputCount() == 2) {
6711 __ Psrld(dst, uint8_t{16});
6712 __ Packusdw(dst, src2);
6715 case kX64S16x8UnzipLow: {
6716 XMMRegister dst =
i.OutputSimd128Register();
6717 XMMRegister src2 = dst;
6720 if (
instr->InputCount() == 2) {
6725 __ Packusdw(dst, src2);
6728 case kX64S8x16UnzipHigh: {
6729 XMMRegister dst =
i.OutputSimd128Register();
6730 XMMRegister src2 = dst;
6732 if (
instr->InputCount() == 2) {
6737 __ Psrlw(dst, uint8_t{8});
6738 __ Packuswb(dst, src2);
6741 case kX64S8x16UnzipLow: {
6742 XMMRegister dst =
i.OutputSimd128Register();
6743 XMMRegister src2 = dst;
6745 if (
instr->InputCount() == 2) {
6751 __ Psllw(dst, uint8_t{8});
6752 __ Psrlw(dst, uint8_t{8});
6753 __ Packuswb(dst, src2);
6756 case kX64S8x16TransposeLow: {
6757 XMMRegister dst =
i.OutputSimd128Register();
6759 __ Psllw(dst, uint8_t{8});
6760 if (
instr->InputCount() == 1) {
6767 __ Psrlw(dst, uint8_t{8});
6771 case kX64S8x16TransposeHigh: {
6772 XMMRegister dst =
i.OutputSimd128Register();
6774 __ Psrlw(dst, uint8_t{8});
6775 if (
instr->InputCount() == 1) {
6786 case kX64S8x8Reverse:
6787 case kX64S8x4Reverse:
6788 case kX64S8x2Reverse: {
6790 XMMRegister dst =
i.OutputSimd128Register();
6792 if (arch_opcode != kX64S8x2Reverse) {
6794 uint8_t shuffle_mask = arch_opcode == kX64S8x4Reverse ? 0xB1 : 0x1B;
6795 __ Pshuflw(dst, dst, shuffle_mask);
6796 __ Pshufhw(dst, dst, shuffle_mask);
6800 __ Psllw(dst, uint8_t{8});
6804 case kX64V128AnyTrue: {
6806 XMMRegister src =
i.InputSimd128Register(0);
6817 case kX64IAllTrue: {
6819 VectorLength vec_len = VectorLengthField::decode(opcode);
6820 if (vec_len == kV128) {
6821 switch (lane_size) {
6850 case kX64Blendvpd: {
6851 VectorLength vec_len = VectorLengthField::decode(opcode);
6852 if (vec_len == kV128) {
6853 __ Blendvpd(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6854 i.InputSimd128Register(1),
i.InputSimd128Register(2));
6857 CpuFeatureScope avx_scope(
masm(), AVX);
6858 __ vblendvpd(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
6859 i.InputSimd256Register(1),
i.InputSimd256Register(2));
6863 case kX64Blendvps: {
6864 VectorLength vec_len = VectorLengthField::decode(opcode);
6865 if (vec_len == kV128) {
6866 __ Blendvps(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6867 i.InputSimd128Register(1),
i.InputSimd128Register(2));
6870 CpuFeatureScope avx_scope(
masm(), AVX);
6871 __ vblendvps(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
6872 i.InputSimd256Register(1),
i.InputSimd256Register(2));
6876 case kX64Pblendvb: {
6877 VectorLength vec_len = VectorLengthField::decode(opcode);
6878 if (vec_len == kV128) {
6879 __ Pblendvb(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6880 i.InputSimd128Register(1),
i.InputSimd128Register(2));
6883 CpuFeatureScope avx_scope(
masm(), AVX2);
6884 __ vpblendvb(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
6885 i.InputSimd256Register(1),
i.InputSimd256Register(2));
6889 case kX64I32x4TruncF64x2UZero: {
6890 __ I32x4TruncSatF64x2UZero(
i.OutputSimd128Register(),
6895 case kX64I32x4TruncF32x4U: {
6896 __ I32x4TruncF32x4U(
i.OutputSimd128Register(),
i.InputSimd128Register(0),
6900 case kX64I32x8TruncF32x8U: {
6901 __ I32x8TruncF32x8U(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
6905 case kX64Cvttps2dq: {
6906 VectorLength vec_len = VectorLengthField::decode(opcode);
6907 if (vec_len == kV128) {
6908 __ Cvttps2dq(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
6911 CpuFeatureScope avx_scope(
masm(), AVX);
6912 __ vcvttps2dq(
i.OutputSimd256Register(),
i.InputSimd256Register(0));
6916 case kX64Cvttpd2dq: {
6917 __ Cvttpd2dq(
i.OutputSimd128Register(),
i.InputSimd128Register(0));
6920 case kAtomicStoreWord8: {
6924 case kAtomicStoreWord16: {
6928 case kAtomicStoreWord32: {
6932 case kX64Word64AtomicStoreWord64: {
6936 case kAtomicExchangeInt8: {
6939 __ xchgb(
i.InputRegister(0),
i.MemoryOperand(1));
6940 __ movsxbl(
i.InputRegister(0),
i.InputRegister(0));
6943 case kAtomicExchangeUint8: {
6945 __ xchgb(
i.InputRegister(0),
i.MemoryOperand(1));
6948 __ movzxbl(
i.InputRegister(0),
i.InputRegister(0));
6951 __ movzxbq(
i.InputRegister(0),
i.InputRegister(0));
6956 case kAtomicExchangeInt16: {
6959 __ xchgw(
i.InputRegister(0),
i.MemoryOperand(1));
6960 __ movsxwl(
i.InputRegister(0),
i.InputRegister(0));
6963 case kAtomicExchangeUint16: {
6965 __ xchgw(
i.InputRegister(0),
i.MemoryOperand(1));
6968 __ movzxwl(
i.InputRegister(0),
i.InputRegister(0));
6971 __ movzxwq(
i.InputRegister(0),
i.InputRegister(0));
6976 case kAtomicExchangeWord32: {
6978 __ xchgl(
i.InputRegister(0),
i.MemoryOperand(1));
6981 case kAtomicCompareExchangeInt8: {
6985 __ cmpxchgb(
i.MemoryOperand(2),
i.InputRegister(1));
6986 __ movsxbl(rax, rax);
6989 case kAtomicCompareExchangeUint8: {
6992 __ cmpxchgb(
i.MemoryOperand(2),
i.InputRegister(1));
6995 __ movzxbl(rax, rax);
6998 __ movzxbq(rax, rax);
7003 case kAtomicCompareExchangeInt16: {
7007 __ cmpxchgw(
i.MemoryOperand(2),
i.InputRegister(1));
7008 __ movsxwl(rax, rax);
7011 case kAtomicCompareExchangeUint16: {
7014 __ cmpxchgw(
i.MemoryOperand(2),
i.InputRegister(1));
7017 __ movzxwl(rax, rax);
7020 __ movzxwq(rax, rax);
7025 case kAtomicCompareExchangeWord32: {
7028 __ cmpxchgl(
i.MemoryOperand(2),
i.InputRegister(1));
7035 case kX64Word64AtomicExchangeUint64: {
7037 __ xchgq(
i.InputRegister(0),
i.MemoryOperand(1));
7040 case kX64Word64AtomicCompareExchangeUint64: {
7043 __ cmpxchgq(
i.MemoryOperand(2),
i.InputRegister(1));
7046#define ATOMIC_BINOP_CASE(op, inst32, inst64) \
7047 case kAtomic##op##Int8: \
7048 DCHECK_EQ(AtomicWidthField::decode(opcode), AtomicWidth::kWord32); \
7049 ASSEMBLE_ATOMIC_BINOP(inst32, movb, cmpxchgb); \
7050 __ movsxbl(rax, rax); \
7052 case kAtomic##op##Uint8: \
7053 switch (AtomicWidthField::decode(opcode)) { \
7054 case AtomicWidth::kWord32: \
7055 ASSEMBLE_ATOMIC_BINOP(inst32, movb, cmpxchgb); \
7056 __ movzxbl(rax, rax); \
7058 case AtomicWidth::kWord64: \
7059 ASSEMBLE_ATOMIC64_BINOP(inst64, movb, cmpxchgb); \
7060 __ movzxbq(rax, rax); \
7064 case kAtomic##op##Int16: \
7065 DCHECK_EQ(AtomicWidthField::decode(opcode), AtomicWidth::kWord32); \
7066 ASSEMBLE_ATOMIC_BINOP(inst32, movw, cmpxchgw); \
7067 __ movsxwl(rax, rax); \
7069 case kAtomic##op##Uint16: \
7070 switch (AtomicWidthField::decode(opcode)) { \
7071 case AtomicWidth::kWord32: \
7072 ASSEMBLE_ATOMIC_BINOP(inst32, movw, cmpxchgw); \
7073 __ movzxwl(rax, rax); \
7075 case AtomicWidth::kWord64: \
7076 ASSEMBLE_ATOMIC64_BINOP(inst64, movw, cmpxchgw); \
7077 __ movzxwq(rax, rax); \
7081 case kAtomic##op##Word32: \
7082 switch (AtomicWidthField::decode(opcode)) { \
7083 case AtomicWidth::kWord32: \
7084 ASSEMBLE_ATOMIC_BINOP(inst32, movl, cmpxchgl); \
7086 case AtomicWidth::kWord64: \
7087 ASSEMBLE_ATOMIC64_BINOP(inst64, movl, cmpxchgl); \
7091 case kX64Word64Atomic##op##Uint64: \
7092 ASSEMBLE_ATOMIC64_BINOP(inst64, movq, cmpxchgq); \
7099#undef ATOMIC_BINOP_CASE
7101 case kAtomicLoadInt8:
7102 case kAtomicLoadUint8:
7103 case kAtomicLoadInt16:
7104 case kAtomicLoadUint16:
7105 case kAtomicLoadWord32:
7108 case kX64I32x8DotI16x16S: {
7112 case kX64S256Load8Splat: {
7114 CpuFeatureScope avx2_scope(
masm(), AVX2);
7115 __ vpbroadcastb(
i.OutputSimd256Register(),
i.MemoryOperand());
7118 case kX64S256Load16Splat: {
7120 CpuFeatureScope avx2_scope(
masm(), AVX2);
7121 __ vpbroadcastw(
i.OutputSimd256Register(),
i.MemoryOperand());
7124 case kX64S256Load32Splat: {
7126 CpuFeatureScope avx_scope(
masm(), AVX);
7127 __ vbroadcastss(
i.OutputSimd256Register(),
i.MemoryOperand());
7130 case kX64S256Load64Splat: {
7132 CpuFeatureScope avx_scope(
masm(), AVX);
7133 __ vbroadcastsd(
i.OutputSimd256Register(),
i.MemoryOperand());
7136 case kX64Movdqu256: {
7138 CpuFeatureScope avx_scope(
masm(), AVX);
7139 if (
instr->HasOutput()) {
7140 __ vmovdqu(
i.OutputSimd256Register(),
i.MemoryOperand());
7143 Operand operand =
i.MemoryOperand(&index);
7144 __ vmovdqu(operand,
i.InputSimd256Register(index));
7148 case kX64I16x16SConvertI32x8: {
7149 CpuFeatureScope avx_scope(
masm(), AVX2);
7150 YMMRegister dst =
i.OutputSimd256Register();
7151 __ vpackssdw(dst,
i.InputSimd256Register(0),
i.InputSimd256Register(1));
7154 case kX64I16x16UConvertI32x8: {
7155 CpuFeatureScope avx_scope(
masm(), AVX2);
7156 YMMRegister dst =
i.OutputSimd256Register();
7157 __ vpackusdw(dst,
i.InputSimd256Register(0),
i.InputSimd256Register(1));
7160 case kX64I8x32SConvertI16x16: {
7161 CpuFeatureScope avx_scope(
masm(), AVX2);
7162 YMMRegister dst =
i.OutputSimd256Register();
7163 __ vpacksswb(dst,
i.InputSimd256Register(0),
i.InputSimd256Register(1));
7166 case kX64I8x32UConvertI16x16: {
7167 CpuFeatureScope avx_scope(
masm(), AVX2);
7168 YMMRegister dst =
i.OutputSimd256Register();
7169 __ vpackuswb(dst,
i.InputSimd256Register(0),
i.InputSimd256Register(1));
7172 case kX64I64x4ExtMulI32x4S: {
7173 __ I64x4ExtMul(
i.OutputSimd256Register(),
i.InputSimd128Register(0),
7178 case kX64I64x4ExtMulI32x4U: {
7179 __ I64x4ExtMul(
i.OutputSimd256Register(),
i.InputSimd128Register(0),
7184 case kX64I32x8ExtMulI16x8S: {
7185 __ I32x8ExtMul(
i.OutputSimd256Register(),
i.InputSimd128Register(0),
7190 case kX64I32x8ExtMulI16x8U: {
7191 __ I32x8ExtMul(
i.OutputSimd256Register(),
i.InputSimd128Register(0),
7196 case kX64I16x16ExtMulI8x16S: {
7197 __ I16x16ExtMul(
i.OutputSimd256Register(),
i.InputSimd128Register(0),
7202 case kX64I16x16ExtMulI8x16U: {
7203 __ I16x16ExtMul(
i.OutputSimd256Register(),
i.InputSimd128Register(0),
7208 case kX64S256Load8x16S: {
7209 CpuFeatureScope avx_scope(
masm(), AVX2);
7211 __ vpmovsxbw(
i.OutputSimd256Register(),
i.MemoryOperand());
7214 case kX64S256Load8x16U: {
7215 CpuFeatureScope avx_scope(
masm(), AVX2);
7217 __ vpmovzxbw(
i.OutputSimd256Register(),
i.MemoryOperand());
7220 case kX64S256Load8x8U: {
7221 CpuFeatureScope avx_scope(
masm(), AVX2);
7223 __ vpmovzxbd(
i.OutputSimd256Register(),
i.MemoryOperand());
7226 case kX64S256Load16x8S: {
7227 CpuFeatureScope avx_scope(
masm(), AVX2);
7229 __ vpmovsxwd(
i.OutputSimd256Register(),
i.MemoryOperand());
7232 case kX64S256Load16x8U: {
7233 CpuFeatureScope avx_scope(
masm(), AVX2);
7235 __ vpmovzxwd(
i.OutputSimd256Register(),
i.MemoryOperand());
7238 case kX64S256Load32x4S: {
7239 CpuFeatureScope avx_scope(
masm(), AVX2);
7241 __ vpmovsxdq(
i.OutputSimd256Register(),
i.MemoryOperand());
7244 case kX64S256Load32x4U: {
7245 CpuFeatureScope avx_scope(
masm(), AVX2);
7247 __ vpmovzxdq(
i.OutputSimd256Register(),
i.MemoryOperand());
7250 case kX64S256Const: {
7253 YMMRegister dst =
i.OutputSimd256Register();
7254 uint32_t imm[8] = {};
7255 for (
int j = 0; j < 8; j++) {
7256 imm[j] =
i.InputUint32(j);
7261 case kX64ExtractF128: {
7262 CpuFeatureScope avx_scope(
masm(), AVX);
7263 uint8_t lane =
i.InputInt8(1);
7264 __ vextractf128(
i.OutputSimd128Register(),
i.InputSimd256Register(0),
7268 case kX64InsertI128: {
7269 CpuFeatureScope avx_scope(
masm(), AVX2);
7270 uint8_t imm =
i.InputInt8(2);
7271 InstructionOperand* input0 =
instr->InputAt(0);
7272 if (input0->IsSimd128Register()) {
7273 __ vinserti128(
i.OutputSimd256Register(),
7275 i.InputSimd128Register(1), imm);
7278 __ vinserti128(
i.OutputSimd256Register(),
i.InputSimd256Register(0),
7279 i.InputSimd128Register(1), imm);
7287#undef ASSEMBLE_PINSR
7289#undef ASSEMBLE_BINOP
7290#undef ASSEMBLE_COMPARE
7292#undef ASSEMBLE_SHIFT
7294#undef ASSEMBLE_SSE_BINOP
7295#undef ASSEMBLE_SSE_UNOP
7296#undef ASSEMBLE_AVX_BINOP
7297#undef ASSEMBLE_IEEE754_BINOP
7298#undef ASSEMBLE_IEEE754_UNOP
7299#undef ASSEMBLE_ATOMIC_BINOP
7300#undef ASSEMBLE_ATOMIC64_BINOP
7301#undef ASSEMBLE_SIMD_INSTR
7302#undef ASSEMBLE_SIMD_IMM_INSTR
7303#undef ASSEMBLE_SIMD_PUNPCK_SHUFFLE
7304#undef ASSEMBLE_SIMD_IMM_SHUFFLE
7305#undef ASSEMBLE_SIMD_ALL_TRUE
7306#undef ASSEMBLE_SIMD_SHIFT
7307#undef ASSEMBLE_SEQ_CST_STORE
7355 Label* tlabel = branch->true_label;
7356 Label* flabel = branch->false_label;
7364 if (!branch->fallthru) {
7365 __ aligned_jmp(flabel, flabel_distance);
7374 if (!branch->fallthru) {
7375 __ jmp(flabel, flabel_distance);
7381 BranchInfo* branch) {
7384 Label* tlabel = branch->true_label;
7385 Label* flabel = branch->false_label;
7403 if (
v8_flags.deopt_every_n_times > 0) {
7405 ExternalReference counter =
7406 ExternalReference::stress_deopt_count(
isolate());
7409 static constexpr size_t kSizeofRAX = 8;
7416 __ load_rax(counter);
7421 __ store_rax(counter);
7427 __ store_rax(counter);
7431#if V8_ENABLE_WEBASSEMBLY
7438 __ movq(rbx, Operand(rbp, WasmFrameConstants::kWasmInstanceDataOffset));
7441 Operand(rbx, WasmTrustedInstanceData::kStressDeoptCounterOffset - 1));
7443 __ movq(rax, Operand(rbx, 0));
7448 __ movq(Operand(rbx, 0), rax);
7456 __ movq(Operand(rbx, 0), rax);
7466 if (!branch->fallthru) {
7468 __ aligned_jmp(flabel, flabel_distance);
7470 __ jmp(flabel, flabel_distance);
7480#if V8_ENABLE_WEBASSEMBLY
7481void CodeGenerator::AssembleArchTrap(Instruction*
instr,
7483 auto ool =
zone()->
New<WasmOutOfLineTrap>(
this,
instr);
7484 Label* tlabel = ool->entry();
7499 X64OperandConverter
i(
this,
instr);
7529 BranchInfo* branch) {
7534 Register input, RpoNumber def_block, std::pair<int32_t, Label*>*
begin,
7535 std::pair<int32_t, Label*>*
end, std::optional<int32_t>& last_cmp_value) {
7537 if (last_cmp_value && *last_cmp_value ==
begin->first) {
7553 last_cmp_value = middle->first;
7562 X64OperandConverter
i(
this,
instr);
7564 std::vector<std::pair<int32_t, Label*>> cases;
7565 for (
size_t index = 2; index <
instr->InputCount(); index += 2) {
7566 cases.push_back({
i.InputInt32(index + 0),
GetLabel(
i.InputRpo(index + 1))});
7568 std::optional<int32_t> last_cmp_value;
7570 cases.data() + cases.size(),
7575 X64OperandConverter
i(
this,
instr);
7579 for (int32_t index = 0; index < case_count; ++
index) {
7583 __ cmpl(input, Immediate(case_count));
7598 __ jmp(input,
true);
7608 X64OperandConverter
i(
this,
instr);
7613 size_t last_input =
instr->InputCount() - 1;
7621 __ cmovl(
cc,
i.OutputRegister(),
i.InputRegister(last_input));
7623 __ cmovl(
parity_even,
i.OutputRegister(),
i.InputRegister(last_input));
7626 __ cmovl(
cc,
i.OutputRegister(),
i.InputOperand(last_input));
7628 __ cmovl(
parity_even,
i.OutputRegister(),
i.InputOperand(last_input));
7634 __ cmovq(
cc,
i.OutputRegister(),
i.InputRegister(last_input));
7636 __ cmovq(
parity_even,
i.OutputRegister(),
i.InputRegister(last_input));
7639 __ cmovq(
cc,
i.OutputRegister(),
i.InputOperand(last_input));
7641 __ cmovq(
parity_even,
i.OutputRegister(),
i.InputOperand(last_input));
7656 const DoubleRegList saves_fp = call_descriptor->CalleeSavedFPRegisters();
7657 if (!saves_fp.is_empty()) {
7658 frame->AlignSavedCalleeRegisterSlots();
7659 const uint32_t saves_fp_count = saves_fp.Count();
7660 frame->AllocateSavedCalleeRegisterSlots(
7663 const RegList saves = call_descriptor->CalleeSavedRegisters();
7664 if (!saves.is_empty()) {
7665 frame->AllocateSavedCalleeRegisterSlots(saves.Count());
7674 if (call_descriptor->IsCFunctionCall()) {
7677#if V8_ENABLE_WEBASSEMBLY
7678 if (
info()->GetOutputStackFrameType() == StackFrame::C_WASM_ENTRY) {
7684 }
else if (call_descriptor->IsJSFunctionCall()) {
7687 __ StubPrologue(
info()->GetOutputStackFrameType());
7688#if V8_ENABLE_WEBASSEMBLY
7689 if (call_descriptor->IsAnyWasmFunctionCall() ||
7690 call_descriptor->IsWasmImportWrapper() ||
7691 call_descriptor->IsWasmCapiFunction()) {
7698 if (call_descriptor->IsWasmCapiFunction()) {
7707 int required_slots =
7708 frame()->GetTotalFrameSlotCount() -
frame()->GetFixedSlotCount();
7710 if (
info()->is_osr()) {
7712 __ Abort(AbortReason::kShouldNotDirectlyEnterOsrFunction);
7718 __ RecordComment(
"-- OSR entrypoint --");
7720#ifdef V8_ENABLE_SANDBOX_BOOL
7721 uint32_t expected_frame_size =
7727 __ SbxCheck(
equal, AbortReason::kOsrUnexpectedStackSize);
7733 const RegList saves = call_descriptor->CalleeSavedRegisters();
7734 const DoubleRegList saves_fp = call_descriptor->CalleeSavedFPRegisters();
7736 if (required_slots > 0) {
7738#if V8_ENABLE_WEBASSEMBLY
7758 if (
v8_flags.experimental_wasm_growable_stacks) {
7762 WasmHandleStackOverflowDescriptor::FrameBaseRegister());
7770 __ movq(WasmHandleStackOverflowDescriptor::FrameBaseRegister(), rbp);
7771 __ addq(WasmHandleStackOverflowDescriptor::FrameBaseRegister(),
7772 Immediate(
static_cast<int32_t>(
7775 __ CallBuiltin(Builtin::kWasmHandleStackOverflow);
7776 __ PopAll(fp_regs_to_save);
7779 __ near_call(
static_cast<intptr_t
>(Builtin::kWasmStackOverflow),
7783 ReferenceMap* reference_map =
zone()->
New<ReferenceMap>(
zone());
7785 __ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap);
7792 required_slots -= saves.Count();
7794 required_slots -=
frame()->GetReturnSlotCount();
7795 if (required_slots > 0) {
7800 if (!saves_fp.is_empty()) {
7801 const uint32_t saves_fp_count = saves_fp.Count();
7804 __ AllocateStackSpace(stack_size);
7807 for (XMMRegister
reg : saves_fp) {
7813 if (!saves.is_empty()) {
7820 if (
frame()->GetReturnSlotCount() > 0) {
7827 __ movq(Operand(rbp,
offset.offset()), Immediate(0));
7835 const RegList saves = call_descriptor->CalleeSavedRegisters();
7836 if (!saves.is_empty()) {
7837 const int returns =
frame()->GetReturnSlotCount();
7841 for (Register
reg : saves) {
7845 const DoubleRegList saves_fp = call_descriptor->CalleeSavedFPRegisters();
7846 if (!saves_fp.is_empty()) {
7847 const uint32_t saves_fp_count = saves_fp.Count();
7851 for (XMMRegister
reg : saves_fp) {
7856 __ addq(rsp, Immediate(stack_size));
7861 X64OperandConverter g(
this,
nullptr);
7862 int parameter_slots =
static_cast<int>(call_descriptor->ParameterSlotCount());
7866 if (parameter_slots != 0) {
7867 if (additional_pop_count->IsImmediate()) {
7868 DCHECK_EQ(g.ToConstant(additional_pop_count).ToInt32(), 0);
7870 __ cmpq(g.ToRegister(additional_pop_count), Immediate(0));
7871 __ Assert(
equal, AbortReason::kUnexpectedAdditionalPopValue);
7875#if V8_ENABLE_WEBASSEMBLY
7876 if (call_descriptor->IsAnyWasmFunctionCall() &&
7877 v8_flags.experimental_wasm_growable_stacks) {
7889 __ PrepareCallCFunction(1);
7891 __ CallCFunction(ExternalReference::wasm_shrink_stack(), 1);
7895 __ PopAll(fp_regs_to_save);
7906 const bool drop_jsargs = parameter_slots != 0 &&
7908 call_descriptor->IsJSFunctionCall();
7909 if (call_descriptor->IsCFunctionCall()) {
7912 if (additional_pop_count->IsImmediate() &&
7913 g.ToConstant(additional_pop_count).ToInt32() == 0) {
7919 if (drop_jsargs || is_near_jump) {
7929 DCHECK(!call_descriptor->CalleeSavedRegisters().has(argc_reg));
7940 Label mismatch_return;
7943 DCHECK(!call_descriptor->CalleeSavedRegisters().has(scratch_reg));
7944 DCHECK(!call_descriptor->CalleeSavedRegisters().has(argc_reg));
7945 __ cmpq(argc_reg, Immediate(parameter_slots));
7948 __ bind(&mismatch_return);
7949 __ DropArguments(argc_reg, scratch_reg);
7952 }
else if (additional_pop_count->IsImmediate()) {
7954 DCHECK(!call_descriptor->CalleeSavedRegisters().has(scratch_reg));
7955 int additional_count = g.ToConstant(additional_pop_count).ToInt32();
7957 CHECK_LE(pop_size,
static_cast<size_t>(std::numeric_limits<int>::max()));
7958 __ Ret(
static_cast<int>(pop_size), scratch_reg);
7960 Register pop_reg = g.ToRegister(additional_pop_count);
7961 Register scratch_reg = pop_reg == r10 ? rcx : r10;
7962 DCHECK(!call_descriptor->CalleeSavedRegisters().has(scratch_reg));
7963 DCHECK(!call_descriptor->CalleeSavedRegisters().has(pop_reg));
7965 __ PopReturnAddressTo(scratch_reg);
7967 static_cast<int>(pop_size)));
7968 __ PushReturnAddressFrom(scratch_reg);
7976 ZoneDeque<DeoptimizationExit*>* exits) {}
7981 if (!
info()->IsOptimizing()) {
7982#if V8_ENABLE_WEBASSEMBLY
7983 if (!
info()->IsWasm())
return;
7990 __ incl(
__ ExternalReferenceAsOperand(counter));
7992 if (source->IsAnyStackSlot()) {
8006 int last_frame_slot_id =
8009 int slot_id = last_frame_slot_id + sp_delta + new_slots;
8011 if (source->IsRegister()) {
8012 __ pushq(g.ToRegister(source));
8014 }
else if (source->IsStackSlot() || source->IsFloatStackSlot() ||
8015 source->IsDoubleStackSlot()) {
8016 __ pushq(g.ToOperand(source));
8030 X64OperandConverter g(
this,
nullptr);
8032 if (dest->IsRegister()) {
8034 __ popq(g.ToRegister(dest));
8035 }
else if (dest->IsStackSlot() || dest->IsFloatStackSlot() ||
8036 dest->IsDoubleStackSlot()) {
8038 __ popq(g.ToOperand(dest));
8040 int last_frame_slot_id =
8043 int slot_id = last_frame_slot_id + sp_delta;
8063 DCHECK(!source->IsImmediate());
8097 X64OperandConverter g(
this,
nullptr);
8098 Constant src = g.ToConstant(&move->source());
8099 if (move->destination().IsStackSlot() &&
8105 if (move->source().IsFPLocationOperand()) {
8115bool Is32BitOperand(InstructionOperand* operand) {
8116 DCHECK(operand->IsStackSlot() || operand->IsRegister());
8131bool Use32BitMove(InstructionOperand* source, InstructionOperand*
destination) {
8132 return Is32BitOperand(source) && Is32BitOperand(
destination);
8139 X64OperandConverter g(
this,
nullptr);
8143 auto MoveConstantToRegister = [&](
Register dst, Constant src) {
8144 switch (src.type()) {
8146 int32_t value = src.ToInt32();
8150 __ movl(dst, Immediate(value, src.rmode()));
8156 __ Move(dst, src.ToInt64());
8158 __ movq(dst, Immediate64(src.ToInt64(), src.rmode()));
8162 __ MoveNumber(dst, src.ToFloat32());
8165 __ MoveNumber(dst, src.ToFloat64().value());
8168 __ Move(dst, src.ToExternalReference());
8171 Handle<HeapObject> src_object = src.ToHeapObject();
8174 __ LoadRoot(dst, index);
8176 __ Move(dst, src_object);
8181 Handle<HeapObject> src_object = src.ToHeapObject();
8184 __ LoadTaggedRoot(dst, index);
8195 auto MoveConstantToSlot = [&](Operand dst, Constant src) {
8197 switch (src.type()) {
8199 __ Move(dst, src.ToInt32());
8202 __ Move(dst, src.ToInt64());
8212 if (
v8_flags.trace_turbo_stack_accesses) {
8219 if (source->IsRegister()) {
8227 DCHECK(source->IsFPRegister());
8231 CpuFeatureScope avx_scope(
masm(), AVX);
8233 if (source->IsSimd256Register() &&
destination->IsSimd128Register()) {
8235 g.ToSimd128Register(source));
8238 g.ToSimd256Register(source));
8242 g.ToDoubleRegister(source));
8248 if (source->IsRegister()) {
8249 __ movq(dst, g.ToRegister(source));
8251 DCHECK(source->IsFPRegister());
8252 XMMRegister src = g.ToDoubleRegister(source);
8256 __ Movups(dst, src);
8258 CpuFeatureScope avx_scope(
masm(), AVX);
8260 if (source->IsSimd256Register() &&
8262 __ vmovups(dst, g.ToSimd128Register(source));
8264 __ vmovups(dst, g.ToSimd256Register(source));
8273 Operand src = g.ToOperand(source);
8274 if (source->IsStackSlot()) {
8281 DCHECK(source->IsFPStackSlot());
8282 XMMRegister dst = g.ToDoubleRegister(
destination);
8286 __ Movups(dst, src);
8288 CpuFeatureScope avx_scope(
masm(), AVX);
8289 if (source->IsSimd256StackSlot() &&
8302 Operand src = g.ToOperand(source);
8304 if (source->IsStackSlot()) {
8322 CpuFeatureScope avx_scope(
masm(), AVX);
8323 if (source->IsSimd256StackSlot() &&
8339 Constant src = g.ToConstant(source);
8341 MoveConstantToRegister(g.ToRegister(
destination), src);
8344 XMMRegister dst = g.ToDoubleRegister(
destination);
8350 __ Move(dst, src.ToFloat64().AsUint64());
8356 Constant src = g.ToConstant(source);
8359 MoveConstantToSlot(dst, src);
8366 __ Move(dst, src.ToFloat64().AsUint64());
8377 if (
v8_flags.trace_turbo_stack_accesses) {
8382 X64OperandConverter g(
this,
nullptr);
8387 if (source->IsRegister()) {
8388 Register src = g.ToRegister(source);
8400 DCHECK(source->IsFPRegister());
8404 YMMRegister src = g.ToSimd256Register(source);
8405 YMMRegister dst = g.ToSimd256Register(
destination);
8406 CpuFeatureScope avx_scope(
masm(), AVX);
8408 __ vmovapd(src, dst);
8412 XMMRegister src = g.ToDoubleRegister(source);
8413 XMMRegister dst = g.ToDoubleRegister(
destination);
8415 __ Movapd(src, dst);
8422 if (source->IsRegister()) {
8423 Register src = g.ToRegister(source);
8429 DCHECK(source->IsFPRegister());
8434 XMMRegister src = g.ToDoubleRegister(source);
8436 __ Movups(src, dst);
8439 YMMRegister src = g.ToSimd256Register(source);
8440 CpuFeatureScope avx_scope(
masm(), AVX);
8442 __ vmovups(src, dst);
8445 XMMRegister src = g.ToDoubleRegister(source);
8454 Operand src = g.ToOperand(source);
8511#ifdef V8_ENABLE_BUILTIN_JUMP_TABLE_SWITCH
8518 for (
auto* target : targets) {
8519 __ WriteBuiltinJumpTableEntry(target, table_pos);
8528 for (
size_t index = 0; index < targets.size(); ++
index) {
8529 __ dq(targets[index]);
constexpr int kReturnAddressStackSlotCount
#define Assert(condition)
interpreter::OperandScale scale
static constexpr T decode(U value)
void j(Condition cc, Label *L, Label::Distance distance=Label::kFar)
static constexpr int kIntraSegmentJmpInstrSize
static constexpr bool IsBuiltinId(Builtin builtin)
static constexpr int kFixedSlotCountAboveFp
static constexpr int kFixedFrameSizeAboveFp
static bool IsSupported(CpuFeature f)
static V8_EXPORT_PRIVATE ExternalReference address_of_load_from_stack_count(const char *function_name)
static V8_EXPORT_PRIVATE ExternalReference isolate_address()
static V8_EXPORT_PRIVATE ExternalReference address_of_store_to_stack_count(const char *function_name)
Bootstrapper * bootstrapper()
RootsTable & roots_table()
uint64_t * stress_deopt_count_address()
Tagged_t ReadOnlyRootPtr(RootIndex index)
void JumpIfEqual(Register x, int32_t y, Label *dest)
void JumpIfLessThan(Register x, int32_t y, Label *dest)
static constexpr MainThreadFlags kIncrementalMarking
static constexpr MainThreadFlags kPointersFromHereAreInterestingMask
constexpr void set(RegisterT reg)
constexpr bool is_empty() const
constexpr int8_t code() const
@ COMPRESSED_EMBEDDED_OBJECT
static constexpr bool IsNoInfo(Mode mode)
bool IsRootHandle(IndirectHandle< T > handle, RootIndex *index) const
static constexpr Tagged< Smi > FromInt(int value)
static constexpr int32_t TypeToMarker(Type type)
static constexpr int kFixedFrameSizeFromFp
static constexpr int kArgCOffset
static constexpr int kFrameTypeOffset
static constexpr Register GapRegister()
static constexpr bool kUninterestingPagesCanBeSkipped
static constexpr YMMRegister from_code(int code)
static constexpr YMMRegister from_xmm(XMMRegister xmm)
base::Vector< T > AllocateVector(size_t length)
RegList CalleeSavedRegisters() const
DoubleRegList CalleeSavedFPRegisters() const
static Type InferSwap(InstructionOperand *source, InstructionOperand *destination)
static Type InferMove(InstructionOperand *source, InstructionOperand *destination)
void MoveToTempLocation(InstructionOperand *src, MachineRepresentation rep) final
void AssembleArchJump(RpoNumber target)
void AssembleTailCallAfterGap(Instruction *instr, int first_unused_stack_slot)
void AssembleReturn(InstructionOperand *pop)
void AssembleTailCallBeforeGap(Instruction *instr, int first_unused_stack_slot)
FrameAccessState * frame_access_state() const
void AssembleConstructFrame()
uint16_t parameter_count_
CodeGenResult AssembleArchInstruction(Instruction *instr)
static constexpr int kBinarySearchSwitchMinimalCases
void PopTempStackSlots() final
DeoptimizationExit * BuildTranslation(Instruction *instr, int pc_offset, size_t frame_state_offset, size_t immediate_args_count, OutputFrameStateCombine state_combine)
Isolate * isolate() const
void AssembleArchBinarySearchSwitch(Instruction *instr)
void AssembleArchJumpRegardlessOfAssemblyOrder(RpoNumber target)
FrameAccessState * frame_access_state_
static void GetPushCompatibleMoves(Instruction *instr, PushTypeFlags push_type, ZoneVector< MoveOperands * > *pushes)
void FinishFrame(Frame *frame)
Linkage * linkage() const
void AssembleArchBoolean(Instruction *instr, FlagsCondition condition)
void IncrementStackAccessCounter(InstructionOperand *source, InstructionOperand *destination)
void AssembleJumpTable(base::Vector< Label * > targets)
void AssembleArchBranch(Instruction *instr, BranchInfo *branch)
void AssembleMove(InstructionOperand *source, InstructionOperand *destination) final
void SetPendingMove(MoveOperands *move) final
void AssembleCodeStartRegisterCheck()
bool ShouldApplyOffsetToStackCheck(Instruction *instr, uint32_t *offset)
base::Flags< PushTypeFlag > PushTypeFlags
void RecordSafepoint(ReferenceMap *references, int pc_offset=0)
void AssembleArchBinarySearchSwitchRange(Register input, RpoNumber def_block, std::pair< int32_t, Label * > *begin, std::pair< int32_t, Label * > *end)
void PrepareForDeoptimizationExits(ZoneDeque< DeoptimizationExit * > *exits)
StubCallMode DetermineStubCallMode() const
bool caller_registers_saved_
void AssembleArchTableSwitch(Instruction *instr)
void BailoutIfDeoptimized()
bool IsMaterializableFromRoot(Handle< HeapObject > object, RootIndex *index_return)
void AssembleDeconstructFrame()
UnwindingInfoWriter unwinding_info_writer_
void AssembleArchConditionalBranch(Instruction *instr, BranchInfo *branch)
AllocatedOperand Push(InstructionOperand *src) final
void MoveTempLocationTo(InstructionOperand *dst, MachineRepresentation rep) final
void AssemblePlaceHolderForLazyDeopt(Instruction *instr)
uint32_t GetStackCheckOffset()
void AssembleArchDeoptBranch(Instruction *instr, BranchInfo *branch)
Label * GetLabel(RpoNumber rpo)
void RecordCallPosition(Instruction *instr)
void AssembleSwap(InstructionOperand *source, InstructionOperand *destination) final
MoveCycleState move_cycle_
void AssemblePrepareTailCall()
Label * AddJumpTable(base::Vector< Label * > targets)
void AssembleArchConditionalBoolean(Instruction *instr)
void RecordDeoptInfo(Instruction *instr, int pc_offset)
OptimizedCompilationInfo * info() const
const Frame * frame() const
void AssembleArchSelect(Instruction *instr, FlagsCondition condition)
void Pop(InstructionOperand *src, MachineRepresentation rep) final
void SetFrameAccessToDefault()
void SetFrameAccessToSP()
void SetFrameAccessToFP()
FrameOffset GetFrameOffset(int spill_slot) const
const Frame * frame() const
void IncreaseSPDelta(int amount)
FrameAccessState * frame_access_state() const
int32_t InputInt32(size_t index)
Constant ToConstant(InstructionOperand *op) const
Register InputRegister(size_t index) const
bool IsFPStackSlot() const
bool HasCallDescriptorFlag(CallDescriptor::Flag flag) const
const InstructionOperand * Output() const
InstructionCode opcode() const
const InstructionOperand * InputAt(size_t i) const
size_t OutputCount() const
AddressingMode addressing_mode() const
size_t InputCount() const
CallDescriptor * GetIncomingDescriptor() const
MachineRepresentation representation() const
static LocationOperand * cast(InstructionOperand *op)
size_t UnoptimizedFrameSlots()
static OutputFrameStateCombine Ignore()
void MarkFrameConstructed(int at_pc)
void MarkFrameDeconstructed(int at_pc)
void MaybeIncreaseBaseOffsetAt(int pc_offset, int base_delta)
Immediate InputImmediate(size_t index)
static ScaleFactor ScaleFor(AddressingMode one, AddressingMode mode)
Operand SlotToOperand(int slot_index, int extra=0)
Operand InputOperand(size_t index, int extra=0)
Operand MemoryOperand(size_t *offset)
Operand MemoryOperand(size_t first_input=0)
static size_t NextOffset(size_t *offset)
X64OperandConverter(CodeGenerator *gen, Instruction *instr)
Operand ToOperand(InstructionOperand *op, int extra=0)
Immediate ToImmediate(InstructionOperand *operand)
#define ASSEMBLE_SHIFT(asm_instr, width)
IndirectPointerTag indirect_pointer_tag_
UnwindingInfoWriter *const unwinding_info_writer_
#define ATOMIC_BINOP_CASE(op, inst)
#define ASSEMBLE_IEEE754_UNOP(name)
#define ASSEMBLE_IEEE754_BINOP(name)
RecordWriteMode const mode_
#define ASSEMBLE_SIMD_PUNPCK_SHUFFLE(opcode)
#define ASSEMBLE_BINOP(asm_instr)
#define ASSEMBLE_SIMD_ALL_TRUE(opcode)
#define ASSEMBLE_MOVX(mov_instr)
#define ASSEMBLE_COMPARE(asm_instr)
#define ASSEMBLE_SIMD_SHIFT(opcode, width)
#define ASSEMBLE_SIMD_IMM_SHUFFLE(opcode, SSELevel, imm)
#define ASSEMBLE_SIMD_F16x8_RELOP(instr)
#define ASSEMBLE_SEQ_CST_STORE(rep)
#define ASSEMBLE_SIMD256_SHIFT(opcode, width)
#define ASSEMBLE_SIMD_INSTR(opcode, dst_operand, index)
#define ASSEMBLE_SIMD_F16x8_BINOP(instr)
#define ASSEMBLE_SIMD256_BINOP(opcode, cpu_feature)
#define ASSEMBLE_UNOP(asm_instr)
#define ASSEMBLE_AVX_BINOP(asm_instr)
#define ASSEMBLE_TEST(asm_instr)
#define ASSEMBLE_SSE_UNOP(asm_instr)
#define ASSEMBLE_SIMD_IMM_INSTR(opcode, dst_operand, index, imm)
#define ASSEMBLE_SSE_BINOP(asm_instr)
#define ASSEMBLE_SIMD_BINOP(opcode)
#define ASSEMBLE_MULT(asm_instr)
#define ASSEMBLE_PINSR(ASM_INSTR)
#define COMPRESS_POINTERS_BOOL
#define V8_JS_LINKAGE_INCLUDES_DISPATCH_HANDLE_BOOL
ZoneVector< RpoNumber > & result
LiftoffRegList regs_to_save
InstructionOperand source
InstructionOperand destination
v8::SourceLocation SourceLocation
signed_type NegateWithWraparound(signed_type a)
V8_INLINE Dest bit_cast(Source const &source)
void PushAll(BaselineAssembler *basm, Args... args)
@ kValueIsIndirectPointer
static bool HasImmediateInput(Instruction *instr, size_t index)
bool IsMacroFused(FirstMacroFusionInstKind first_kind, SecondMacroFusionInstKind second_kind)
static bool HasRegisterInput(Instruction *instr, size_t index)
bool ShouldClearOutputRegisterBeforeInstruction(CodeGenerator *g, Instruction *instr)
static Condition FlagsConditionToCondition(FlagsCondition condition)
@ kSignedGreaterThanOrEqual
@ kUnsignedLessThanOrEqual
@ kUnsignedGreaterThanOrEqual
bool ShouldAlignForJCCErratum(Instruction *instr, FirstMacroFusionInstKind first_kind)
SecondMacroFusionInstKind GetSecondMacroFusionInstKind(FlagsCondition condition)
@ kMemoryAccessProtectedMemOutOfBounds
@ kMemoryAccessProtectedNullDereference
Node::Uses::const_iterator begin(const Node::Uses &uses)
SecondMacroFusionInstKind
bool IsTrapHandlerEnabled()
void And(LiftoffAssembler *lasm, Register dst, Register lhs, Register rhs)
constexpr DoubleRegister kFpReturnRegisters[]
constexpr Register kGpParamRegisters[]
constexpr DoubleRegister kFpParamRegisters[]
constexpr Register kGpReturnRegisters[]
constexpr Register kRootRegister
RegListBase< DoubleRegister > DoubleRegList
constexpr int kTaggedSize
constexpr int kSimd128Size
V8_EXPORT_PRIVATE constexpr int ElementSizeInPointers(MachineRepresentation rep)
DwVfpRegister DoubleRegister
constexpr DoubleRegister kScratchDoubleReg
@ kIndirectPointerNullTag
RegListBase< Register > RegList
Operand FieldOperand(Register object, int offset)
V8_INLINE constexpr bool IsValidIndirectPointerTag(IndirectPointerTag tag)
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in allocation gc speed threshold for starting incremental marking via a task in percent of available threshold for starting incremental marking immediately in percent of available Use a single schedule for determining a marking schedule between JS and C objects schedules the minor GC task with kUserVisible priority max worker number of concurrent for NumberOfWorkerThreads start background threads that allocate memory concurrent_array_buffer_sweeping use parallel threads to clear weak refs in the atomic pause trace progress of the incremental marking trace object counts and memory usage report a tick only when allocated zone memory changes by this amount TracingFlags::gc_stats TracingFlags::gc_stats track native contexts that are expected to be garbage collected verify heap pointers before and after GC memory reducer runs GC with ReduceMemoryFootprint flag Maximum number of memory reducer GCs scheduled Old gen GC speed is computed directly from gc tracer counters Perform compaction on full GCs based on V8 s default heuristics Perform compaction on every full GC Perform code space compaction when finalizing a full GC with stack Stress GC compaction to flush out bugs with moving objects flush of baseline code when it has not been executed recently Use time base code flushing instead of age Use a progress bar to scan large objects in increments when incremental marking is active force incremental marking for small heaps and run it more often force marking at random points between and force scavenge at random points between and reclaim otherwise unreachable unmodified wrapper objects when possible less compaction in non memory reducing mode use high priority threads for concurrent Marking Test mode only flag It allows an unit test to select evacuation candidates use incremental marking for CppHeap cppheap_concurrent_marking c value for membalancer A special constant to balance between memory and space tradeoff The smaller the more memory it uses enable use of SSE4 instructions if available enable use of AVX VNNI instructions if available enable use of POPCNT instruction if available force all emitted branches to be in long mode(MIPS/PPC only)") DEFINE_BOOL(partial_constant_pool
constexpr int kSimd256Size
constexpr int kSystemPointerSize
constexpr bool IsFloatingPoint(MachineRepresentation rep)
constexpr unsigned kQuadWordSize
constexpr Register kReturnRegister0
constexpr Register kScratchRegister
constexpr Register kWasmImplicitArgRegister
V8_EXPORT_PRIVATE bool AreAliased(const CPURegister ®1, const CPURegister ®2, const CPURegister ®3=NoReg, const CPURegister ®4=NoReg, const CPURegister ®5=NoReg, const CPURegister ®6=NoReg, const CPURegister ®7=NoReg, const CPURegister ®8=NoReg)
V8_EXPORT_PRIVATE FlagValues v8_flags
constexpr Register kJavaScriptCallCodeStartRegister
constexpr Register kPtrComprCageBaseRegister
constexpr VFPRoundingMode kRoundToZero
V8_EXPORT_PRIVATE constexpr int ElementSizeInBytes(MachineRepresentation)
@ times_system_pointer_size
constexpr Register kCArgRegs[]
constexpr int kDoubleSize
constexpr Register kJavaScriptCallDispatchHandleRegister
const uint32_t kClearedWeakHeapObjectLower32
static int FrameSlotToFPOffset(int slot)
constexpr YMMRegister kScratchSimd256Reg
#define DCHECK_LE(v1, v2)
#define CHECK_LE(lhs, rhs)
#define DCHECK_NOT_NULL(val)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_NE(v1, v2)
#define DCHECK_GE(v1, v2)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
constexpr bool IsAligned(T value, U alignment)
uint64_t make_uint64(uint32_t high, uint32_t low)
bool pending_double_scratch_register_use
bool pending_scratch_register_use
#define V8_STATIC_ROOTS_BOOL
#define V8_UNLIKELY(condition)