Use conditional internal functions in if-conversion
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / builtins-1.fold.h
blob8bc5f5e4336684f520cacd30d1cb6c11d18d98ce
1 /* This test is included into builtins-1-be.c and builtins-1-le.c to test on
2 Big Endian and Little Endian machines. */
3 /* This file is based on builtins-1.h. In this variant, most variables have
4 been marked as extern to prevent optimization-away. */
6 #include <altivec.h>
8 vector double y = { 2.0, 4.0 };
9 extern vector double z;
11 int main ()
13 vector float fa = {1.0, 2.0, 3.0, -4.0};
14 vector float fb = {-2.0, -3.0, -4.0, -5.0};
15 extern vector float fd; fd = vec_and (fa, fb);
16 extern vector float fc; fc = vec_cpsgn (fa, fb);
17 extern vector float fe; fe = vec_mergeh (fa, fb);
18 extern vector float ff; ff = vec_mergel (fa, fb);
20 vector double da = {1.0, 2.0};
21 vector double db = {-2.0, -3.0};
22 extern vector double dz; dz = vec_and (da, db);
24 vector long long la = {5L, 14L};
25 vector long long lb = {3L, 86L};
26 extern vector long long lc; lc = vec_and (la, lb);
27 vector bool long long ld = {0, -1};
28 extern vector long long le; le = vec_and (la, ld);
29 extern vector long long lf; lf = vec_and (ld, lb);
31 vector unsigned long long ua = {5L, 14L};
32 vector unsigned long long ub = {3L, 86L};
33 extern vector unsigned long long uc; uc = vec_and (ua, ub);
34 vector bool long long ud = {0, -1};
35 extern vector unsigned long long ue; ue = vec_and (ua, ud);
36 extern vector unsigned long long uf; uf = vec_and (ud, ub);
38 extern vector long long lg; lg = vec_andc (la, lb);
39 extern vector long long lh; lh = vec_andc (la, ld);
40 extern vector long long li; li = vec_andc (ld, lb);
42 extern vector unsigned long long ug; ug = vec_andc (ua, ub);
43 extern vector unsigned long long uh; uh = vec_andc (ua, ud);
44 extern vector unsigned long long ui; ui = vec_andc (ud, ub);
46 vector double de = {1.0, -4.0};
47 vector double df = {-2.0, 5.0};
48 extern vector double dg; dg = vec_cpsgn (de, df);
49 extern vector double dzw; dzw = vec_mergeh (de, df);
50 extern vector double dze; dze = vec_mergel (de, df);
52 extern vector long long lj; lj = vec_mergeh (la, lb);
53 extern vector long long lk; lk = vec_mergeh (la, ld);
54 extern vector long long ll; ll = vec_mergeh (ld, la);
56 extern vector unsigned long long uj; uj = vec_mergeh (ua, ub);
57 extern vector unsigned long long uk; uk = vec_mergeh (ua, ud);
58 extern vector unsigned long long ul; ul = vec_mergeh (ud, ua);
60 vector pixel pa = {9, 16, 25, 36, 1, 2, 3, 4};
61 vector pixel pb = {25, 36, 1, 2, 45, 3, 4, 99};
62 extern vector pixel pc; pc = vec_mergeh (pa, pb);
63 extern vector pixel pd; pd = vec_mergel (pa, pb);
65 extern vector long long lm; lm = vec_mergel (la, lb);
66 extern vector long long ln; ln = vec_mergel (la, ld);
67 extern vector long long lo; lo = vec_mergel (ld, la);
69 extern vector unsigned long long um; um = vec_mergel (ua, ub);
70 extern vector unsigned long long un; un = vec_mergel (ua, ud);
71 extern vector unsigned long long uo; uo = vec_mergel (ud, ua);
73 extern vector long long lp; lp = vec_nor (la, lb);
74 extern vector long long lq; lq = vec_nor (la, ld);
75 extern vector long long lr; lr = vec_nor (ld, la);
77 extern vector unsigned long long up; up = vec_nor (ua, ub);
78 extern vector unsigned long long uq; uq = vec_nor (ua, ud);
79 extern vector unsigned long long ur; ur = vec_nor (ud, ua);
81 extern vector long long ls; ls = vec_or (la, lb);
82 extern vector long long lt; lt = vec_or (la, ld);
83 extern vector long long lu; lu = vec_or (ld, la);
85 extern vector unsigned long long us; us = vec_or (ua, ub);
86 extern vector unsigned long long ut; ut = vec_or (ua, ud);
87 extern vector unsigned long long uu; uu = vec_or (ud, ua);
89 vector unsigned char ca = {0,4,8,1,5,9,2,6,10,3,7,11,15,12,14,13};
90 vector unsigned char cbb = {5,4,8,3,1,9,2,6,10,3,7,11,15,12,14,13};
92 extern vector long long lv; lv = vec_perm (la, lb, ca);
94 extern vector unsigned char ucm; ucm = vec_and (ca, cbb);
95 extern vector unsigned char ucn; ucn = vec_andc (ca, cbb);
96 extern vector unsigned char uco; uco = vec_mergel (ca, cbb);
98 extern vector unsigned long long uv; uv = vec_perm (ua, ub, ca);
100 extern vector long long lw; lw = vec_sel (la, lb, lc);
101 extern vector long long lx; lx = vec_sel (la, lb, uc);
102 extern vector long long ly; ly = vec_sel (la, lb, ld);
104 extern vector unsigned long long uw; uw = vec_sel (ua, ub, lc);
105 extern vector unsigned long long ux; ux = vec_sel (ua, ub, uc);
106 extern vector unsigned long long uy; uy = vec_sel (ua, ub, ld);
108 extern vector long long lz; lz = vec_xor (la, lb);
109 extern vector long long l0; l0 = vec_xor (la, ld);
110 extern vector long long l1; l1 = vec_xor (ld, la);
112 extern vector unsigned long long uz; uz = vec_xor (ua, ub);
113 extern vector unsigned long long u0; u0 = vec_xor (ua, ud);
114 extern vector unsigned long long u1; u1 = vec_xor (ud, ua);
116 extern int ia; ia = vec_all_eq (ua, ub);
117 extern int ib; ib = vec_all_ge (ua, ub);
118 extern int ic; ic = vec_all_gt (ua, ub);
119 extern int id; id = vec_all_le (ua, ub);
120 extern int ie; ie = vec_all_lt (ua, ub);
121 extern int ig; ig = vec_all_ne (ua, ub);
123 extern int ih; ih = vec_any_eq (ua, ub);
124 extern int ii; ii = vec_any_ge (ua, ub);
125 extern int ij; ij = vec_any_gt (ua, ub);
126 extern int ik; ik = vec_any_le (ua, ub);
127 extern int il; il = vec_any_lt (ua, ub);
128 extern int im; im = vec_any_ne (ua, ub);
130 vector short ssa = {9, 16, 25, 36, 1, 2, 3, 4};
131 vector short ssb = {-8, -27, -64, -125, 2, 3, 5, 3};
132 extern vector short sscc; sscc = vec_and (ssa, ssb);
133 extern vector short sscd; sscd = vec_mergeh (ssa, ssb);
134 extern vector short ssce; ssce = vec_mergel (ssa, ssb);
136 vector int sia = {9, 16, 25, 36};
137 vector int sib = {-8, -27, -64, -125};
138 extern vector int sicc; sicc = vec_and (sia, sib);
139 extern vector int sicd; sicd = vec_andc (sia, sib);
140 extern vector int sig; sig = vec_mergel (sia, sib);
142 vector unsigned int uia = {9, 16, 25, 36};
143 vector unsigned int uib = {8, 27, 64, 125};
144 extern vector unsigned int uicc; uicc = vec_and (uia, uib);
145 extern vector unsigned int uidd; uidd = vec_andc (uia, uib);
146 extern vector unsigned int uig; uig = vec_mergel (uia, uib);
148 vector bool char bca = {0, 1, 4, 7};
149 vector bool char bcb = {-8, 9, 2, 9};
150 extern vector bool char bcc; bcc= vec_and (bca, bcb);
151 extern vector bool char bcd; bcd = vec_andc (bca, bcb);
152 extern vector bool char bce; bce = vec_mergel (bca, bcb);
154 vector bool short bsa = {0, -1, -1, 0, 3, 4, 6, 7};
155 vector bool short bsb = {-1, -1, 0, -1, 0, 0, 0, 0};
156 extern vector bool short bscc; bscc = vec_and (bsa, bsb);
157 extern vector bool short bscd; bscd = vec_andc (bsa, bsb);
158 extern vector bool short bsce; bsce = vec_mergel (bsa, bsb);
160 vector bool int bia = {0, -1, -1, 0};
161 vector bool int bib = {-1, -1, 0, -1};
162 extern vector bool int bicc; bicc = vec_and (bia, bib);
163 extern vector bool int bicd; bicd = vec_andc (bia, bib);
164 extern vector bool int bide; bide = vec_mergel (bia, bib);
166 extern vector unsigned int uie; uie = vec_packsu (ua, ub);
168 extern vector long long l2; l2 = vec_cntlz (la);
169 extern vector unsigned long long u2; u2 = vec_cntlz (ua);
170 extern vector int sie; sie = vec_cntlz (sia);
171 extern vector unsigned int uif; uif = vec_cntlz (uia);
172 extern vector short sszz; sszz = vec_cntlz (ssa);
174 vector unsigned short usa = {81, 72, 63, 54, 45, 36, 27, 18};
175 vector unsigned short usb = {81, 72, 63, 54, 45, 36, 27, 18};
176 extern vector unsigned short usd; usd = vec_and (usa, usb);
177 extern vector unsigned short use; use = vec_andc (usa, usb);
178 extern vector unsigned short usc; usc = vec_cntlz (usa);
179 extern vector unsigned short uscd; uscd = vec_mergeh (usa, usb);
180 extern vector unsigned short usce; usce = vec_mergel (usa, usb);
182 vector signed char sca = {-4, 3, -9, 15, -31, 31, 0, 0,
183 1, 117, -36, 99, 98, 97, 96, 95};
184 extern vector signed char scb; scb = vec_cntlz (sca);
185 extern vector signed char scc; scc = vec_mergel (sca, scb);
187 extern vector unsigned char cb; cb = vec_cntlz (ca);
189 extern vector double dd; dd = vec_xl (0, &y);
190 vec_xst (dd, 0, &z);
192 extern vector double dzz; dzz = vec_round (dd);
193 extern vector double dzz1; dzz1 = vec_rsqrt (dd);
194 extern vector double dzz2; dzz2 = vec_rsqrte (dd);
196 extern vector double dff; dff = vec_splat (de, 0);
197 extern vector double dgg; dgg = vec_splat (de, 1);
198 extern vector long long l3; l3 = vec_splat (l2, 0);
199 extern vector long long l4; l4 = vec_splat (l2, 1);
200 extern vector unsigned long long u3; u3 = vec_splat (u2, 0);
201 extern vector unsigned long long u4; u4 = vec_splat (u2, 1);
202 extern vector bool long long l5; l5 = vec_splat (ld, 0);
203 extern vector bool long long l6; l6 = vec_splat (ld, 1);
204 extern vector bool long long l10; l10 = vec_mergee (ld, ld);
205 extern vector bool long long l11; l11 = vec_mergeo (ld, ld);
207 extern vector long long l7; l7 = vec_div (l3, l4);
208 extern vector unsigned long long u5; u5 = vec_div (u3, u4);
209 extern vector long long l12; l12 = vec_mergee (la, lb);
210 extern vector long long l13; l13 = vec_mergeo (la, lb);
211 extern vector unsigned long long u8; u8 = vec_mergee (u3, u4);
212 extern vector unsigned long long u9; u9 = vec_mergeo (u3, u4);
214 extern vector long long l8; l8 = vec_mul (l3, l4);
215 extern vector unsigned long long u6; u6 = vec_mul (u3, u4);
217 extern vector double dh; dh = vec_ctf (la, -2);
218 extern vector double di; di = vec_ctf (ua, 2);
219 extern vector int sz; sz = vec_cts (fa, 0x1F);
220 extern vector long long l9; l9 = vec_cts (dh, -2);
221 extern vector unsigned long long u7; u7 = vec_ctu (di, 2);
222 extern vector unsigned int usz; usz = vec_ctu (fa, 0x1F);
224 extern vector float f1; f1 = vec_mergee (fa, fb);
225 extern vector float f2; f2 = vec_mergeo (fa, fb);
227 extern vector double d1; d1 = vec_mergee (da, db);
228 extern vector double d2; d2 = vec_mergeo (da, db);
230 return 0;