llvm.org GIT mirror llvm / 39cd9cb
[EarlyCSE] regenerate test checks; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358407 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 5 months ago
1 changed file(s) with 58 addition(s) and 57 deletion(s). Raw diff Collapse all Expand all
0 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1 ; RUN: opt < %s -S -early-cse | FileCheck %s
12 ; RUN: opt < %s -S -basicaa -early-cse-memssa | FileCheck %s
23
34 define void @test1(float %A, float %B, float* %PA, float* %PB) {
45 ; CHECK-LABEL: @test1(
5 ; CHECK-NEXT: [[C:%.*]] = fadd float %A, %B
6 ; CHECK-NEXT: store float [[C]], float* %PA
7 ; CHECK-NEXT: store float [[C]], float* %PB
6 ; CHECK-NEXT: [[C:%.*]] = fadd float [[A:%.*]], [[B:%.*]]
7 ; CHECK-NEXT: store float [[C]], float* [[PA:%.*]]
8 ; CHECK-NEXT: store float [[C]], float* [[PB:%.*]]
89 ; CHECK-NEXT: ret void
910 ;
1011 %C = fadd float %A, %B
1617
1718 define void @test2(float %A, float %B, i1* %PA, i1* %PB) {
1819 ; CHECK-LABEL: @test2(
19 ; CHECK-NEXT: [[C:%.*]] = fcmp oeq float %A, %B
20 ; CHECK-NEXT: store i1 [[C]], i1* %PA
21 ; CHECK-NEXT: store i1 [[C]], i1* %PB
20 ; CHECK-NEXT: [[C:%.*]] = fcmp oeq float [[A:%.*]], [[B:%.*]]
21 ; CHECK-NEXT: store i1 [[C]], i1* [[PA:%.*]]
22 ; CHECK-NEXT: store i1 [[C]], i1* [[PB:%.*]]
2223 ; CHECK-NEXT: ret void
2324 ;
2425 %C = fcmp oeq float %A, %B
3031
3132 define void @test3(float %A, float %B, i1* %PA, i1* %PB) {
3233 ; CHECK-LABEL: @test3(
33 ; CHECK-NEXT: [[C:%.*]] = fcmp uge float %A, %B
34 ; CHECK-NEXT: store i1 [[C]], i1* %PA
35 ; CHECK-NEXT: store i1 [[C]], i1* %PB
34 ; CHECK-NEXT: [[C:%.*]] = fcmp uge float [[A:%.*]], [[B:%.*]]
35 ; CHECK-NEXT: store i1 [[C]], i1* [[PA:%.*]]
36 ; CHECK-NEXT: store i1 [[C]], i1* [[PB:%.*]]
3637 ; CHECK-NEXT: ret void
3738 ;
3839 %C = fcmp uge float %A, %B
4445
4546 define void @test4(i32 %A, i32 %B, i1* %PA, i1* %PB) {
4647 ; CHECK-LABEL: @test4(
47 ; CHECK-NEXT: [[C:%.*]] = icmp eq i32 %A, %B
48 ; CHECK-NEXT: store i1 [[C]], i1* %PA
49 ; CHECK-NEXT: store i1 [[C]], i1* %PB
48 ; CHECK-NEXT: [[C:%.*]] = icmp eq i32 [[A:%.*]], [[B:%.*]]
49 ; CHECK-NEXT: store i1 [[C]], i1* [[PA:%.*]]
50 ; CHECK-NEXT: store i1 [[C]], i1* [[PB:%.*]]
5051 ; CHECK-NEXT: ret void
5152 ;
5253 %C = icmp eq i32 %A, %B
5859
5960 define void @test5(i32 %A, i32 %B, i1* %PA, i1* %PB) {
6061 ; CHECK-LABEL: @test5(
61 ; CHECK-NEXT: [[C:%.*]] = icmp sgt i32 %A, %B
62 ; CHECK-NEXT: store i1 [[C]], i1* %PA
63 ; CHECK-NEXT: store i1 [[C]], i1* %PB
62 ; CHECK-NEXT: [[C:%.*]] = icmp sgt i32 [[A:%.*]], [[B:%.*]]
63 ; CHECK-NEXT: store i1 [[C]], i1* [[PA:%.*]]
64 ; CHECK-NEXT: store i1 [[C]], i1* [[PB:%.*]]
6465 ; CHECK-NEXT: ret void
6566 ;
6667 %C = icmp sgt i32 %A, %B
7475
7576 define i8 @smin_commute(i8 %a, i8 %b) {
7677 ; CHECK-LABEL: @smin_commute(
77 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 %a, %b
78 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 %b, %a
79 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 %a, i8 %b
78 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 [[A:%.*]], [[B:%.*]]
79 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 [[B]], [[A]]
80 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[A]], i8 [[B]]
8081 ; CHECK-NEXT: [[R:%.*]] = mul i8 [[M1]], [[M1]]
8182 ; CHECK-NEXT: ret i8 [[R]]
8283 ;
9293
9394 define i1 @smin_swapped(i8 %a, i8 %b) {
9495 ; CHECK-LABEL: @smin_swapped(
95 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 %a, %b
96 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 %a, %b
97 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 %b, i8 %a
96 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 [[A:%.*]], [[B:%.*]]
97 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 [[A]], [[B]]
98 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[B]], i8 [[A]]
9899 ; CHECK-NEXT: ret i1 true
99100 ;
100101 %cmp1 = icmp sgt i8 %a, %b
107108
108109 define i8 @smax_commute(i8 %a, i8 %b) {
109110 ; CHECK-LABEL: @smax_commute(
110 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 %a, %b
111 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 %b, %a
112 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 %a, i8 %b
111 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 [[A:%.*]], [[B:%.*]]
112 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 [[B]], [[A]]
113 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[A]], i8 [[B]]
113114 ; CHECK-NEXT: ret i8 0
114115 ;
115116 %cmp1 = icmp sgt i8 %a, %b
122123
123124 define i8 @smax_swapped(i8 %a, i8 %b) {
124125 ; CHECK-LABEL: @smax_swapped(
125 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 %a, %b
126 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 %a, %b
127 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 %b, i8 %a
126 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 [[A:%.*]], [[B:%.*]]
127 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 [[A]], [[B]]
128 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[B]], i8 [[A]]
128129 ; CHECK-NEXT: ret i8 1
129130 ;
130131 %cmp1 = icmp slt i8 %a, %b
137138
138139 define i8 @umin_commute(i8 %a, i8 %b) {
139140 ; CHECK-LABEL: @umin_commute(
140 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i8 %a, %b
141 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i8 %b, %a
142 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 %a, i8 %b
141 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i8 [[A:%.*]], [[B:%.*]]
142 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i8 [[B]], [[A]]
143 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[A]], i8 [[B]]
143144 ; CHECK-NEXT: ret i8 0
144145 ;
145146 %cmp1 = icmp ult i8 %a, %b
154155
155156 define <2 x i8> @umin_swapped(<2 x i8> %a, <2 x i8> %b) {
156157 ; CHECK-LABEL: @umin_swapped(
157 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt <2 x i8> %a, %b
158 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult <2 x i8> %a, %b
159 ; CHECK-NEXT: [[M1:%.*]] = select <2 x i1> [[CMP1]], <2 x i8> %b, <2 x i8> %a
158 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt <2 x i8> [[A:%.*]], [[B:%.*]]
159 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult <2 x i8> [[A]], [[B]]
160 ; CHECK-NEXT: [[M1:%.*]] = select <2 x i1> [[CMP1]], <2 x i8> [[B]], <2 x i8> [[A]]
160161 ; CHECK-NEXT: ret <2 x i8> zeroinitializer
161162 ;
162163 %cmp1 = icmp ugt <2 x i8> %a, %b
169170
170171 define i8 @umax_commute(i8 %a, i8 %b) {
171172 ; CHECK-LABEL: @umax_commute(
172 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt i8 %a, %b
173 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i8 %b, %a
174 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 %a, i8 %b
173 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt i8 [[A:%.*]], [[B:%.*]]
174 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i8 [[B]], [[A]]
175 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[A]], i8 [[B]]
175176 ; CHECK-NEXT: ret i8 1
176177 ;
177178 %cmp1 = icmp ugt i8 %a, %b
184185
185186 define i8 @umax_swapped(i8 %a, i8 %b) {
186187 ; CHECK-LABEL: @umax_swapped(
187 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i8 %a, %b
188 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i8 %a, %b
189 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 %b, i8 %a
188 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i8 [[A:%.*]], [[B:%.*]]
189 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i8 [[A]], [[B]]
190 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[B]], i8 [[A]]
190191 ; CHECK-NEXT: [[R:%.*]] = add i8 [[M1]], [[M1]]
191192 ; CHECK-NEXT: ret i8 [[R]]
192193 ;
202203
203204 define i8 @smax_nsw(i8 %a, i8 %b) {
204205 ; CHECK-LABEL: @smax_nsw(
205 ; CHECK-NEXT: [[SUB:%.*]] = sub nsw i8 %a, %b
206 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 %a, %b
206 ; CHECK-NEXT: [[SUB:%.*]] = sub nsw i8 [[A:%.*]], [[B:%.*]]
207 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 [[A]], [[B]]
207208 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 [[SUB]], 0
208209 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 0, i8 [[SUB]]
209210 ; CHECK-NEXT: ret i8 0
219220
220221 define i8 @abs_swapped(i8 %a) {
221222 ; CHECK-LABEL: @abs_swapped(
222 ; CHECK-NEXT: [[NEG:%.*]] = sub i8 0, %a
223 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 %a, 0
224 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 %a, 0
225 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 %a, i8 [[NEG]]
223 ; CHECK-NEXT: [[NEG:%.*]] = sub i8 0, [[A:%.*]]
224 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 [[A]], 0
225 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 [[A]], 0
226 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[A]], i8 [[NEG]]
226227 ; CHECK-NEXT: ret i8 [[M1]]
227228 ;
228229 %neg = sub i8 0, %a
236237
237238 define i8 @nabs_swapped(i8 %a) {
238239 ; CHECK-LABEL: @nabs_swapped(
239 ; CHECK-NEXT: [[NEG:%.*]] = sub i8 0, %a
240 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 %a, 0
241 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 %a, 0
242 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 %a, i8 [[NEG]]
240 ; CHECK-NEXT: [[NEG:%.*]] = sub i8 0, [[A:%.*]]
241 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 [[A]], 0
242 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 [[A]], 0
243 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[A]], i8 [[NEG]]
243244 ; CHECK-NEXT: ret i8 0
244245 ;
245246 %neg = sub i8 0, %a
255256 ; compares are different.
256257 define i8 @abs_different_constants(i8 %a) {
257258 ; CHECK-LABEL: @abs_different_constants(
258 ; CHECK-NEXT: [[NEG:%.*]] = sub i8 0, %a
259 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 %a, -1
260 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 %a, 0
261 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 %a, i8 [[NEG]]
259 ; CHECK-NEXT: [[NEG:%.*]] = sub i8 0, [[A:%.*]]
260 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 [[A]], -1
261 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 [[A]], 0
262 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[A]], i8 [[NEG]]
262263 ; CHECK-NEXT: ret i8 [[M1]]
263264 ;
264265 %neg = sub i8 0, %a
272273
273274 define i8 @nabs_different_constants(i8 %a) {
274275 ; CHECK-LABEL: @nabs_different_constants(
275 ; CHECK-NEXT: [[NEG:%.*]] = sub i8 0, %a
276 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 %a, 0
277 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 %a, -1
278 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 %a, i8 [[NEG]]
276 ; CHECK-NEXT: [[NEG:%.*]] = sub i8 0, [[A:%.*]]
277 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 [[A]], 0
278 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 [[A]], -1
279 ; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[A]], i8 [[NEG]]
279280 ; CHECK-NEXT: ret i8 0
280281 ;
281282 %neg = sub i8 0, %a