aboutsummaryrefslogtreecommitdiff
path: root/backend/unittests/CodeGen
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-12 00:39:19 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-12 00:39:19 +0800
commit524aad16ef496c849e812e972ed31b9d0db8c373 (patch)
treebd032e32a2751134c76706d9c954c58490595daf /backend/unittests/CodeGen
parent384d524b497826e0760f1bb3b54f0533e0f33957 (diff)
downloadrcc-project-524aad16ef496c849e812e972ed31b9d0db8c373.tar.gz
rcc-project-524aad16ef496c849e812e972ed31b9d0db8c373.tar.xz
[CodeGen] Accept pointer comparisons in G_ICMP
Diffstat (limited to 'backend/unittests/CodeGen')
-rw-r--r--backend/unittests/CodeGen/GenericOpcodesTest.cpp13
1 files changed, 12 insertions, 1 deletions
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<rcc::MachineOperand> FloatingLoad;
FloatingLoad.push_back(registerOperand(Float64, true));