[llvm] [AMDGPU] Remove redundant s_cmp_lg_* sX, 0 (PR #162352)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 15 07:33:32 PDT 2025


================
@@ -180,11 +180,7 @@ define amdgpu_ps %struct.uint96 @s_add64_32(i64 inreg %val64A, i64 inreg %val64B
 ; CHECK-LABEL: s_add64_32:
 ; CHECK:       ; %bb.0:
 ; CHECK-NEXT:    s_add_u32 s0, s0, s2
-; CHECK-NEXT:    s_cselect_b64 s[6:7], -1, 0
-; CHECK-NEXT:    s_cmp_lg_u64 s[6:7], 0
----------------
LU-JOHN wrote:

Our lowering for carryout puts it into a virtual 32/64-bit SGPR.  SCC is reconstructed from the virtual 32/64-bit SGPR as needed by users of the carryout.  If we lowered directly into SCC we could have problems with other definitions of SCC clobbering the carryout.    We could/did somewhat avoid this problem by lowering 64-bit adds as a unit.  The internal carryout for the low 32-bit part could be generated cleanly, but the carryout for the high 32-bits was a problem.   Note that issue https://github.com/llvm/llvm-project/issues/152992 asked for good code for 64-bit carryout.

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


More information about the llvm-commits mailing list