Skip to content

Commit 938b920

Browse files
committed
[InstCombine] Add more tests for transforming (binop (uitofp), -C); NFC
1 parent e19e860 commit 938b920

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

llvm/test/Transforms/InstCombine/binop-itofp.ll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,3 +996,16 @@ define half @test_ui_si_i12_mul_nsw(i12 noundef %x_in, i12 noundef %y_in) {
996996
%r = fmul half %xf, %yf
997997
ret half %r
998998
}
999+
1000+
define float @test_ui_add_with_signed_constant(i32 %shr.i) {
1001+
; CHECK-LABEL: @test_ui_add_with_signed_constant(
1002+
; CHECK-NEXT: [[AND_I:%.*]] = and i32 [[SHR_I:%.*]], 32767
1003+
; CHECK-NEXT: [[SUB:%.*]] = uitofp i32 [[AND_I]] to float
1004+
; CHECK-NEXT: [[ADD:%.*]] = fadd float [[SUB]], -1.638300e+04
1005+
; CHECK-NEXT: ret float [[ADD]]
1006+
;
1007+
%and.i = and i32 %shr.i, 32767
1008+
%sub = uitofp i32 %and.i to float
1009+
%add = fadd float %sub, -16383.0
1010+
ret float %add
1011+
}

0 commit comments

Comments
 (0)