1 /* PR tree-optimization/71488 */
2 /* { dg-require-effective-target vect_int } */
3 /* { dg-require-effective-target vect_pack_trunc } */
4 /* { dg-additional-options "-msse4" { target sse4_runtime } } */
10 void __attribute__((noclone
,noinline
))
11 fn1 (int * __restrict__ p1
, int * __restrict__ p2
, int * __restrict__ p3
, int size
)
15 for (i
= 0; i
< size
; i
++)
16 p1
[i
] = ((p2
[i
] == 0) > (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
19 void __attribute__((noclone
,noinline
))
20 fn2 (int * __restrict__ p1
, int * __restrict__ p2
, short * __restrict__ p3
, int size
)
24 for (i
= 0; i
< size
; i
++)
25 p1
[i
] = ((p2
[i
] == 0) > (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
28 void __attribute__((noclone
,noinline
))
29 fn3 (int * __restrict__ p1
, int * __restrict__ p2
, long long * __restrict__ p3
, int size
)
33 for (i
= 0; i
< size
; i
++)
34 p1
[i
] = ((p2
[i
] == 0) > (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
37 void __attribute__((noclone
,noinline
))
38 fn4 (int * __restrict__ p1
, int * __restrict__ p2
, int * __restrict__ p3
, int size
)
42 for (i
= 0; i
< size
; i
++)
43 p1
[i
] = ((p2
[i
] == 0) >= (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
46 void __attribute__((noclone
,noinline
))
47 fn5 (int * __restrict__ p1
, int * __restrict__ p2
, short * __restrict__ p3
, int size
)
51 for (i
= 0; i
< size
; i
++)
52 p1
[i
] = ((p2
[i
] == 0) >= (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
55 void __attribute__((noclone
,noinline
))
56 fn6 (int * __restrict__ p1
, int * __restrict__ p2
, long long * __restrict__ p3
, int size
)
60 for (i
= 0; i
< size
; i
++)
61 p1
[i
] = ((p2
[i
] == 0) >= (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
64 void __attribute__((noclone
,noinline
))
65 fn7 (int * __restrict__ p1
, int * __restrict__ p2
, int * __restrict__ p3
, int size
)
69 for (i
= 0; i
< size
; i
++)
70 p1
[i
] = ((p2
[i
] == 0) < (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
73 void __attribute__((noclone
,noinline
))
74 fn8 (int * __restrict__ p1
, int * __restrict__ p2
, short * __restrict__ p3
, int size
)
78 for (i
= 0; i
< size
; i
++)
79 p1
[i
] = ((p2
[i
] == 0) < (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
82 void __attribute__((noclone
,noinline
))
83 fn9 (int * __restrict__ p1
, int * __restrict__ p2
, long long * __restrict__ p3
, int size
)
87 for (i
= 0; i
< size
; i
++)
88 p1
[i
] = ((p2
[i
] == 0) < (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
91 void __attribute__((noclone
,noinline
))
92 fn10 (int * __restrict__ p1
, int * __restrict__ p2
, int * __restrict__ p3
, int size
)
96 for (i
= 0; i
< size
; i
++)
97 p1
[i
] = ((p2
[i
] == 0) <= (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
100 void __attribute__((noclone
,noinline
))
101 fn11 (int * __restrict__ p1
, int * __restrict__ p2
, short * __restrict__ p3
, int size
)
105 for (i
= 0; i
< size
; i
++)
106 p1
[i
] = ((p2
[i
] == 0) <= (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
109 void __attribute__((noclone
,noinline
))
110 fn12 (int * __restrict__ p1
, int * __restrict__ p2
, long long * __restrict__ p3
, int size
)
114 for (i
= 0; i
< size
; i
++)
115 p1
[i
] = ((p2
[i
] == 0) <= (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
118 void __attribute__((noclone
,noinline
))
119 fn13 (int * __restrict__ p1
, int * __restrict__ p2
, int * __restrict__ p3
, int size
)
123 for (i
= 0; i
< size
; i
++)
124 p1
[i
] = ((p2
[i
] == 0) == (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
127 void __attribute__((noclone
,noinline
))
128 fn14 (int * __restrict__ p1
, int * __restrict__ p2
, short * __restrict__ p3
, int size
)
132 for (i
= 0; i
< size
; i
++)
133 p1
[i
] = ((p2
[i
] == 0) == (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
136 void __attribute__((noclone
,noinline
))
137 fn15 (int * __restrict__ p1
, int * __restrict__ p2
, long long * __restrict__ p3
, int size
)
141 for (i
= 0; i
< size
; i
++)
142 p1
[i
] = ((p2
[i
] == 0) == (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
145 void __attribute__((noclone
,noinline
))
146 fn16 (int * __restrict__ p1
, int * __restrict__ p2
, int * __restrict__ p3
, int size
)
150 for (i
= 0; i
< size
; i
++)
151 p1
[i
] = ((p2
[i
] == 0) != (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
154 void __attribute__((noclone
,noinline
))
155 fn17 (int * __restrict__ p1
, int * __restrict__ p2
, short * __restrict__ p3
, int size
)
159 for (i
= 0; i
< size
; i
++)
160 p1
[i
] = ((p2
[i
] == 0) != (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
163 void __attribute__((noclone
,noinline
))
164 fn18 (int * __restrict__ p1
, int * __restrict__ p2
, long long * __restrict__ p3
, int size
)
168 for (i
= 0; i
< size
; i
++)
169 p1
[i
] = ((p2
[i
] == 0) != (unsigned)(p3
[i
] == 0)) + (p2
[i
] == 0);
172 int eq (int i1
, int i2
) { return i1
== i2
; }
173 int ne (int i1
, int i2
) { return i1
!= i2
; }
174 int lt (int i1
, int i2
) { return i1
< i2
; }
175 int le (int i1
, int i2
) { return i1
<= i2
; }
176 int gt (int i1
, int i2
) { return i1
> i2
; }
177 int ge (int i1
, int i2
) { return i1
>= i2
; }
179 typedef int (*cmp_fn
)(int, int);
182 check (int *p
, cmp_fn fn
)
186 for (i
= 0; i
< 32; i
++)
188 int t1
= ((i
% 4) > 1) == 0;
189 int t2
= (i
% 2) == 0;
190 int res
= fn (t1
, t2
) + t1
;
197 main (int argc
, char **argv
)
199 int i1
[32], i2
[32], res
[32];
206 for (i
= 0; i
< 32; i
++)
208 l2
[i
] = i2
[i
] = s2
[i
] = i
% 2;
213 fn1 (res
, i1
, i2
, 32);
215 fn2 (res
, i1
, s2
, 32);
217 fn3 (res
, i1
, l2
, 32);
220 fn4 (res
, i1
, i2
, 32);
222 fn5 (res
, i1
, s2
, 32);
224 fn6 (res
, i1
, l2
, 32);
227 fn7 (res
, i1
, i2
, 32);
229 fn8 (res
, i1
, s2
, 32);
231 fn9 (res
, i1
, l2
, 32);
234 fn10 (res
, i1
, i2
, 32);
236 fn11 (res
, i1
, s2
, 32);
238 fn12 (res
, i1
, l2
, 32);
241 fn13 (res
, i1
, i2
, 32);
243 fn14 (res
, i1
, s2
, 32);
245 fn15 (res
, i1
, l2
, 32);
248 fn16 (res
, i1
, i2
, 32);
250 fn17 (res
, i1
, s2
, 32);
252 fn18 (res
, i1
, l2
, 32);
256 /* { dg-final { scan-tree-dump-times "VECTORIZED" 18 "vect" { target sse4_runtime } } } */