1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s | FileCheck %s
3 target triple = "powerpc64le-linux-gnu"
5 define i8 @test000(i8 %a, i8 %b) {
6 ; CHECK-LABEL: test000:
8 ; CHECK-NEXT: rlwinm 4, 4, 0, 29, 31
9 ; CHECK-NEXT: slw 3, 3, 4
12 %shl = shl i8 %a, %rem
16 define i16 @test001(i16 %a, i16 %b) {
17 ; CHECK-LABEL: test001:
19 ; CHECK-NEXT: rlwinm 4, 4, 0, 28, 31
20 ; CHECK-NEXT: slw 3, 3, 4
23 %shl = shl i16 %a, %rem
27 define i32 @test002(i32 %a, i32 %b) {
28 ; CHECK-LABEL: test002:
30 ; CHECK-NEXT: rlwinm 4, 4, 0, 27, 31
31 ; CHECK-NEXT: slw 3, 3, 4
34 %shl = shl i32 %a, %rem
38 define i64 @test003(i64 %a, i64 %b) {
39 ; CHECK-LABEL: test003:
41 ; CHECK-NEXT: rlwinm 4, 4, 0, 26, 31
42 ; CHECK-NEXT: sld 3, 3, 4
45 %shl = shl i64 %a, %rem
49 define <16 x i8> @test010(<16 x i8> %a, <16 x i8> %b) {
50 ; CHECK-LABEL: test010:
52 ; CHECK-NEXT: vslb 2, 2, 3
54 %rem = and <16 x i8> %b, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
55 %shl = shl <16 x i8> %a, %rem
59 define <8 x i16> @test011(<8 x i16> %a, <8 x i16> %b) {
60 ; CHECK-LABEL: test011:
62 ; CHECK-NEXT: vslh 2, 2, 3
64 %rem = and <8 x i16> %b, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
65 %shl = shl <8 x i16> %a, %rem
69 define <4 x i32> @test012(<4 x i32> %a, <4 x i32> %b) {
70 ; CHECK-LABEL: test012:
72 ; CHECK-NEXT: vslw 2, 2, 3
74 %rem = and <4 x i32> %b, <i32 31, i32 31, i32 31, i32 31>
75 %shl = shl <4 x i32> %a, %rem
79 define <2 x i64> @test013(<2 x i64> %a, <2 x i64> %b) {
80 ; CHECK-LABEL: test013:
82 ; CHECK-NEXT: vsld 2, 2, 3
84 %rem = and <2 x i64> %b, <i64 63, i64 63>
85 %shl = shl <2 x i64> %a, %rem
89 define i8 @test100(i8 %a, i8 %b) {
90 ; CHECK-LABEL: test100:
92 ; CHECK-NEXT: rlwinm 3, 3, 0, 24, 31
93 ; CHECK-NEXT: rlwinm 4, 4, 0, 29, 31
94 ; CHECK-NEXT: srw 3, 3, 4
97 %lshr = lshr i8 %a, %rem
101 define i16 @test101(i16 %a, i16 %b) {
102 ; CHECK-LABEL: test101:
104 ; CHECK-NEXT: rlwinm 3, 3, 0, 16, 31
105 ; CHECK-NEXT: rlwinm 4, 4, 0, 28, 31
106 ; CHECK-NEXT: srw 3, 3, 4
108 %rem = and i16 %b, 15
109 %lshr = lshr i16 %a, %rem
113 define i32 @test102(i32 %a, i32 %b) {
114 ; CHECK-LABEL: test102:
116 ; CHECK-NEXT: rlwinm 4, 4, 0, 27, 31
117 ; CHECK-NEXT: srw 3, 3, 4
119 %rem = and i32 %b, 31
120 %lshr = lshr i32 %a, %rem
124 define i64 @test103(i64 %a, i64 %b) {
125 ; CHECK-LABEL: test103:
127 ; CHECK-NEXT: rlwinm 4, 4, 0, 26, 31
128 ; CHECK-NEXT: srd 3, 3, 4
130 %rem = and i64 %b, 63
131 %lshr = lshr i64 %a, %rem
135 define <16 x i8> @test110(<16 x i8> %a, <16 x i8> %b) {
136 ; CHECK-LABEL: test110:
138 ; CHECK-NEXT: vsrb 2, 2, 3
140 %rem = and <16 x i8> %b, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
141 %lshr = lshr <16 x i8> %a, %rem
145 define <8 x i16> @test111(<8 x i16> %a, <8 x i16> %b) {
146 ; CHECK-LABEL: test111:
148 ; CHECK-NEXT: vsrh 2, 2, 3
150 %rem = and <8 x i16> %b, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
151 %lshr = lshr <8 x i16> %a, %rem
155 define <4 x i32> @test112(<4 x i32> %a, <4 x i32> %b) {
156 ; CHECK-LABEL: test112:
158 ; CHECK-NEXT: vsrw 2, 2, 3
160 %rem = and <4 x i32> %b, <i32 31, i32 31, i32 31, i32 31>
161 %lshr = lshr <4 x i32> %a, %rem
165 define <2 x i64> @test113(<2 x i64> %a, <2 x i64> %b) {
166 ; CHECK-LABEL: test113:
168 ; CHECK-NEXT: vsrd 2, 2, 3
170 %rem = and <2 x i64> %b, <i64 63, i64 63>
171 %lshr = lshr <2 x i64> %a, %rem
175 define i8 @test200(i8 %a, i8 %b) {
176 ; CHECK-LABEL: test200:
178 ; CHECK-NEXT: extsb 3, 3
179 ; CHECK-NEXT: rlwinm 4, 4, 0, 29, 31
180 ; CHECK-NEXT: sraw 3, 3, 4
183 %ashr = ashr i8 %a, %rem
187 define i16 @test201(i16 %a, i16 %b) {
188 ; CHECK-LABEL: test201:
190 ; CHECK-NEXT: extsh 3, 3
191 ; CHECK-NEXT: rlwinm 4, 4, 0, 28, 31
192 ; CHECK-NEXT: sraw 3, 3, 4
194 %rem = and i16 %b, 15
195 %ashr = ashr i16 %a, %rem
199 define i32 @test202(i32 %a, i32 %b) {
200 ; CHECK-LABEL: test202:
202 ; CHECK-NEXT: rlwinm 4, 4, 0, 27, 31
203 ; CHECK-NEXT: sraw 3, 3, 4
205 %rem = and i32 %b, 31
206 %ashr = ashr i32 %a, %rem
210 define i64 @test203(i64 %a, i64 %b) {
211 ; CHECK-LABEL: test203:
213 ; CHECK-NEXT: rlwinm 4, 4, 0, 26, 31
214 ; CHECK-NEXT: srad 3, 3, 4
216 %rem = and i64 %b, 63
217 %ashr = ashr i64 %a, %rem
221 define <16 x i8> @test210(<16 x i8> %a, <16 x i8> %b) {
222 ; CHECK-LABEL: test210:
224 ; CHECK-NEXT: vsrab 2, 2, 3
226 %rem = and <16 x i8> %b, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
227 %ashr = ashr <16 x i8> %a, %rem
231 define <8 x i16> @test211(<8 x i16> %a, <8 x i16> %b) {
232 ; CHECK-LABEL: test211:
234 ; CHECK-NEXT: vsrah 2, 2, 3
236 %rem = and <8 x i16> %b, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
237 %ashr = ashr <8 x i16> %a, %rem
241 define <4 x i32> @test212(<4 x i32> %a, <4 x i32> %b) {
242 ; CHECK-LABEL: test212:
244 ; CHECK-NEXT: vsraw 2, 2, 3
246 %rem = and <4 x i32> %b, <i32 31, i32 31, i32 31, i32 31>
247 %ashr = ashr <4 x i32> %a, %rem
251 define <2 x i64> @test213(<2 x i64> %a, <2 x i64> %b) {
252 ; CHECK-LABEL: test213:
254 ; CHECK-NEXT: vsrad 2, 2, 3
256 %rem = and <2 x i64> %b, <i64 63, i64 63>
257 %ashr = ashr <2 x i64> %a, %rem