1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -faltivec -target-feature +power8-vector \
3 // RUN: -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
4 
5 // RUN: %clang_cc1 -faltivec -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 -faltivec -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 // CHECK-PPC: error: __int128 is not supported on this target
19 vector signed __int128 res_vlll;
20 // CHECK-PPC: error: __int128 is not supported on this target
21 vector unsigned __int128 res_vulll;
22 
23 
24 // CHECK-LABEL: define void @test1
test1()25 void test1() {
26 
27   /* vec_add */
28   res_vlll = vec_add(vlll, vlll);
29 // CHECK: add <1 x i128>
30 // CHECK-LE: add <1 x i128>
31 // CHECK-PPC: error: call to 'vec_add' is ambiguous
32 
33   res_vulll = vec_add(vulll, vulll);
34 // CHECK: add <1 x i128>
35 // CHECK-LE: add <1 x i128>
36 // CHECK-PPC: error: call to 'vec_add' is ambiguous
37 
38   /* vec_vadduqm */
39   res_vlll = vec_vadduqm(vlll, vlll);
40 // CHECK: add <1 x i128>
41 // CHECK-LE: add <1 x i128>
42 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
43 
44   res_vulll = vec_vadduqm(vulll, vulll);
45 // CHECK: add <1 x i128>
46 // CHECK-LE: add <1 x i128>
47 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
48 
49   /* vec_vaddeuqm */
50   res_vlll = vec_vaddeuqm(vlll, vlll, vlll);
51 // CHECK: @llvm.ppc.altivec.vaddeuqm
52 // CHECK-LE: @llvm.ppc.altivec.vaddeuqm
53 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
54 
55   res_vulll = vec_vaddeuqm(vulll, vulll, vulll);
56 // CHECK: @llvm.ppc.altivec.vaddeuqm
57 // CHECK-LE: @llvm.ppc.altivec.vaddeuqm
58 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
59 
60   /* vec_addc */
61   res_vlll = vec_addc(vlll, vlll);
62 // CHECK: @llvm.ppc.altivec.vaddcuq
63 // CHECK-LE: @llvm.ppc.altivec.vaddcuq
64 // KCHECK-PPC: error: call to 'vec_addc' is ambiguous
65 
66   res_vulll = vec_addc(vulll, vulll);
67 // CHECK: @llvm.ppc.altivec.vaddcuq
68 // CHECK-LE: @llvm.ppc.altivec.vaddcuq
69 // KCHECK-PPC: error: call to 'vec_addc' is ambiguous
70 
71 
72   /* vec_vaddcuq */
73   res_vlll = vec_vaddcuq(vlll, vlll);
74 // CHECK: @llvm.ppc.altivec.vaddcuq
75 // CHECK-LE: @llvm.ppc.altivec.vaddcuq
76 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
77 
78   res_vulll = vec_vaddcuq(vulll, vulll);
79 // CHECK: @llvm.ppc.altivec.vaddcuq
80 // CHECK-LE: @llvm.ppc.altivec.vaddcuq
81 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
82 
83   /* vec_vaddecuq */
84   res_vlll = vec_vaddecuq(vlll, vlll, vlll);
85 // CHECK: @llvm.ppc.altivec.vaddecuq
86 // CHECK-LE: @llvm.ppc.altivec.vaddecuq
87 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
88 
89   res_vulll = vec_vaddecuq(vulll, vulll, vulll);
90 // CHECK: @llvm.ppc.altivec.vaddecuq
91 // CHECK-LE: @llvm.ppc.altivec.vaddecuq
92 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
93 
94   /* vec_sub */
95   res_vlll = vec_sub(vlll, vlll);
96 // CHECK: sub <1 x i128>
97 // CHECK-LE: sub <1 x i128>
98 // CHECK-PPC: error: call to 'vec_sub' is ambiguous
99 
100   res_vulll = vec_sub(vulll, vulll);
101 // CHECK: sub <1 x i128>
102 // CHECK-LE: sub <1 x i128>
103 // CHECK-PPC: error: call to 'vec_sub' is ambiguous
104 
105   /* vec_vsubuqm */
106   res_vlll = vec_vsubuqm(vlll, vlll);
107 // CHECK: sub <1 x i128>
108 // CHECK-LE: sub <1 x i128>
109 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
110 
111   res_vulll = vec_vsubuqm(vulll, vulll);
112 // CHECK: sub <1 x i128>
113 // CHECK-LE: sub <1 x i128>
114 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
115 
116   /* vec_vsubeuqm */
117   res_vlll = vec_vsubeuqm(vlll, vlll, vlll);
118 // CHECK: @llvm.ppc.altivec.vsubeuqm
119 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
120 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
121 
122   res_vulll = vec_vsubeuqm(vulll, vulll, vulll);
123 // CHECK: @llvm.ppc.altivec.vsubeuqm
124 // CHECK-LE: @llvm.ppc.altivec.vsubeuqm
125 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
126 
127   /* vec_subc */
128   res_vlll = vec_subc(vlll, vlll);
129 // CHECK: @llvm.ppc.altivec.vsubcuq
130 // CHECK-LE: @llvm.ppc.altivec.vsubcuq
131 // KCHECK-PPC: error: call to 'vec_subc' is ambiguous
132 
133   res_vulll = vec_subc(vulll, vulll);
134 // CHECK: @llvm.ppc.altivec.vsubcuq
135 // CHECK-LE: @llvm.ppc.altivec.vsubcuq
136 // KCHECK-PPC: error: call to 'vec_subc' is ambiguous
137 
138   /* vec_vsubcuq */
139   res_vlll = vec_vsubcuq(vlll, vlll);
140 // CHECK: @llvm.ppc.altivec.vsubcuq
141 // CHECK-LE: @llvm.ppc.altivec.vsubcuq
142 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
143 
144   res_vulll = vec_vsubcuq(vulll, vulll);
145 // CHECK: @llvm.ppc.altivec.vsubcuq
146 // CHECK-LE: @llvm.ppc.altivec.vsubcuq
147 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
148 
149   /* vec_vsubecuq */
150   res_vlll = vec_vsubecuq(vlll, vlll, vlll);
151 // CHECK: @llvm.ppc.altivec.vsubecuq
152 // CHECK-LE: @llvm.ppc.altivec.vsubecuq
153 // CHECK-PPC: error: assigning to '__vector __int128' (vector of 1 '__int128' value) from incompatible type 'int'
154 
155   res_vulll = vec_vsubecuq(vulll, vulll, vulll);
156 // CHECK: @llvm.ppc.altivec.vsubecuq
157 // CHECK-LE: @llvm.ppc.altivec.vsubecuq
158 // CHECK-PPC: error: assigning to '__vector unsigned __int128' (vector of 1 'unsigned __int128' value) from incompatible type 'int'
159 
160 }
161