[llvm] [DAG] Fold (umin (sub a b) a) -> (usubo a b); (select usubo.1 a usubo.0) (PR #161651)

Chaitanya Koparkar via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 10 05:27:24 PST 2025


================
@@ -26,16 +26,16 @@ define i32 @v_underflow_compare_fold_i32(i32 %a, i32 %b) #0 {
 ; GFX9-LABEL: v_underflow_compare_fold_i32:
 ; GFX9:       ; %bb.0:
 ; GFX9-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
-; GFX9-NEXT:    v_sub_u32_e32 v1, v0, v1
-; GFX9-NEXT:    v_min_u32_e32 v0, v1, v0
+; GFX9-NEXT:    v_sub_co_u32_e32 v1, vcc, v0, v1
----------------
ckoparkar wrote:

> for AMDGPU I expect this to be profitable for i64 but not i32

@arsenm I see the exact opposite happening here. Only the `i32` cases are being folded. Any suggestions on what I should do here?

https://github.com/llvm/llvm-project/pull/161651


More information about the llvm-commits mailing list