[llvm] b5963ea - ValueTracking: Add base test for isKnownNeverInfinity of sqrt

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 10:03:13 PST 2022


Author: Matt Arsenault
Date: 2022-12-20T13:03:07-05:00
New Revision: b5963ea088c28bce4dfacab4c58b96bc1a867e81

URL: https://github.com/llvm/llvm-project/commit/b5963ea088c28bce4dfacab4c58b96bc1a867e81
DIFF: https://github.com/llvm/llvm-project/commit/b5963ea088c28bce4dfacab4c58b96bc1a867e81.diff

LOG: ValueTracking: Add base test for isKnownNeverInfinity of sqrt

Added: 
    

Modified: 
    llvm/test/Transforms/InstSimplify/floating-point-compare.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
index 019069ae14d1..ea51cab60b93 100644
--- a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
+++ b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
@@ -1816,3 +1816,29 @@ define i1 @isNotKnownNeverInfinity_maximum_rhs(double %x, double %y) {
 }
 
 declare double @llvm.maximum.f64(double, double)
+
+define i1 @isKnownNeverInfinity_sqrt(double %x) {
+; CHECK-LABEL: @isKnownNeverInfinity_sqrt(
+; CHECK-NEXT:    [[A:%.*]] = fadd ninf double [[X:%.*]], 1.000000e+00
+; CHECK-NEXT:    [[E:%.*]] = call double @llvm.sqrt.f64(double [[A]])
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    ret i1 [[R]]
+;
+  %a = fadd ninf double %x, 1.0
+  %e = call double @llvm.sqrt.f64(double %a)
+  %r = fcmp une double %e, 0x7ff0000000000000
+  ret i1 %r
+}
+
+define i1 @isNotKnownNeverInfinity_sqrt(double %x) {
+; CHECK-LABEL: @isNotKnownNeverInfinity_sqrt(
+; CHECK-NEXT:    [[E:%.*]] = call double @llvm.sqrt.f64(double [[X:%.*]])
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    ret i1 [[R]]
+;
+  %e = call double @llvm.sqrt.f64(double %x)
+  %r = fcmp une double %e, 0x7ff0000000000000
+  ret i1 %r
+}
+
+declare double @llvm.sqrt.f64(double)


        


More information about the llvm-commits mailing list