[llvm] 938b920 - [InstCombine] Add more tests for transforming `(binop (uitofp), -C)`; NFC
Noah Goldstein via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 9 09:06:40 PST 2024
Author: Noah Goldstein
Date: 2024-03-09T11:05:54-06:00
New Revision: 938b9204684222d192a3f817da0c33076ed813e2
URL: https://github.com/llvm/llvm-project/commit/938b9204684222d192a3f817da0c33076ed813e2
DIFF: https://github.com/llvm/llvm-project/commit/938b9204684222d192a3f817da0c33076ed813e2.diff
LOG: [InstCombine] Add more tests for transforming `(binop (uitofp), -C)`; NFC
Added:
Modified:
llvm/test/Transforms/InstCombine/binop-itofp.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/binop-itofp.ll b/llvm/test/Transforms/InstCombine/binop-itofp.ll
index ffa89374579145..c91cef717afb08 100644
--- a/llvm/test/Transforms/InstCombine/binop-itofp.ll
+++ b/llvm/test/Transforms/InstCombine/binop-itofp.ll
@@ -996,3 +996,16 @@ define half @test_ui_si_i12_mul_nsw(i12 noundef %x_in, i12 noundef %y_in) {
%r = fmul half %xf, %yf
ret half %r
}
+
+define float @test_ui_add_with_signed_constant(i32 %shr.i) {
+; CHECK-LABEL: @test_ui_add_with_signed_constant(
+; CHECK-NEXT: [[AND_I:%.*]] = and i32 [[SHR_I:%.*]], 32767
+; CHECK-NEXT: [[SUB:%.*]] = uitofp i32 [[AND_I]] to float
+; CHECK-NEXT: [[ADD:%.*]] = fadd float [[SUB]], -1.638300e+04
+; CHECK-NEXT: ret float [[ADD]]
+;
+ %and.i = and i32 %shr.i, 32767
+ %sub = uitofp i32 %and.i to float
+ %add = fadd float %sub, -16383.0
+ ret float %add
+}
More information about the llvm-commits
mailing list