aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/Target
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-16 16:13:12 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-16 16:13:12 +0800
commitca25d25d4c5131491a50b1a94e63e9b2d3c34ed4 (patch)
tree995b2f5e2a1312bced1d899be4fd87f95e49c73b /backend/lib/Target
parent4f7b41c3c711d6c6fa4e422f3eec8961c91eea7a (diff)
downloadrcc-project-ca25d25d4c5131491a50b1a94e63e9b2d3c34ed4.tar.gz
rcc-project-ca25d25d4c5131491a50b1a94e63e9b2d3c34ed4.tar.xz
[RISCV][GlobalISel] Select comparisons against zero
Diffstat (limited to 'backend/lib/Target')
-rw-r--r--backend/lib/Target/RISCV/RISCVGISel.rccdesc21
1 files changed, 21 insertions, 0 deletions
diff --git a/backend/lib/Target/RISCV/RISCVGISel.rccdesc b/backend/lib/Target/RISCV/RISCVGISel.rccdesc
index 97ed3d6..bd946be 100644
--- a/backend/lib/Target/RISCV/RISCVGISel.rccdesc
+++ b/backend/lib/Target/RISCV/RISCVGISel.rccdesc
@@ -155,3 +155,24 @@ selection_rules:
- { index: 0, bank: GPR }
- { index: 1, bank: FPR }
apply: { opcode: FCLASS_D }
+ -
+ id: select_g_icmp_ne_zero
+ priority: 200
+ match:
+ opcode: G_ICMP
+ result_type: { kind: scalar, bits: 64 }
+ integer_predicate: { index: 1, value: ne }
+ operand_types:
+ - { index: 2, kind: scalar, bits: 64 }
+ operand_banks:
+ - { index: 0, bank: GPR }
+ - { index: 2, bank: GPR }
+ operand_def_constants:
+ - { index: 3, value: 0 }
+ apply:
+ opcode: SLTU
+ operands:
+ - { operand: 0 }
+ - { physical_register: X0, flags: [use] }
+ - { operand: 2 }
+ erase_operand_definitions: [3]