[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / PowerPC / builtins-ppc-quadword.c
blob6030899a88357faa037a53ed88c5236e99c20912
1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -flax-vector-conversions=none -target-feature +altivec -target-feature +power8-vector \
3 // RUN: -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
5 // RUN: %clang_cc1 -flax-vector-conversions=none -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
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>
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 vector unsigned char vuc;
19 signed long long param_sll;
20 // CHECK-PPC: error: __int128 is not supported on this target
21 signed __int128 param_lll;
22 // CHECK-PPC: error: __int128 is not supported on this target
23 unsigned __int128 param_ulll;
25 // CHECK-PPC: error: __int128 is not supported on this target
26 vector signed __int128 res_vlll;
27 // CHECK-PPC: error: __int128 is not supported on this target
28 vector unsigned __int128 res_vulll;
29 vector unsigned char res_vuc;
32 // CHECK-LABEL: define{{.*}} void @test1
33 void test1() {
35 /* vec_add */
36 res_vlll = vec_add(vlll, vlll);
37 // CHECK: add <1 x i128>
38 // CHECK-LE: add <1 x i128>
39 // CHECK-PPC: error: call to 'vec_add' is ambiguous
41 res_vulll = vec_add(vulll, vulll);
42 // CHECK: add <1 x i128>
43 // CHECK-LE: add <1 x i128>
44 // CHECK-PPC: error: call to 'vec_add' is ambiguous
46 /* vec_vadduqm */
47 res_vlll = vec_vadduqm(vlll, vlll);
48 // CHECK: add <1 x i128>
49 // CHECK-LE: add <1 x i128>
50 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
52 res_vulll = vec_vadduqm(vulll, vulll);
53 // CHECK: add <1 x i128>
54 // CHECK-LE: add <1 x i128>
55 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
57 /* vec_vaddeuqm */
58 res_vlll = vec_vaddeuqm(vlll, vlll, vlll);
59 // CHECK: @llvm.ppc.altivec.vaddeuqm
60 // CHECK-LE: @llvm.ppc.altivec.vaddeuqm
61 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
63 res_vulll = vec_vaddeuqm(vulll, vulll, vulll);
64 // CHECK: @llvm.ppc.altivec.vaddeuqm
65 // CHECK-LE: @llvm.ppc.altivec.vaddeuqm
66 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
68 /* vec_addc */
69 res_vlll = vec_addc(vlll, vlll);
70 // CHECK: @llvm.ppc.altivec.vaddcuq
71 // CHECK-LE: @llvm.ppc.altivec.vaddcuq
72 // KCHECK-PPC: error: call to 'vec_addc' is ambiguous
74 res_vulll = vec_addc(vulll, vulll);
75 // CHECK: @llvm.ppc.altivec.vaddcuq
76 // CHECK-LE: @llvm.ppc.altivec.vaddcuq
77 // KCHECK-PPC: error: call to 'vec_addc' is ambiguous
80 /* vec_vaddcuq */
81 res_vlll = vec_vaddcuq(vlll, vlll);
82 // CHECK: @llvm.ppc.altivec.vaddcuq
83 // CHECK-LE: @llvm.ppc.altivec.vaddcuq
84 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
86 res_vulll = vec_vaddcuq(vulll, vulll);
87 // CHECK: @llvm.ppc.altivec.vaddcuq
88 // CHECK-LE: @llvm.ppc.altivec.vaddcuq
89 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
91 /* vec_vaddecuq */
92 res_vlll = vec_vaddecuq(vlll, vlll, vlll);
93 // CHECK: @llvm.ppc.altivec.vaddecuq
94 // CHECK-LE: @llvm.ppc.altivec.vaddecuq
95 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
97 res_vulll = vec_vaddecuq(vulll, vulll, vulll);
98 // CHECK: @llvm.ppc.altivec.vaddecuq
99 // CHECK-LE: @llvm.ppc.altivec.vaddecuq
100 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
102 /* vec_sub */
103 res_vlll = vec_sub(vlll, vlll);
104 // CHECK: sub <1 x i128>
105 // CHECK-LE: sub <1 x i128>
106 // CHECK-PPC: error: call to 'vec_sub' is ambiguous
108 res_vulll = vec_sub(vulll, vulll);
109 // CHECK: sub <1 x i128>
110 // CHECK-LE: sub <1 x i128>
111 // CHECK-PPC: error: call to 'vec_sub' is ambiguous
113 /* vec_vsubuqm */
114 res_vlll = vec_vsubuqm(vlll, vlll);
115 // CHECK: sub <1 x i128>
116 // CHECK-LE: sub <1 x i128>
117 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
119 res_vulll = vec_vsubuqm(vulll, vulll);
120 // CHECK: sub <1 x i128>
121 // CHECK-LE: sub <1 x i128>
122 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
124 res_vuc = vec_sub_u128(vuc, vuc);
125 // CHECK: sub <1 x i128>
126 // CHECK-LE: sub <1 x i128>
128 /* vec_vsubeuqm */
129 res_vlll = vec_vsubeuqm(vlll, vlll, vlll);
130 // CHECK: @llvm.ppc.altivec.vsubeuqm
131 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
132 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
134 /* vec_sube */
135 res_vlll = vec_sube(vlll, vlll, vlll);
136 // CHECK: @llvm.ppc.altivec.vsubeuqm
137 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
138 // CHECK-PPC: error: call to 'vec_sube' is ambiguous
140 res_vulll = vec_sube(vulll, vulll, vulll);
141 // CHECK: @llvm.ppc.altivec.vsubeuqm
142 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
143 // CHECK-PPC: error: call to 'vec_sube' is ambiguous
145 res_vlll = vec_sube(vlll, vlll, vlll);
146 // CHECK: @llvm.ppc.altivec.vsubeuqm
147 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
148 // CHECK-PPC: error: call to 'vec_sube' is ambiguous
150 res_vulll = vec_vsubeuqm(vulll, vulll, vulll);
151 // CHECK: @llvm.ppc.altivec.vsubeuqm
152 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
153 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
155 res_vulll = vec_sube(vulll, vulll, vulll);
156 // CHECK: @llvm.ppc.altivec.vsubeuqm
157 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
158 // CHECK-PPC: error: call to 'vec_sube' is ambiguous
160 res_vuc = vec_sube_u128(vuc, vuc, vuc);
161 // CHECK: @llvm.ppc.altivec.vsubeuqm
162 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
164 /* vec_subc */
165 res_vlll = vec_subc(vlll, vlll);
166 // CHECK: @llvm.ppc.altivec.vsubcuq
167 // CHECK-LE: @llvm.ppc.altivec.vsubcuq
168 // KCHECK-PPC: error: call to 'vec_subc' is ambiguous
170 res_vulll = vec_subc(vulll, vulll);
171 // CHECK: @llvm.ppc.altivec.vsubcuq
172 // CHECK-LE: @llvm.ppc.altivec.vsubcuq
173 // KCHECK-PPC: error: call to 'vec_subc' is ambiguous
175 res_vuc = vec_subc_u128(vuc, vuc);
176 // CHECK: @llvm.ppc.altivec.vsubcuq
177 // CHECK-LE: @llvm.ppc.altivec.vsubcuq
179 /* vec_vsubcuq */
180 res_vlll = vec_vsubcuq(vlll, vlll);
181 // CHECK: @llvm.ppc.altivec.vsubcuq
182 // CHECK-LE: @llvm.ppc.altivec.vsubcuq
183 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
185 res_vulll = vec_vsubcuq(vulll, vulll);
186 // CHECK: @llvm.ppc.altivec.vsubcuq
187 // CHECK-LE: @llvm.ppc.altivec.vsubcuq
188 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
190 /* vec_vsubecuq */
191 res_vlll = vec_vsubecuq(vlll, vlll, vlll);
192 // CHECK: @llvm.ppc.altivec.vsubecuq
193 // CHECK-LE: @llvm.ppc.altivec.vsubecuq
194 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
196 res_vulll = vec_vsubecuq(vulll, vulll, vulll);
197 // CHECK: @llvm.ppc.altivec.vsubecuq
198 // CHECK-LE: @llvm.ppc.altivec.vsubecuq
199 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
201 res_vlll = vec_subec(vlll, vlll, vlll);
202 // CHECK: @llvm.ppc.altivec.vsubecuq
203 // CHECK-LE: @llvm.ppc.altivec.vsubecuq
204 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
206 res_vulll = vec_subec(vulll, vulll, vulll);
207 // CHECK: @llvm.ppc.altivec.vsubecuq
208 // CHECK-LE: @llvm.ppc.altivec.vsubecuq
209 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
211 res_vuc = vec_subec_u128(vuc, vuc, vuc);
212 // CHECK: @llvm.ppc.altivec.vsubecuq
213 // CHECK-LE: @llvm.ppc.altivec.vsubecuq
215 res_vulll = vec_revb(vulll);
216 // 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>, ptr {{%.+}}, align 16
217 // CHECK: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> {{%.+}}, <4 x i32> {{%.+}}, <16 x i8> {{%.+}})
218 // 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>, ptr {{%.+}}, align 16
219 // 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>, ptr {{%.+}}, align 16
220 // CHECK-LE: xor <16 x i8>
221 // CHECK-LE: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> {{%.+}}, <4 x i32> {{%.+}}, <16 x i8> {{%.+}})
222 // CHECK_PPC: error: call to 'vec_revb' is ambiguous
224 /* vec_xl */
225 res_vlll = vec_xl(param_sll, &param_lll);
226 // CHECK: load <1 x i128>, ptr %{{[0-9]+}}, align 1
227 // CHECK-LE: load <1 x i128>, ptr %{{[0-9]+}}, align 1
228 // CHECK-PPC: error: call to 'vec_xl' is ambiguous
230 res_vulll = vec_xl(param_sll, &param_ulll);
231 // CHECK: load <1 x i128>, ptr %{{[0-9]+}}, align 1
232 // CHECK-LE: load <1 x i128>, ptr %{{[0-9]+}}, align 1
233 // CHECK-PPC: error: call to 'vec_xl' is ambiguous
235 /* vec_xst */
236 vec_xst(vlll, param_sll, &param_lll);
237 // CHECK: store <1 x i128> %{{[0-9]+}}, ptr %{{[0-9]+}}, align 1
238 // CHECK-LE: store <1 x i128> %{{[0-9]+}}, ptr %{{[0-9]+}}, align 1
239 // CHECK-PPC: error: call to 'vec_xst' is ambiguous
241 vec_xst(vulll, param_sll, &param_ulll);
242 // CHECK: store <1 x i128> %{{[0-9]+}}, ptr %{{[0-9]+}}, align 1
243 // CHECK-LE: store <1 x i128> %{{[0-9]+}}, ptr %{{[0-9]+}}, align 1
244 // CHECK-PPC: error: call to 'vec_xst' is ambiguous
246 /* vec_xl_be */
247 res_vlll = vec_xl_be(param_sll, &param_lll);
248 // CHECK: load <1 x i128>, ptr %{{[0-9]+}}, align 1
249 // CHECK-LE: load <1 x i128>, ptr %{{[0-9]+}}, align 1
250 // CHECK-PPC: error: call to 'vec_xl' is ambiguous
252 res_vulll = vec_xl_be(param_sll, &param_ulll);
253 // CHECK: load <1 x i128>, ptr %{{[0-9]+}}, align 1
254 // CHECK-LE: load <1 x i128>, ptr %{{[0-9]+}}, align 1
255 // CHECK-PPC: error: call to 'vec_xl' is ambiguous
257 /* vec_xst_be */
258 vec_xst_be(vlll, param_sll, &param_lll);
259 // CHECK: store <1 x i128> %{{[0-9]+}}, ptr %{{[0-9]+}}, align 1
260 // CHECK-LE: store <1 x i128> %{{[0-9]+}}, ptr %{{[0-9]+}}, align 1
261 // CHECK-PPC: error: call to 'vec_xst' is ambiguous
263 vec_xst_be(vulll, param_sll, &param_ulll);
264 // CHECK: store <1 x i128> %{{[0-9]+}}, ptr %{{[0-9]+}}, align 1
265 // CHECK-LE: store <1 x i128> %{{[0-9]+}}, ptr %{{[0-9]+}}, align 1
266 // CHECK-PPC: error: call to 'vec_xst' is ambiguous