[llvm] df5c9fd - [InstCombine] add tests for known bits before FP casts; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri May 8 10:45:31 PDT 2020
Author: Sanjay Patel
Date: 2020-05-08T13:44:32-04:00
New Revision: df5c9fdaacfce40b192350fcff520620dbd45f77
URL: https://github.com/llvm/llvm-project/commit/df5c9fdaacfce40b192350fcff520620dbd45f77
DIFF: https://github.com/llvm/llvm-project/commit/df5c9fdaacfce40b192350fcff520620dbd45f77.diff
LOG: [InstCombine] add tests for known bits before FP casts; NFC
Added:
Modified:
llvm/test/Transforms/InstCombine/sitofp.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/sitofp.ll b/llvm/test/Transforms/InstCombine/sitofp.ll
index 149154723b95..57431b9af1e3 100644
--- a/llvm/test/Transforms/InstCombine/sitofp.ll
+++ b/llvm/test/Transforms/InstCombine/sitofp.ll
@@ -216,3 +216,32 @@ define i55 @test19(i64 %A) {
ret i55 %C
}
+; TODO: The mask guarantees that the input is small enough to eliminate the FP casts.
+
+define i25 @masked_input(i25 %A) {
+; CHECK-LABEL: @masked_input(
+; CHECK-NEXT: [[M:%.*]] = and i25 [[A:%.*]], 65535
+; CHECK-NEXT: [[B:%.*]] = uitofp i25 [[M]] to float
+; CHECK-NEXT: [[C:%.*]] = fptoui float [[B]] to i25
+; CHECK-NEXT: ret i25 [[C]]
+;
+ %m = and i25 %A, 65535
+ %B = uitofp i25 %m to float
+ %C = fptoui float %B to i25
+ ret i25 %C
+}
+
+; TODO: Clear the low bit - guarantees that the input is converted to FP without rounding.
+
+define i25 @low_masked_input(i25 %A) {
+; CHECK-LABEL: @low_masked_input(
+; CHECK-NEXT: [[M:%.*]] = and i25 [[A:%.*]], -2
+; CHECK-NEXT: [[B:%.*]] = uitofp i25 [[M]] to float
+; CHECK-NEXT: [[C:%.*]] = fptoui float [[B]] to i25
+; CHECK-NEXT: ret i25 [[C]]
+;
+ %m = and i25 %A, -2
+ %B = uitofp i25 %m to float
+ %C = fptoui float %B to i25
+ ret i25 %C
+}
More information about the llvm-commits
mailing list