diff --git a/src/compiler/backend/arm64/code-generator-arm64.cc b/src/compiler/backend/arm64/code-generator-arm64.cc index ffd7852541ea..349ef29542e3 100644 --- a/src/compiler/backend/arm64/code-generator-arm64.cc +++ b/src/compiler/backend/arm64/code-generator-arm64.cc @@ -3166,17 +3166,11 @@ void CodeGenerator::AssembleArchSelect(Instruction* instr, __ Fcsel(i.OutputFloat32Register(), i.InputFloat32Register(true_value_index), i.InputFloat32Register(false_value_index), cc); - } else if (rep == MachineRepresentation::kFloat64) { + } else { + DCHECK_EQ(rep, MachineRepresentation::kFloat64); __ Fcsel(i.OutputFloat64Register(), i.InputFloat64Register(true_value_index), i.InputFloat64Register(false_value_index), cc); - } else if (rep == MachineRepresentation::kWord32) { - __ Csel(i.OutputRegister32(), i.InputRegister32(true_value_index), - i.InputRegister32(false_value_index), cc); - } else { - DCHECK_EQ(rep, MachineRepresentation::kWord64); - __ Csel(i.OutputRegister64(), i.InputRegister64(true_value_index), - i.InputRegister64(false_value_index), cc); } } diff --git a/src/compiler/backend/arm64/instruction-selector-arm64.cc b/src/compiler/backend/arm64/instruction-selector-arm64.cc index 5f92341c4fe5..1529cbbac3bc 100644 --- a/src/compiler/backend/arm64/instruction-selector-arm64.cc +++ b/src/compiler/backend/arm64/instruction-selector-arm64.cc @@ -4785,8 +4785,6 @@ InstructionSelector::SupportedMachineOperatorFlags() { MachineOperatorBuilder::kSatConversionIsSafe | MachineOperatorBuilder::kFloat32Select | MachineOperatorBuilder::kFloat64Select | - MachineOperatorBuilder::kWord32Select | - MachineOperatorBuilder::kWord64Select | MachineOperatorBuilder::kLoadStorePairs; } diff --git a/test/cctest/compiler/test-run-machops.cc b/test/cctest/compiler/test-run-machops.cc index 5753e0606db8..fa97076a1afa 100644 --- a/test/cctest/compiler/test-run-machops.cc +++ b/test/cctest/compiler/test-run-machops.cc @@ -472,22 +472,6 @@ TEST(RunSelectUnorderedNotEqual) { CHECK_EQ(input1, m.Call(input1, input2, std::nanf(""))); } -namespace { -template -ExternalReference ExternalRefFromFunc(RawMachineAssemblerTester* m, - Address func_address) { - ExternalReference::Type func_type = ExternalReference::FAST_C_CALL; - ApiFunction func(func_address); - ExternalReference ref = ExternalReference::Create(&func, func_type); -#ifdef V8_USE_SIMULATOR_WITH_GENERIC_C_CALLS - EncodedCSignature sig = m->call_descriptor()->ToEncodedCSignature(); - m->main_isolate()->simulator_data()->AddSignatureForTargetForTesting( - func_address, sig); -#endif - return ref; -} -} // namespace - namespace { void FooForSelect() {} } // namespace @@ -500,13 +484,14 @@ TEST(RunWord32SelectWithMemoryInput) { } // Test that the generated code also works with values spilled on the stack. - ExternalReference ref = ExternalRefFromFunc(&m, FUNCTION_ADDR(FooForSelect)); + + auto* foo_ptr = &FooForSelect; constexpr int input1 = 16; int input2 = 3443; // Load {value2} before the function call so that it gets spilled. Node* value2 = m.LoadFromPointer(&input2, MachineType::Int32()); + Node* function = m.LoadFromPointer(&foo_ptr, MachineType::Pointer()); // Call a function so that {value2} gets spilled on the stack. - Node* function = m.ExternalConstant(ref); m.CallCFunction(function, MachineType::Int32()); Node* cmp = m.Word32Equal(m.Parameter(1), m.Int32Constant(0)); m.Return(m.Word32Select(cmp, m.Parameter(0), value2)); @@ -526,13 +511,13 @@ TEST(RunWord64SelectWithMemoryInput) { // Test that the generated code also works with values spilled on the stack. - ExternalReference ref = ExternalRefFromFunc(&m, FUNCTION_ADDR(FooForSelect)); + auto* foo_ptr = &FooForSelect; constexpr int64_t input1 = 16; int64_t input2 = 0x12345678ABCD; // Load {value2} before the function call so that it gets spilled. Node* value2 = m.LoadFromPointer(&input2, MachineType::Int64()); + Node* function = m.LoadFromPointer(&foo_ptr, MachineType::Pointer()); // Call a function so that {value2} gets spilled on the stack. - Node* function = m.ExternalConstant(ref); m.CallCFunction(function, MachineType::Int32()); Node* cmp = m.Word32Equal(m.Parameter(1), m.Int32Constant(0)); m.Return(m.Word64Select(cmp, m.Parameter(0), value2)); @@ -6793,6 +6778,20 @@ TEST(RunCallCFunction9) { #endif // !USE_SIMULATOR #ifdef V8_ENABLE_FP_PARAMS_IN_C_LINKAGE +#ifdef V8_USE_SIMULATOR_WITH_GENERIC_C_CALLS +#define IF_SIMULATOR_ADD_SIGNATURE \ + EncodedCSignature sig = m.call_descriptor()->ToEncodedCSignature(); \ + m.main_isolate()->simulator_data()->AddSignatureForTargetForTesting( \ + func_address, sig); +#else +#define IF_SIMULATOR_ADD_SIGNATURE +#endif // V8_USE_SIMULATOR_WITH_GENERIC_C_CALLS + +#define EXTERNAL_REF_FROM_FUNC(FUNC) \ + Address func_address = FUNCTION_ADDR(&FUNC); \ + ExternalReference::Type func_type = ExternalReference::FAST_C_CALL; \ + ApiFunction func(func_address); \ + ExternalReference ref = ExternalReference::Create(&func, func_type); namespace { @@ -6920,7 +6919,8 @@ double int_foo10(int64_t a, int64_t b, int64_t c, int64_t d, int64_t e, TEST(RunCallDoubleCFunction0) { RawMachineAssemblerTester m; - ExternalReference ref = ExternalRefFromFunc(&m, FUNCTION_ADDR(double_foo0)); + EXTERNAL_REF_FROM_FUNC(double_foo0) + IF_SIMULATOR_ADD_SIGNATURE Node* function = m.ExternalConstant(ref); m.Return(m.CallCFunction(function, MachineType::Float64())); @@ -6929,7 +6929,8 @@ TEST(RunCallDoubleCFunction0) { TEST(RunCallDoubleCFunction1) { RawMachineAssemblerTester m(MachineType::Float64()); - ExternalReference ref = ExternalRefFromFunc(&m, FUNCTION_ADDR(double_foo1)); + EXTERNAL_REF_FROM_FUNC(double_foo1) + IF_SIMULATOR_ADD_SIGNATURE Node* function = m.ExternalConstant(ref); m.Return( @@ -6941,7 +6942,8 @@ TEST(RunCallDoubleCFunction1) { TEST(RunCallDoubleCFunction2) { RawMachineAssemblerTester m(MachineType::Float64(), MachineType::Float64()); - ExternalReference ref = ExternalRefFromFunc(&m, FUNCTION_ADDR(double_foo2)); + EXTERNAL_REF_FROM_FUNC(double_foo2) + IF_SIMULATOR_ADD_SIGNATURE Node* function = m.ExternalConstant(ref); m.Return( @@ -6959,7 +6961,8 @@ TEST(RunCallDoubleCFunction8) { MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Float64()); - ExternalReference ref = ExternalRefFromFunc(&m, FUNCTION_ADDR(double_foo8)); + EXTERNAL_REF_FROM_FUNC(double_foo8) + IF_SIMULATOR_ADD_SIGNATURE Node* function = m.ExternalConstant(ref); Node* param = m.Parameter(0); @@ -6983,7 +6986,8 @@ TEST(RunCallDoubleCFunction9) { MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Float64()); - ExternalReference ref = ExternalRefFromFunc(&m, FUNCTION_ADDR(double_foo9)); + EXTERNAL_REF_FROM_FUNC(double_foo9) + IF_SIMULATOR_ADD_SIGNATURE Node* function = m.ExternalConstant(ref); Node* param = m.Parameter(0); @@ -7018,7 +7022,8 @@ TEST(RunCallDoubleCFunction10) { MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Float64(), MachineType::Int64()); - ExternalReference ref = ExternalRefFromFunc(&m, FUNCTION_ADDR(double_foo10)); + EXTERNAL_REF_FROM_FUNC(double_foo10) + IF_SIMULATOR_ADD_SIGNATURE Node* function = m.ExternalConstant(ref); m.Return( @@ -7046,7 +7051,8 @@ TEST(RunCallIntCFunction10) { MachineType::Int64(), MachineType::Int64(), MachineType::Int64(), MachineType::Int64(), MachineType::Int64(), MachineType::Int64(), MachineType::Float64()); - ExternalReference ref = ExternalRefFromFunc(&m, FUNCTION_ADDR(int_foo10)); + EXTERNAL_REF_FROM_FUNC(int_foo10) + IF_SIMULATOR_ADD_SIGNATURE Node* function = m.ExternalConstant(ref); m.Return( diff --git a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc index 63602be4804c..5c7b8b67b9d3 100644 --- a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc +++ b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc @@ -2993,32 +2993,6 @@ TEST_F(InstructionSelectorTest, Float64SelectWithRegisters) { EXPECT_EQ(kNotEqual, s[0]->flags_condition()); } -TEST_F(InstructionSelectorTest, Word32SelectWithRegisters) { - StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), - MachineType::Int32()); - Node* cond = m.Int32Constant(1); - m.Return(m.Word32Select(cond, m.Parameter(0), m.Parameter(1))); - Stream s = m.Build(); - EXPECT_EQ(kArm64Tst32, s[0]->arch_opcode()); - EXPECT_EQ(4U, s[0]->InputCount()); - EXPECT_EQ(1U, s[0]->OutputCount()); - EXPECT_EQ(kFlags_select, s[0]->flags_mode()); - EXPECT_EQ(kNotEqual, s[0]->flags_condition()); -} - -TEST_F(InstructionSelectorTest, Word64SelectWithRegisters) { - StreamBuilder m(this, MachineType::Int32(), MachineType::Int64(), - MachineType::Int64()); - Node* cond = m.Int32Constant(1); - m.Return(m.Word64Select(cond, m.Parameter(0), m.Parameter(1))); - Stream s = m.Build(); - EXPECT_EQ(kArm64Tst32, s[0]->arch_opcode()); - EXPECT_EQ(4U, s[0]->InputCount()); - EXPECT_EQ(1U, s[0]->OutputCount()); - EXPECT_EQ(kFlags_select, s[0]->flags_mode()); - EXPECT_EQ(kNotEqual, s[0]->flags_condition()); -} - // ----------------------------------------------------------------------------- // Conversions.