Skip to content

Commit a0b3dba

Browse files
committed
[InstCombine] Regenerate some fcmp tests to use the update_test_checks.py script
1 parent 3cb4f62 commit a0b3dba

File tree

4 files changed

+65
-26
lines changed

4 files changed

+65
-26
lines changed
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
12
; RUN: opt -passes=instcombine -S < %s | FileCheck %s
23
; PR2359
34

4-
; CHECK-LABEL: @f(
5-
; CHECK: ret i1 false
65
define i1 @f(ptr %x) {
6+
; CHECK-LABEL: @f(
7+
; CHECK-NEXT: entry:
8+
; CHECK-NEXT: ret i1 false
9+
;
710
entry:
8-
%tmp462 = load i8, ptr %x, align 1 ; <i8> [#uses=1]
9-
%tmp462463 = sitofp i8 %tmp462 to float ; <float> [#uses=1]
10-
%tmp464 = fcmp ugt float %tmp462463, 0x47EFFFFFE0000000 ; <i1>
11-
ret i1 %tmp464
11+
%tmp462 = load i8, ptr %x, align 1 ; <i8> [#uses=1]
12+
%tmp462463 = sitofp i8 %tmp462 to float ; <float> [#uses=1]
13+
%tmp464 = fcmp ugt float %tmp462463, 0x47EFFFFFE0000000 ; <i1>
14+
ret i1 %tmp464
1215
}
1316

1417

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,74 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
12
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
23
; PR3021
34

45
; When inst combining an FCMP with the LHS coming from a uitofp instruction, we
56
; can't lower it to signed ICMP instructions.
67

7-
; CHECK-LABEL: @test1(
88
define i1 @test1(i32 %val) {
9+
; CHECK-LABEL: @test1(
10+
; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[VAL:%.*]], 0
11+
; CHECK-NEXT: ret i1 [[TMP1]]
12+
;
913
%1 = uitofp i32 %val to double
1014
%2 = fcmp ole double %1, 0.000000e+00
11-
; CHECK: icmp eq i32 %val, 0
1215
ret i1 %2
1316
}
1417

15-
; CHECK-LABEL: @test2(
1618
define i1 @test2(i32 %val) {
19+
; CHECK-LABEL: @test2(
20+
; CHECK-NEXT: ret i1 false
21+
;
1722
%1 = uitofp i32 %val to double
1823
%2 = fcmp olt double %1, 0.000000e+00
1924
ret i1 %2
20-
; CHECK: ret i1 false
2125
}
2226

23-
; CHECK-LABEL: @test3(
2427
define i1 @test3(i32 %val) {
28+
; CHECK-LABEL: @test3(
29+
; CHECK-NEXT: ret i1 true
30+
;
2531
%1 = uitofp i32 %val to double
2632
%2 = fcmp oge double %1, 0.000000e+00
2733
ret i1 %2
28-
; CHECK: ret i1 true
2934
}
3035

31-
; CHECK-LABEL: @test4(
3236
define i1 @test4(i32 %val) {
37+
; CHECK-LABEL: @test4(
38+
; CHECK-NEXT: [[TMP1:%.*]] = icmp ne i32 [[VAL:%.*]], 0
39+
; CHECK-NEXT: ret i1 [[TMP1]]
40+
;
3341
%1 = uitofp i32 %val to double
3442
%2 = fcmp ogt double %1, 0.000000e+00
35-
; CHECK: icmp ne i32 %val, 0
3643
ret i1 %2
3744
}
3845

39-
; CHECK-LABEL: @test5(
4046
define i1 @test5(i32 %val) {
47+
; CHECK-LABEL: @test5(
48+
; CHECK-NEXT: ret i1 true
49+
;
4150
%1 = uitofp i32 %val to double
4251
%2 = fcmp ogt double %1, -4.400000e+00
4352
ret i1 %2
44-
; CHECK: ret i1 true
4553
}
4654

47-
; CHECK-LABEL: @test6(
4855
define i1 @test6(i32 %val) {
56+
; CHECK-LABEL: @test6(
57+
; CHECK-NEXT: ret i1 false
58+
;
4959
%1 = uitofp i32 %val to double
5060
%2 = fcmp olt double %1, -4.400000e+00
5161
ret i1 %2
52-
; CHECK: ret i1 false
5362
}
5463

5564
; Check that optimizing unsigned >= comparisons correctly distinguishes
5665
; positive and negative constants. <rdar://problem/12029145>
57-
; CHECK-LABEL: @test7(
5866
define i1 @test7(i32 %val) {
67+
; CHECK-LABEL: @test7(
68+
; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt i32 [[VAL:%.*]], 3
69+
; CHECK-NEXT: ret i1 [[TMP1]]
70+
;
5971
%1 = uitofp i32 %val to double
6072
%2 = fcmp oge double %1, 3.200000e+00
6173
ret i1 %2
62-
; CHECK: icmp ugt i32 %val, 3
6374
}
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
; RUN: opt < %s -passes=instcombine -S | not grep cmp
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
23
; rdar://6903175
34

45
define i1 @f0(ptr %a) nounwind {
5-
%b = load i32, ptr %a, align 4
6-
%c = uitofp i32 %b to double
7-
%d = fcmp ogt double %c, 0x41EFFFFFFFE00000
8-
ret i1 %d
6+
; CHECK-LABEL: @f0(
7+
; CHECK-NEXT: ret i1 false
8+
;
9+
%b = load i32, ptr %a, align 4
10+
%c = uitofp i32 %b to double
11+
%d = fcmp ogt double %c, 0x41EFFFFFFFE00000
12+
ret i1 %d
913
}

llvm/test/Transforms/InstCombine/2012-02-13-FCmp.ll

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,38 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
12
; RUN: opt -passes=instcombine -S < %s | FileCheck %s
23
; Radar 10803727
34
@.str = private unnamed_addr constant [35 x i8] c"\0Ain_range input (should be 0): %f\0A\00", align 1
45
@.str1 = external hidden unnamed_addr constant [35 x i8], align 1
56

67
declare i32 @printf(ptr, ...)
78
define i64 @_Z8tempCastj(i32 %val) uwtable ssp {
9+
; CHECK-LABEL: @_Z8tempCastj(
10+
; CHECK-NEXT: entry:
11+
; CHECK-NEXT: [[CALL:%.*]] = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str1, i32 [[VAL:%.*]])
12+
; CHECK-NEXT: [[CONV:%.*]] = uitofp i32 [[VAL]] to double
13+
; CHECK-NEXT: [[CALL_I:%.*]] = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double [[CONV]])
14+
; CHECK-NEXT: br i1 true, label [[LAND_RHS_I:%.*]], label [[IF_END_CRITEDGE:%.*]]
15+
; CHECK: land.rhs.i:
16+
; CHECK-NEXT: [[CMP1_I:%.*]] = icmp eq i32 [[VAL]], 0
17+
; CHECK-NEXT: br i1 [[CMP1_I]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
18+
; CHECK: if.then:
19+
; CHECK-NEXT: [[ADD:%.*]] = fadd double [[CONV]], 5.000000e-01
20+
; CHECK-NEXT: [[CONV3:%.*]] = fptosi double [[ADD]] to i64
21+
; CHECK-NEXT: br label [[RETURN:%.*]]
22+
; CHECK: if.end.critedge:
23+
; CHECK-NEXT: br label [[IF_END]]
24+
; CHECK: if.end:
25+
; CHECK-NEXT: br label [[RETURN]]
26+
; CHECK: return:
27+
; CHECK-NEXT: [[RETVAL_0:%.*]] = phi i64 [ [[CONV3]], [[IF_THEN]] ], [ -1, [[IF_END]] ]
28+
; CHECK-NEXT: ret i64 [[RETVAL_0]]
29+
;
830
entry:
931
%call = call i32 (ptr, ...) @printf(ptr @.str1, i32 %val)
1032
%conv = uitofp i32 %val to double
1133
%call.i = call i32 (ptr, ...) @printf(ptr @.str, double %conv)
1234
%cmp.i = fcmp oge double %conv, -1.000000e+00
1335
br i1 %cmp.i, label %land.rhs.i, label %if.end.critedge
14-
; CHECK: br i1 true, label %land.rhs.i, label %if.end.critedge
1536

1637
land.rhs.i: ; preds = %entry
1738
%cmp1.i = fcmp olt double %conv, 1.000000e+00

0 commit comments

Comments
 (0)