and.ll
3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -correlated-propagation -S | FileCheck %s
define i32 @test(i32 %a) {
; CHECK-LABEL: @test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 128
; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
; CHECK: continue:
; CHECK-NEXT: ret i32 [[A]]
; CHECK: exit:
; CHECK-NEXT: ret i32 -1
;
entry:
%cmp = icmp ult i32 %a, 128
br i1 %cmp, label %continue, label %exit
continue:
%and = and i32 %a, 255
ret i32 %and
exit:
ret i32 -1
}
define i32 @test2(i32 %a) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 256
; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
; CHECK: continue:
; CHECK-NEXT: ret i32 [[A]]
; CHECK: exit:
; CHECK-NEXT: ret i32 -1
;
entry:
%cmp = icmp ult i32 %a, 256
br i1 %cmp, label %continue, label %exit
continue:
%and = and i32 %a, 255
ret i32 %and
exit:
ret i32 -1
}
define i32 @test3(i32 %a) {
; CHECK-LABEL: @test3(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 256
; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
; CHECK: continue:
; CHECK-NEXT: ret i32 [[A]]
; CHECK: exit:
; CHECK-NEXT: ret i32 -1
;
entry:
%cmp = icmp ult i32 %a, 256
br i1 %cmp, label %continue, label %exit
continue:
%and = and i32 %a, 1023
ret i32 %and
exit:
ret i32 -1
}
define i32 @neg1(i32 %a) {
; CHECK-LABEL: @neg1(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i32 [[A:%.*]], 256
; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
; CHECK: continue:
; CHECK-NEXT: [[AND:%.*]] = and i32 [[A]], 255
; CHECK-NEXT: ret i32 [[AND]]
; CHECK: exit:
; CHECK-NEXT: ret i32 -1
;
entry:
%cmp = icmp ule i32 %a, 256
br i1 %cmp, label %continue, label %exit
continue:
%and = and i32 %a, 255
ret i32 %and
exit:
ret i32 -1
}
define i32 @neg2(i32 %a) {
; CHECK-LABEL: @neg2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 513
; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
; CHECK: continue:
; CHECK-NEXT: [[AND:%.*]] = and i32 [[A]], 255
; CHECK-NEXT: ret i32 [[AND]]
; CHECK: exit:
; CHECK-NEXT: ret i32 -1
;
entry:
%cmp = icmp ult i32 %a, 513
br i1 %cmp, label %continue, label %exit
continue:
%and = and i32 %a, 255
ret i32 %and
exit:
ret i32 -1
}
define i32 @neg3(i32 %a) {
; CHECK-LABEL: @neg3(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 256
; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
; CHECK: continue:
; CHECK-NEXT: [[AND:%.*]] = and i32 [[A]], 254
; CHECK-NEXT: ret i32 [[AND]]
; CHECK: exit:
; CHECK-NEXT: ret i32 -1
;
entry:
%cmp = icmp ult i32 %a, 256
br i1 %cmp, label %continue, label %exit
continue:
%and = and i32 %a, 254
ret i32 %and
exit:
ret i32 -1
}