From 524aad16ef496c849e812e972ed31b9d0db8c373 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Wed, 12 Aug 2026 00:39:19 +0800 Subject: [CodeGen] Accept pointer comparisons in G_ICMP --- backend/unittests/CodeGen/GenericOpcodesTest.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'backend/unittests/CodeGen/GenericOpcodesTest.cpp') diff --git a/backend/unittests/CodeGen/GenericOpcodesTest.cpp b/backend/unittests/CodeGen/GenericOpcodesTest.cpp index 2463fce..c9ed8d5 100644 --- a/backend/unittests/CodeGen/GenericOpcodesTest.cpp +++ b/backend/unittests/CodeGen/GenericOpcodesTest.cpp @@ -456,9 +456,20 @@ void testShapesAndTypes(TestContext &Context) { .has_value(), "G_ICMP must accept an i1 result and homogeneous integer sources"); CompareOperands[0] = registerOperand(*Dst32, true); + Context.expect(Set->validateExplicitOperands(rcc::opcode(rcc::GenericOpcode::G_ICMP), + CompareOperands, (*Function)->registerInfo()) + .has_value(), + "G_ICMP must accept a legalized integer result container"); + CompareOperands[2] = registerOperand(*Address, false); + CompareOperands[3] = registerOperand(*NewAddress, false); + Context.expect(Set->validateExplicitOperands(rcc::opcode(rcc::GenericOpcode::G_ICMP), + CompareOperands, (*Function)->registerInfo()) + .has_value(), + "G_ICMP must accept homogeneous pointer sources"); + CompareOperands[3] = registerOperand(*Src32B, false); Context.expect(!Set->validateExplicitOperands(rcc::opcode(rcc::GenericOpcode::G_ICMP), CompareOperands, (*Function)->registerInfo()), - "G_ICMP must reject a non-i1 result"); + "G_ICMP must reject mixed pointer and integer sources"); std::vector FloatingLoad; FloatingLoad.push_back(registerOperand(Float64, true)); -- cgit v1.2.3