[llvm] [AMDGPU] Fix wrong reverse operations for `v_cmpx_le_u32` (PR #146398)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 1 06:58:32 PDT 2025


https://github.com/shiltian updated https://github.com/llvm/llvm-project/pull/146398

>From 2b6aa12a606f12218c4b18ecf13cc7c4a0086748 Mon Sep 17 00:00:00 2001
From: Shilei Tian <i at tianshilei.me>
Date: Mon, 30 Jun 2025 17:33:50 -0400
Subject: [PATCH] [AMDGPU] Fix wrong reverse operations for `v_cmpx_le_u32`

Fixes SWDEV-538616.
---
 llvm/lib/Target/AMDGPU/VOPCInstructions.td | 2 +-
 llvm/test/CodeGen/AMDGPU/cmp_shrink.mir    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/VOPCInstructions.td b/llvm/lib/Target/AMDGPU/VOPCInstructions.td
index ca5ed5cd24603..9e84f6aed0176 100644
--- a/llvm/lib/Target/AMDGPU/VOPCInstructions.td
+++ b/llvm/lib/Target/AMDGPU/VOPCInstructions.td
@@ -846,7 +846,7 @@ defm V_CMP_T_U32 : VOPC_I32 <"v_cmp_t_u32">;
 defm V_CMPX_F_U32 : VOPCX_I32 <"v_cmpx_f_u32">;
 defm V_CMPX_LT_U32 : VOPCX_I32 <"v_cmpx_lt_u32", "v_cmpx_gt_u32">;
 defm V_CMPX_EQ_U32 : VOPCX_I32 <"v_cmpx_eq_u32">;
-defm V_CMPX_LE_U32 : VOPCX_I32 <"v_cmpx_le_u32", "v_cmpx_le_u32">;
+defm V_CMPX_LE_U32 : VOPCX_I32 <"v_cmpx_le_u32", "v_cmpx_ge_u32">;
 defm V_CMPX_GT_U32 : VOPCX_I32 <"v_cmpx_gt_u32">;
 defm V_CMPX_NE_U32 : VOPCX_I32 <"v_cmpx_ne_u32">;
 defm V_CMPX_GE_U32 : VOPCX_I32 <"v_cmpx_ge_u32">;
diff --git a/llvm/test/CodeGen/AMDGPU/cmp_shrink.mir b/llvm/test/CodeGen/AMDGPU/cmp_shrink.mir
index 296903043bceb..b82c420940006 100644
--- a/llvm/test/CodeGen/AMDGPU/cmp_shrink.mir
+++ b/llvm/test/CodeGen/AMDGPU/cmp_shrink.mir
@@ -17,9 +17,9 @@ body:             |
   bb.0:
     ; GCN-LABEL: name: shrink_icmp
     ; GCN: %op0:sgpr_32 = COPY $sgpr0
-    ; GCN-NEXT: %cond:sreg_64 = V_CMPX_LE_U32_e64 5, %op0, implicit-def $exec, implicit $exec
+    ; GCN-NEXT: %cond:sreg_64 = V_CMP_GE_U32_e64 5, %op0, implicit $exec
     ; GCN-NEXT: S_NOP 0
     %op0:sgpr_32 = COPY $sgpr0
-    %cond:sreg_64 = V_CMPX_LE_U32_e64 %op0, 5, implicit-def $exec, implicit $exec
+    %cond:sreg_64 = V_CMP_LE_U32_e64 %op0, 5, implicit $exec
     S_NOP 0
 ...



More information about the llvm-commits mailing list