llvm.org GIT mirror llvm / f5782e2
FileCheckize git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155010 91177308-0d34-0410-b5e6-96231b3b80d8 Jakob Stoklund Olesen 7 years ago
1 changed file(s) with 60 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
0 ; This test makes sure that shift instructions are properly eliminated
11 ; even with arbitrary precision integers.
2 ; RUN: opt < %s -instcombine -S | not grep sh
3 ; END.
4
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
3
4 ; CHECK: @test1
5 ; CHECK-NOT: sh
56 define i47 @test1(i47 %A) {
67 %B = shl i47 %A, 0 ; [#uses=1]
78 ret i47 %B
89 }
910
11 ; CHECK: @test2
12 ; CHECK-NOT: sh
1013 define i41 @test2(i7 %X) {
1114 %A = zext i7 %X to i41 ; [#uses=1]
1215 %B = shl i41 0, %A ; [#uses=1]
1316 ret i41 %B
1417 }
1518
19 ; CHECK: @test3
20 ; CHECK-NOT: sh
1621 define i41 @test3(i41 %A) {
1722 %B = ashr i41 %A, 0 ; [#uses=1]
1823 ret i41 %B
1924 }
2025
26 ; CHECK: @test4
27 ; CHECK-NOT: sh
2128 define i39 @test4(i7 %X) {
2229 %A = zext i7 %X to i39 ; [#uses=1]
2330 %B = ashr i39 0, %A ; [#uses=1]
2431 ret i39 %B
2532 }
2633
34 ; CHECK: @test5
35 ; CHECK-NOT: sh
2736 define i55 @test5(i55 %A) {
2837 %B = lshr i55 %A, 55 ; [#uses=1]
2938 ret i55 %B
3039 }
3140
41 ; CHECK: @test5a
42 ; CHECK-NOT: sh
3243 define i32 @test5a(i32 %A) {
3344 %B = shl i32 %A, 32 ; [#uses=1]
3445 ret i32 %B
3546 }
3647
48 ; CHECK: @test6
49 ; CHECK-NOT: sh
3750 define i55 @test6(i55 %A) {
3851 %B = shl i55 %A, 1 ; [#uses=1]
3952 %C = mul i55 %B, 3 ; [#uses=1]
4053 ret i55 %C
4154 }
4255
56 ; CHECK: @test7
57 ; CHECK-NOT: sh
4358 define i29 @test7(i8 %X) {
4459 %A = zext i8 %X to i29 ; [#uses=1]
4560 %B = ashr i29 -1, %A ; [#uses=1]
4661 ret i29 %B
4762 }
4863
64 ; CHECK: @test8
65 ; CHECK-NOT: sh
4966 define i7 @test8(i7 %A) {
5067 %B = shl i7 %A, 4 ; [#uses=1]
5168 %C = shl i7 %B, 3 ; [#uses=1]
5269 ret i7 %C
5370 }
5471
72 ; CHECK: @test9
73 ; CHECK-NOT: sh
5574 define i17 @test9(i17 %A) {
5675 %B = shl i17 %A, 16 ; [#uses=1]
5776 %C = lshr i17 %B, 16 ; [#uses=1]
5877 ret i17 %C
5978 }
6079
80 ; CHECK: @test10
81 ; CHECK-NOT: sh
6182 define i19 @test10(i19 %A) {
6283 %B = lshr i19 %A, 18 ; [#uses=1]
6384 %C = shl i19 %B, 18 ; [#uses=1]
6485 ret i19 %C
6586 }
6687
88 ; CHECK: @test11
89 ; CHECK-NOT: sh
6790 define i23 @test11(i23 %A) {
6891 %a = mul i23 %A, 3 ; [#uses=1]
6992 %B = lshr i23 %a, 11 ; [#uses=1]
7194 ret i23 %C
7295 }
7396
97 ; CHECK: @test12
98 ; CHECK-NOT: sh
7499 define i47 @test12(i47 %A) {
75100 %B = ashr i47 %A, 8 ; [#uses=1]
76101 %C = shl i47 %B, 8 ; [#uses=1]
77102 ret i47 %C
78103 }
79104
105 ; CHECK: @test13
106 ; CHECK-NOT: sh
80107 define i18 @test13(i18 %A) {
81108 %a = mul i18 %A, 3 ; [#uses=1]
82109 %B = ashr i18 %a, 8 ; [#uses=1]
84111 ret i18 %C
85112 }
86113
114 ; CHECK: @test14
115 ; CHECK-NOT: sh
87116 define i35 @test14(i35 %A) {
88117 %B = lshr i35 %A, 4 ; [#uses=1]
89118 %C = or i35 %B, 1234 ; [#uses=1]
91120 ret i35 %D
92121 }
93122
123 ; CHECK: @test14a
124 ; CHECK-NOT: sh
94125 define i79 @test14a(i79 %A) {
95126 %B = shl i79 %A, 4 ; [#uses=1]
96127 %C = and i79 %B, 1234 ; [#uses=1]
98129 ret i79 %D
99130 }
100131
132 ; CHECK: @test15
133 ; CHECK-NOT: sh
101134 define i45 @test15(i1 %C) {
102135 %A = select i1 %C, i45 3, i45 1 ; [#uses=1]
103136 %V = shl i45 %A, 2 ; [#uses=1]
104137 ret i45 %V
105138 }
106139
140 ; CHECK: @test15a
141 ; CHECK-NOT: sh
107142 define i53 @test15a(i1 %X) {
108143 %A = select i1 %X, i8 3, i8 1 ; [#uses=1]
109144 %B = zext i8 %A to i53 ; [#uses=1]
111146 ret i53 %V
112147 }
113148
149 ; CHECK: @test16
150 ; CHECK-NOT: sh
114151 define i1 @test16(i84 %X) {
115152 %tmp.3 = ashr i84 %X, 4 ; [#uses=1]
116153 %tmp.6 = and i84 %tmp.3, 1 ; [#uses=1]
118155 ret i1 %tmp.7
119156 }
120157
158 ; CHECK: @test17
159 ; CHECK-NOT: sh
121160 define i1 @test17(i106 %A) {
122161 %B = lshr i106 %A, 3 ; [#uses=1]
123162 %C = icmp eq i106 %B, 1234 ; [#uses=1]
124163 ret i1 %C
125164 }
126165
166 ; CHECK: @test18
167 ; CHECK-NOT: sh
127168 define i1 @test18(i11 %A) {
128169 %B = lshr i11 %A, 10 ; [#uses=1]
129170 %C = icmp eq i11 %B, 123 ; [#uses=1]
130171 ret i1 %C
131172 }
132173
174 ; CHECK: @test19
175 ; CHECK-NOT: sh
133176 define i1 @test19(i37 %A) {
134177 %B = ashr i37 %A, 2 ; [#uses=1]
135178 %C = icmp eq i37 %B, 0 ; [#uses=1]
136179 ret i1 %C
137180 }
138181
182 ; CHECK: @test19a
183 ; CHECK-NOT: sh
139184 define i1 @test19a(i39 %A) {
140185 %B = ashr i39 %A, 2 ; [#uses=1]
141186 %C = icmp eq i39 %B, -1 ; [#uses=1]
142187 ret i1 %C
143188 }
144189
190 ; CHECK: @test20
191 ; CHECK-NOT: sh
145192 define i1 @test20(i13 %A) {
146193 %B = ashr i13 %A, 12 ; [#uses=1]
147194 %C = icmp eq i13 %B, 123 ; [#uses=1]
148195 ret i1 %C
149196 }
150197
198 ; CHECK: @test21
199 ; CHECK-NOT: sh
151200 define i1 @test21(i12 %A) {
152201 %B = shl i12 %A, 6 ; [#uses=1]
153202 %C = icmp eq i12 %B, -128 ; [#uses=1]
154203 ret i1 %C
155204 }
156205
206 ; CHECK: @test22
207 ; CHECK-NOT: sh
157208 define i1 @test22(i14 %A) {
158209 %B = shl i14 %A, 7 ; [#uses=1]
159210 %C = icmp eq i14 %B, 0 ; [#uses=1]
160211 ret i1 %C
161212 }
162213
214 ; CHECK: @test23
215 ; CHECK-NOT: sh
163216 define i11 @test23(i44 %A) {
164217 %B = shl i44 %A, 33 ; [#uses=1]
165218 %C = ashr i44 %B, 33 ; [#uses=1]
167220 ret i11 %D
168221 }
169222
223 ; CHECK: @test25
224 ; CHECK-NOT: sh
170225 define i37 @test25(i37 %tmp.2, i37 %AA) {
171226 %x = lshr i37 %AA, 17 ; [#uses=1]
172227 %tmp.3 = lshr i37 %tmp.2, 17 ; [#uses=1]
175230 ret i37 %tmp.6
176231 }
177232
233 ; CHECK: @test26
234 ; CHECK-NOT: sh
178235 define i40 @test26(i40 %A) {
179236 %B = lshr i40 %A, 1 ; [#uses=1]
180237 %C = bitcast i40 %B to i40 ; [#uses=1]