[llvm] [ARM] Replace manual CLS expansion with ISD::CTLS (PR #178430)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 15 21:44:38 PST 2026
================
@@ -64,7 +64,7 @@ define i32 @cls64(i64 %t) {
; CHECKV5-LABEL: cls64:
; CHECKV5: @ %bb.0:
; CHECKV5-NEXT: cmp r1, #0
-; CHECKV5-NEXT: mvnne r0, r0
+; CHECKV5-NEXT: mvnmi r0, r0
----------------
topperc wrote:
The original code used != 0 to conditionally negate the lower bits. The new expansion check if the value is negative. These are equivalent in this case since we only use the result for the lower bits when the high is all 0s or all 1s. So the only != 0 value in that case is all 1s.
https://github.com/llvm/llvm-project/pull/178430
More information about the llvm-commits
mailing list