1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -target-feature +altivec -target-feature +power8-vector \
3 // RUN: -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
4
5 // RUN: %clang_cc1 -target-feature +altivec -target-feature +power8-vector \
6 // RUN: -triple powerpc64le-unknown-unknown -emit-llvm %s -o - \
7 // RUN: | FileCheck %s -check-prefix=CHECK-LE
8
9 // RUN: not %clang_cc1 -target-feature +altivec -triple powerpc-unknown-unknown \
10 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PPC
11 #include <altivec.h>
12
13 // CHECK-PPC: error: __int128 is not supported on this target
14 vector signed __int128 vlll = { -1 };
15 // CHECK-PPC: error: __int128 is not supported on this target
16 vector unsigned __int128 vulll = { 1 };
17
18 signed long long param_sll;
19 // CHECK-PPC: error: __int128 is not supported on this target
20 signed __int128 param_lll;
21 // CHECK-PPC: error: __int128 is not supported on this target
22 unsigned __int128 param_ulll;
23
24 // CHECK-PPC: error: __int128 is not supported on this target
25 vector signed __int128 res_vlll;
26 // CHECK-PPC: error: __int128 is not supported on this target
27 vector unsigned __int128 res_vulll;
28
29
30 // CHECK-LABEL: define void @test1
test1()31 void test1() {
32
33 /* vec_add */
34 res_vlll = vec_add(vlll, vlll);
35 // CHECK: add <1 x i128>
36 // CHECK-LE: add <1 x i128>
37 // CHECK-PPC: error: call to 'vec_add' is ambiguous
38
39 res_vulll = vec_add(vulll, vulll);
40 // CHECK: add <1 x i128>
41 // CHECK-LE: add <1 x i128>
42 // CHECK-PPC: error: call to 'vec_add' is ambiguous
43
44 /* vec_vadduqm */
45 res_vlll = vec_vadduqm(vlll, vlll);
46 // CHECK: add <1 x i128>
47 // CHECK-LE: add <1 x i128>
48 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
49
50 res_vulll = vec_vadduqm(vulll, vulll);
51 // CHECK: add <1 x i128>
52 // CHECK-LE: add <1 x i128>
53 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
54
55 /* vec_vaddeuqm */
56 res_vlll = vec_vaddeuqm(vlll, vlll, vlll);
57 // CHECK: @llvm.ppc.altivec.vaddeuqm
58 // CHECK-LE: @llvm.ppc.altivec.vaddeuqm
59 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
60
61 res_vulll = vec_vaddeuqm(vulll, vulll, vulll);
62 // CHECK: @llvm.ppc.altivec.vaddeuqm
63 // CHECK-LE: @llvm.ppc.altivec.vaddeuqm
64 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
65
66 /* vec_addc */
67 res_vlll = vec_addc(vlll, vlll);
68 // CHECK: @llvm.ppc.altivec.vaddcuq
69 // CHECK-LE: @llvm.ppc.altivec.vaddcuq
70 // KCHECK-PPC: error: call to 'vec_addc' is ambiguous
71
72 res_vulll = vec_addc(vulll, vulll);
73 // CHECK: @llvm.ppc.altivec.vaddcuq
74 // CHECK-LE: @llvm.ppc.altivec.vaddcuq
75 // KCHECK-PPC: error: call to 'vec_addc' is ambiguous
76
77
78 /* vec_vaddcuq */
79 res_vlll = vec_vaddcuq(vlll, vlll);
80 // CHECK: @llvm.ppc.altivec.vaddcuq
81 // CHECK-LE: @llvm.ppc.altivec.vaddcuq
82 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
83
84 res_vulll = vec_vaddcuq(vulll, vulll);
85 // CHECK: @llvm.ppc.altivec.vaddcuq
86 // CHECK-LE: @llvm.ppc.altivec.vaddcuq
87 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
88
89 /* vec_vaddecuq */
90 res_vlll = vec_vaddecuq(vlll, vlll, vlll);
91 // CHECK: @llvm.ppc.altivec.vaddecuq
92 // CHECK-LE: @llvm.ppc.altivec.vaddecuq
93 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
94
95 res_vulll = vec_vaddecuq(vulll, vulll, vulll);
96 // CHECK: @llvm.ppc.altivec.vaddecuq
97 // CHECK-LE: @llvm.ppc.altivec.vaddecuq
98 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
99
100 /* vec_sub */
101 res_vlll = vec_sub(vlll, vlll);
102 // CHECK: sub <1 x i128>
103 // CHECK-LE: sub <1 x i128>
104 // CHECK-PPC: error: call to 'vec_sub' is ambiguous
105
106 res_vulll = vec_sub(vulll, vulll);
107 // CHECK: sub <1 x i128>
108 // CHECK-LE: sub <1 x i128>
109 // CHECK-PPC: error: call to 'vec_sub' is ambiguous
110
111 /* vec_vsubuqm */
112 res_vlll = vec_vsubuqm(vlll, vlll);
113 // CHECK: sub <1 x i128>
114 // CHECK-LE: sub <1 x i128>
115 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
116
117 res_vulll = vec_vsubuqm(vulll, vulll);
118 // CHECK: sub <1 x i128>
119 // CHECK-LE: sub <1 x i128>
120 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
121
122 /* vec_vsubeuqm */
123 res_vlll = vec_vsubeuqm(vlll, vlll, vlll);
124 // CHECK: @llvm.ppc.altivec.vsubeuqm
125 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
126 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
127
128 /* vec_sube */
129 res_vlll = vec_sube(vlll, vlll, vlll);
130 // CHECK: @llvm.ppc.altivec.vsubeuqm
131 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
132 // CHECK-PPC: error: call to 'vec_sube' is ambiguous
133
134 res_vulll = vec_sube(vulll, vulll, vulll);
135 // CHECK: @llvm.ppc.altivec.vsubeuqm
136 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
137 // CHECK-PPC: error: call to 'vec_sube' is ambiguous
138
139 res_vlll = vec_sube(vlll, vlll, vlll);
140 // CHECK: @llvm.ppc.altivec.vsubeuqm
141 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
142 // CHECK-PPC: error: call to 'vec_sube' is ambiguous
143
144 res_vulll = vec_vsubeuqm(vulll, vulll, vulll);
145 // CHECK: @llvm.ppc.altivec.vsubeuqm
146 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
147 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
148
149 res_vulll = vec_sube(vulll, vulll, vulll);
150 // CHECK: @llvm.ppc.altivec.vsubeuqm
151 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
152 // CHECK-PPC: error: call to 'vec_sube' is ambiguous
153
154 /* vec_subc */
155 res_vlll = vec_subc(vlll, vlll);
156 // CHECK: @llvm.ppc.altivec.vsubcuq
157 // CHECK-LE: @llvm.ppc.altivec.vsubcuq
158 // KCHECK-PPC: error: call to 'vec_subc' is ambiguous
159
160 res_vulll = vec_subc(vulll, vulll);
161 // CHECK: @llvm.ppc.altivec.vsubcuq
162 // CHECK-LE: @llvm.ppc.altivec.vsubcuq
163 // KCHECK-PPC: error: call to 'vec_subc' is ambiguous
164
165 /* vec_vsubcuq */
166 res_vlll = vec_vsubcuq(vlll, vlll);
167 // CHECK: @llvm.ppc.altivec.vsubcuq
168 // CHECK-LE: @llvm.ppc.altivec.vsubcuq
169 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
170
171 res_vulll = vec_vsubcuq(vulll, vulll);
172 // CHECK: @llvm.ppc.altivec.vsubcuq
173 // CHECK-LE: @llvm.ppc.altivec.vsubcuq
174 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
175
176 /* vec_vsubecuq */
177 res_vlll = vec_vsubecuq(vlll, vlll, vlll);
178 // CHECK: @llvm.ppc.altivec.vsubecuq
179 // CHECK-LE: @llvm.ppc.altivec.vsubecuq
180 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
181
182 res_vulll = vec_vsubecuq(vulll, vulll, vulll);
183 // CHECK: @llvm.ppc.altivec.vsubecuq
184 // CHECK-LE: @llvm.ppc.altivec.vsubecuq
185 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
186
187 res_vlll = vec_subec(vlll, vlll, vlll);
188 // CHECK: @llvm.ppc.altivec.vsubecuq
189 // CHECK-LE: @llvm.ppc.altivec.vsubecuq
190 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
191
192 res_vulll = vec_subec(vulll, vulll, vulll);
193 // CHECK: @llvm.ppc.altivec.vsubecuq
194 // CHECK-LE: @llvm.ppc.altivec.vsubecuq
195 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
196
197 res_vulll = vec_revb(vulll);
198 // CHECK: store <16 x i8> <i8 15, i8 14, i8 13, i8 12, i8 11, i8 10, i8 9, i8 8, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0>, <16 x i8>* {{%.+}}, align 16
199 // CHECK: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> {{%.+}}, <4 x i32> {{%.+}}, <16 x i8> {{%.+}})
200 // CHECK-LE: store <16 x i8> <i8 15, i8 14, i8 13, i8 12, i8 11, i8 10, i8 9, i8 8, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0>, <16 x i8>* {{%.+}}, align 16
201 // CHECK-LE: store <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>, <16 x i8>* {{%.+}}, align 16
202 // CHECK-LE: xor <16 x i8>
203 // CHECK-LE: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> {{%.+}}, <4 x i32> {{%.+}}, <16 x i8> {{%.+}})
204 // CHECK_PPC: error: call to 'vec_revb' is ambiguous
205
206 /* vec_xl */
207 res_vlll = vec_xl(param_sll, ¶m_lll);
208 // CHECK: load <1 x i128>, <1 x i128>* %{{[0-9]+}}, align 1
209 // CHECK-LE: load <1 x i128>, <1 x i128>* %{{[0-9]+}}, align 1
210 // CHECK-PPC: error: call to 'vec_xl' is ambiguous
211
212 res_vulll = vec_xl(param_sll, ¶m_ulll);
213 // CHECK: load <1 x i128>, <1 x i128>* %{{[0-9]+}}, align 1
214 // CHECK-LE: load <1 x i128>, <1 x i128>* %{{[0-9]+}}, align 1
215 // CHECK-PPC: error: call to 'vec_xl' is ambiguous
216
217 /* vec_xst */
218 vec_xst(vlll, param_sll, ¶m_lll);
219 // CHECK: store <1 x i128> %{{[0-9]+}}, <1 x i128>* %{{[0-9]+}}, align 1
220 // CHECK-LE: store <1 x i128> %{{[0-9]+}}, <1 x i128>* %{{[0-9]+}}, align 1
221 // CHECK-PPC: error: call to 'vec_xst' is ambiguous
222
223 vec_xst(vulll, param_sll, ¶m_ulll);
224 // CHECK: store <1 x i128> %{{[0-9]+}}, <1 x i128>* %{{[0-9]+}}, align 1
225 // CHECK-LE: store <1 x i128> %{{[0-9]+}}, <1 x i128>* %{{[0-9]+}}, align 1
226 // CHECK-PPC: error: call to 'vec_xst' is ambiguous
227
228 /* vec_xl_be */
229 res_vlll = vec_xl_be(param_sll, ¶m_lll);
230 // CHECK: load <1 x i128>, <1 x i128>* %{{[0-9]+}}, align 1
231 // CHECK-LE: load <1 x i128>, <1 x i128>* %{{[0-9]+}}, align 1
232 // CHECK-PPC: error: call to 'vec_xl' is ambiguous
233
234 res_vulll = vec_xl_be(param_sll, ¶m_ulll);
235 // CHECK: load <1 x i128>, <1 x i128>* %{{[0-9]+}}, align 1
236 // CHECK-LE: load <1 x i128>, <1 x i128>* %{{[0-9]+}}, align 1
237 // CHECK-PPC: error: call to 'vec_xl' is ambiguous
238
239 /* vec_xst_be */
240 vec_xst_be(vlll, param_sll, ¶m_lll);
241 // CHECK: store <1 x i128> %{{[0-9]+}}, <1 x i128>* %{{[0-9]+}}, align 1
242 // CHECK-LE: store <1 x i128> %{{[0-9]+}}, <1 x i128>* %{{[0-9]+}}, align 1
243 // CHECK-PPC: error: call to 'vec_xst' is ambiguous
244
245 vec_xst_be(vulll, param_sll, ¶m_ulll);
246 // CHECK: store <1 x i128> %{{[0-9]+}}, <1 x i128>* %{{[0-9]+}}, align 1
247 // CHECK-LE: store <1 x i128> %{{[0-9]+}}, <1 x i128>* %{{[0-9]+}}, align 1
248 // CHECK-PPC: error: call to 'vec_xst' is ambiguous
249 }
250