make the vector conversion magic handle multiple results.
[oota-llvm.git] / test / CodeGen / CellSPU / shift_ops.ll
1 ; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s
2 ; RUN: grep shlh   %t1.s | count 84
3 ; RUN: grep shlhi  %t1.s | count 51
4 ; RUN: grep shl    %t1.s | count 168
5 ; RUN: grep shli   %t1.s | count 51
6 ; RUN: grep xshw   %t1.s | count 5
7 ; RUN: grep and    %t1.s | count 5
8 target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128-s0:128:128"
9 target triple = "spu"
10
11 ; Vector shifts are not currently supported in gcc or llvm assembly. These are
12 ; not tested.
13
14 ; Shift left i16 via register, note that the second operand to shl is promoted
15 ; to a 32-bit type:
16
17 define i16 @shlh_i16_1(i16 %arg1, i16 %arg2) {
18         %A = shl i16 %arg1, %arg2
19         ret i16 %A
20 }
21
22 define i16 @shlh_i16_2(i16 %arg1, i16 %arg2) {
23         %A = shl i16 %arg2, %arg1
24         ret i16 %A
25 }
26
27 define i16 @shlh_i16_3(i16 signext %arg1, i16 signext %arg2) signext {
28         %A = shl i16 %arg1, %arg2
29         ret i16 %A
30 }
31
32 define i16 @shlh_i16_4(i16 signext %arg1, i16 signext %arg2) signext {
33         %A = shl i16 %arg2, %arg1
34         ret i16 %A
35 }
36
37 define i16 @shlh_i16_5(i16 zeroext %arg1, i16 zeroext %arg2) zeroext {
38         %A = shl i16 %arg1, %arg2
39         ret i16 %A
40 }
41
42 define i16 @shlh_i16_6(i16 zeroext %arg1, i16 zeroext %arg2) zeroext {
43         %A = shl i16 %arg2, %arg1
44         ret i16 %A
45 }
46
47 ; Shift left i16 with immediate:
48 define i16 @shlhi_i16_1(i16 %arg1) {
49         %A = shl i16 %arg1, 12
50         ret i16 %A
51 }
52
53 ; Should not generate anything other than the return, arg1 << 0 = arg1
54 define i16 @shlhi_i16_2(i16 %arg1) {
55         %A = shl i16 %arg1, 0
56         ret i16 %A
57 }
58
59 define i16 @shlhi_i16_3(i16 %arg1) {
60         %A = shl i16 16383, %arg1
61         ret i16 %A
62 }
63
64 ; Should generate 0, 0 << arg1 = 0
65 define i16 @shlhi_i16_4(i16 %arg1) {
66         %A = shl i16 0, %arg1
67         ret i16 %A
68 }
69
70 define i16 @shlhi_i16_5(i16 signext %arg1) signext {
71         %A = shl i16 %arg1, 12
72         ret i16 %A
73 }
74
75 ; Should not generate anything other than the return, arg1 << 0 = arg1
76 define i16 @shlhi_i16_6(i16 signext %arg1) signext {
77         %A = shl i16 %arg1, 0
78         ret i16 %A
79 }
80
81 define i16 @shlhi_i16_7(i16 signext %arg1) signext {
82         %A = shl i16 16383, %arg1
83         ret i16 %A
84 }
85
86 ; Should generate 0, 0 << arg1 = 0
87 define i16 @shlhi_i16_8(i16 signext %arg1) signext {
88         %A = shl i16 0, %arg1
89         ret i16 %A
90 }
91
92 define i16 @shlhi_i16_9(i16 zeroext %arg1) zeroext {
93         %A = shl i16 %arg1, 12
94         ret i16 %A
95 }
96
97 ; Should not generate anything other than the return, arg1 << 0 = arg1
98 define i16 @shlhi_i16_10(i16 zeroext %arg1) zeroext {
99         %A = shl i16 %arg1, 0
100         ret i16 %A
101 }
102
103 define i16 @shlhi_i16_11(i16 zeroext %arg1) zeroext {
104         %A = shl i16 16383, %arg1
105         ret i16 %A
106 }
107
108 ; Should generate 0, 0 << arg1 = 0
109 define i16 @shlhi_i16_12(i16 zeroext %arg1) zeroext {
110         %A = shl i16 0, %arg1
111         ret i16 %A
112 }
113
114 ; Shift left i32 via register, note that the second operand to shl is promoted
115 ; to a 32-bit type:
116
117 define i32 @shl_i32_1(i32 %arg1, i32 %arg2) {
118         %A = shl i32 %arg1, %arg2
119         ret i32 %A
120 }
121
122 define i32 @shl_i32_2(i32 %arg1, i32 %arg2) {
123         %A = shl i32 %arg2, %arg1
124         ret i32 %A
125 }
126
127 define i32 @shl_i32_3(i32 signext %arg1, i32 signext %arg2) signext {
128         %A = shl i32 %arg1, %arg2
129         ret i32 %A
130 }
131
132 define i32 @shl_i32_4(i32 signext %arg1, i32 signext %arg2) signext {
133         %A = shl i32 %arg2, %arg1
134         ret i32 %A
135 }
136
137 define i32 @shl_i32_5(i32 zeroext %arg1, i32 zeroext %arg2) zeroext {
138         %A = shl i32 %arg1, %arg2
139         ret i32 %A
140 }
141
142 define i32 @shl_i32_6(i32 zeroext %arg1, i32 zeroext %arg2) zeroext {
143         %A = shl i32 %arg2, %arg1
144         ret i32 %A
145 }
146
147 ; Shift left i32 with immediate:
148 define i32 @shli_i32_1(i32 %arg1) {
149         %A = shl i32 %arg1, 12
150         ret i32 %A
151 }
152
153 ; Should not generate anything other than the return, arg1 << 0 = arg1
154 define i32 @shli_i32_2(i32 %arg1) {
155         %A = shl i32 %arg1, 0
156         ret i32 %A
157 }
158
159 define i32 @shli_i32_3(i32 %arg1) {
160         %A = shl i32 16383, %arg1
161         ret i32 %A
162 }
163
164 ; Should generate 0, 0 << arg1 = 0
165 define i32 @shli_i32_4(i32 %arg1) {
166         %A = shl i32 0, %arg1
167         ret i32 %A
168 }
169
170 define i32 @shli_i32_5(i32 signext %arg1) signext {
171         %A = shl i32 %arg1, 12
172         ret i32 %A
173 }
174
175 ; Should not generate anything other than the return, arg1 << 0 = arg1
176 define i32 @shli_i32_6(i32 signext %arg1) signext {
177         %A = shl i32 %arg1, 0
178         ret i32 %A
179 }
180
181 define i32 @shli_i32_7(i32 signext %arg1) signext {
182         %A = shl i32 16383, %arg1
183         ret i32 %A
184 }
185
186 ; Should generate 0, 0 << arg1 = 0
187 define i32 @shli_i32_8(i32 signext %arg1) signext {
188         %A = shl i32 0, %arg1
189         ret i32 %A
190 }
191
192 define i32 @shli_i32_9(i32 zeroext %arg1) zeroext {
193         %A = shl i32 %arg1, 12
194         ret i32 %A
195 }
196
197 ; Should not generate anything other than the return, arg1 << 0 = arg1
198 define i32 @shli_i32_10(i32 zeroext %arg1) zeroext {
199         %A = shl i32 %arg1, 0
200         ret i32 %A
201 }
202
203 define i32 @shli_i32_11(i32 zeroext %arg1) zeroext {
204         %A = shl i32 16383, %arg1
205         ret i32 %A
206 }
207
208 ; Should generate 0, 0 << arg1 = 0
209 define i32 @shli_i32_12(i32 zeroext %arg1) zeroext {
210         %A = shl i32 0, %arg1
211         ret i32 %A
212 }