[llvm] 0243b42 - [InstSimplify] add tests for FP infinity compare with fpext; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 2 08:32:22 PDT 2022
Author: Sanjay Patel
Date: 2022-10-02T11:20:23-04:00
New Revision: 0243b424d7761659e0bae030f97be13172cfa114
URL: https://github.com/llvm/llvm-project/commit/0243b424d7761659e0bae030f97be13172cfa114
DIFF: https://github.com/llvm/llvm-project/commit/0243b424d7761659e0bae030f97be13172cfa114.diff
LOG: [InstSimplify] add tests for FP infinity compare with fpext; NFC
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 a32717aed2368..3ff39b04b09b2 100644
--- a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
+++ b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
@@ -1246,3 +1246,29 @@ define i1 @isNotKnownNeverNegativeInfinity_sitofp(i17 %x) {
%r = fcmp oeq half %f, 0xHfc00
ret i1 %r
}
+
+define i1 @isKnownNeverInfinity_fpext(float %x) {
+; CHECK-LABEL: @isKnownNeverInfinity_fpext(
+; CHECK-NEXT: [[A:%.*]] = fadd ninf float [[X:%.*]], 1.000000e+00
+; CHECK-NEXT: [[E:%.*]] = fpext float [[A]] to double
+; CHECK-NEXT: [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %a = fadd ninf float %x, 1.0
+ %e = fpext float %a to double
+ %r = fcmp une double %e, 0x7ff0000000000000
+ ret i1 %r
+}
+
+define i1 @isKnownNeverInfinity_fpext_sitofp(i16 %x) {
+; CHECK-LABEL: @isKnownNeverInfinity_fpext_sitofp(
+; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[X:%.*]] to half
+; CHECK-NEXT: [[E:%.*]] = fpext half [[F]] to double
+; CHECK-NEXT: [[R:%.*]] = fcmp oeq double [[E]], 0xFFF0000000000000
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %f = sitofp i16 %x to half
+ %e = fpext half %f to double
+ %r = fcmp oeq double %e, 0xfff0000000000000
+ ret i1 %r
+}
More information about the llvm-commits
mailing list