[llvm] [SelectionDAG]: Deduce known bits from SMIN and SMAX (PR #85722)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 21 01:47:50 PDT 2024


================
@@ -267,18 +267,31 @@ define i32 @smin_known_nonzero(i32 %xx, i32 %yy) {
   ret i32 %r
 }
 
+define i32 @smin_known_zero_2(i32 %x, i32 %y) {
+; CHECK-LABEL: smin_known_zero_2:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    cmpl $-54, %edi
+; CHECK-NEXT:    movl $-54, %eax
+; CHECK-NEXT:    cmovll %edi, %eax
+; CHECK-NEXT:    rep bsfl %eax, %eax
+; CHECK-NEXT:    retq
+  %z = call i32 @llvm.smin.i32(i32 %x, i32 -54)
+  %r = call i32 @llvm.cttz.i32(i32 %z, i1 false)
+  ret i32 %r
+}
+
----------------
arsenm wrote:

Test vector cases 

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


More information about the llvm-commits mailing list