[llvm] [AMDGPU] Remove unnecessary add instructions in ctlz.i8 (PR #77615)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 15 07:33:12 PST 2024


================
@@ -329,10 +329,10 @@ define amdgpu_kernel void @s_ctlz_zero_undef_i8_with_select(ptr addrspace(1) noa
 ; VI-NEXT:    s_waitcnt lgkmcnt(0)
 ; VI-NEXT:    s_and_b32 s2, s2, 0xff
 ; VI-NEXT:    s_flbit_i32_b32 s2, s2
-; VI-NEXT:    s_add_i32 s2, s2, -16
+; VI-NEXT:    s_sub_i32 s2, s2, 24
----------------
jayfoad wrote:

Nit: it would be better overall to replace the AND with a left shift by 24. Then you would not need the SUB.

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


More information about the llvm-commits mailing list