1
1
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2
2
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
3
- define i1 @test (i32 %0 , i32 %1 ) {
3
+ define i1 @test_pass_et (i32 %0 , i32 %1 ) {
4
4
; CHECK-LABEL: define i1 @test(
5
5
; CHECK-SAME: i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) {
6
6
; CHECK-NEXT: [[COMMON_RET:.*:]]
7
- ; CHECK-NEXT: [[TMP2:%.*]] = xor i32 [[TMP0]], -1
8
- ; CHECK-NEXT: [[TMP3:%.*]] = icmp ule i32 [[TMP1]], [[TMP2]]
9
- ; CHECK-NEXT: [[TMP4:%.*]] = xor i32 [[TMP1]], -1
10
- ; CHECK-NEXT: [[TMP5:%.*]] = icmp ugt i32 [[TMP0]], [[TMP4]]
11
- ; CHECK-NEXT: [[COMMON_RET_OP:%.*]] = and i1 [[TMP3]], [[TMP5]]
12
- ; CHECK-NEXT: ret i1 [[COMMON_RET_OP]]
7
+ ; CHECK-NEXT: ret i1 false
13
8
;
14
9
common .ret:
15
10
%2 = xor i32 %0 , -1
@@ -19,3 +14,78 @@ common.ret:
19
14
%common.ret.op = and i1 %3 , %5
20
15
ret i1 %common.ret.op
21
16
}
17
+
18
+ define i1 @test_pass_signed (i32 %0 , i32 %1 ) {
19
+ ; CHECK-LABEL: define i1 @test(
20
+ ; CHECK-SAME: i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) {
21
+ ; CHECK-NEXT: [[COMMON_RET:.*:]]
22
+ ; CHECK-NEXT: ret i1 false
23
+ ;
24
+ common .ret:
25
+ %2 = xor i32 %0 , -1
26
+ %3 = icmp sle i32 %1 , %2
27
+ %4 = xor i32 %1 , -1
28
+ %5 = icmp sgt i32 %0 , %4
29
+ %common.ret.op = and i1 %3 , %5
30
+ ret i1 %common.ret.op
31
+ }
32
+
33
+ define i1 @test_pass_tt (i32 %0 , i32 %1 ) {
34
+ common .ret:
35
+ %2 = xor i32 %0 , -1
36
+ %3 = icmp ult i32 %1 , %2
37
+ %4 = xor i32 %1 , -1
38
+ %5 = icmp ugt i32 %0 , %4
39
+ %common.ret.op = and i1 %3 , %5
40
+ ret i1 %common.ret.op
41
+ }
42
+
43
+ define i1 @test_pass_te (i32 %0 , i32 %1 ) {
44
+ common .ret:
45
+ %2 = xor i32 %0 , -1
46
+ %3 = icmp ult i32 %1 , %2
47
+ %4 = xor i32 %1 , -1
48
+ %5 = icmp uge i32 %0 , %4
49
+ %common.ret.op = and i1 %3 , %5
50
+ ret i1 %common.ret.op
51
+ }
52
+
53
+ define i1 @test_nopass_ee (i32 %0 , i32 %1 ) {
54
+ common .ret:
55
+ %2 = xor i32 %0 , -1
56
+ %3 = icmp ule i32 %1 , %2
57
+ %4 = xor i32 %1 , -1
58
+ %5 = icmp uge i32 %0 , %4
59
+ %common.ret.op = and i1 %3 , %5
60
+ ret i1 %common.ret.op
61
+ }
62
+
63
+ define i1 @test_no_change_et (i32 %0 , i32 %1 , i32 %2 ) {
64
+ common .ret:
65
+ %3 = xor i32 %0 , -1
66
+ %4 = icmp ule i32 %1 , %3
67
+ %5 = xor i32 %1 , -1
68
+ %6 = icmp ugt i32 %1 , %5
69
+ %common.ret.op = and i1 %6 , %4
70
+ ret i1 %common.ret.op
71
+ }
72
+
73
+ define i1 @test_no_change_te (i32 %0 , i32 %1 , i32 %2 ) {
74
+ common .ret:
75
+ %3 = xor i32 %0 , -1
76
+ %4 = icmp ult i32 %1 , %3
77
+ %5 = xor i32 %1 , -1
78
+ %6 = icmp uge i32 %1 , %5
79
+ %common.ret.op = and i1 %6 , %4
80
+ ret i1 %common.ret.op
81
+ }
82
+
83
+ define i1 @test_no_change_tt (i32 %0 , i32 %1 , i32 %2 ) {
84
+ common .ret:
85
+ %3 = xor i32 %0 , -1
86
+ %4 = icmp ult i32 %1 , %3
87
+ %5 = xor i32 %1 , -1
88
+ %6 = icmp ugt i32 %1 , %5
89
+ %common.ret.op = and i1 %6 , %4
90
+ ret i1 %common.ret.op
91
+ }
0 commit comments