From ca25d25d4c5131491a50b1a94e63e9b2d3c34ed4 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Sun, 16 Aug 2026 16:13:12 +0800 Subject: [RISCV][GlobalISel] Select comparisons against zero --- backend/lib/Target/RISCV/RISCVGISel.rccdesc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'backend/lib/Target') 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] -- cgit v1.2.3