1 /* { dg-require-effective-target vect_int } */
7 #define N (VECTOR_BITS * 6 / 16)
12 void __attribute__((noinline
))
13 foo (unsigned short *__restrict__ pInput
, unsigned short *__restrict__ pOutput
)
15 unsigned short i
, a
, b
, c
;
17 for (i
= 0; i
< N
/ 3; i
++)
23 *pOutput
++ = a
+ b
+ c
+ 3;
24 *pOutput
++ = a
+ b
+ c
+ 12;
25 *pOutput
++ = a
+ b
+ c
+ 1;
29 int main (int argc
, const char* argv
[])
31 unsigned short input
[N
], output
[N
], i
;
32 unsigned short check_results
[N
];
36 for (i
= 0; i
< N
; i
++)
40 asm volatile ("" ::: "memory");
43 for (i
= 0; i
< N
/ 3; i
++)
45 check_results
[3*i
] = 9 * i
+ 6;
46 check_results
[3*i
+1] = 9 * i
+ 15;
47 check_results
[3*i
+2] = 9 * i
+ 4;
48 __asm__
volatile ("" : : : "memory");
53 for (i
= 0; i
< N
- (N
% 3); i
++)
54 if (output
[i
] != check_results
[i
])
60 /* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect" { target { ! { vect_perm_short || vect_load_lanes } } } } } */
61 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_perm_short || vect_load_lanes } } } } */
62 /* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 1 "vect" { target { vect_perm_short && { ! vect_perm3_short } } } } } */
63 /* { dg-final { scan-tree-dump-not "permutation requires at least three vectors" "vect" { target vect_perm3_short } } } */
64 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { { ! vect_perm3_short } || vect_load_lanes } } } } */
65 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_short && { ! vect_load_lanes } } } } } */