1/* Test that the compiler properly optimizes vector rotate instructions vector
2   into prot on XOP systems.  */
3
4/* { dg-do compile } */
5/* { dg-require-effective-target lp64 } */
6/* { dg-options "-O2 -mxop -ftree-vectorize" } */
7
8extern void exit (int);
9
10typedef long __m128i  __attribute__ ((__vector_size__ (16), __may_alias__));
11
12#define SIZE 10240
13
14union {
15  __m128i i_align;
16  unsigned u32[SIZE];
17} a, b, c;
18
19void
20vector_rotate32 (void)
21{
22  int i;
23
24  for (i = 0; i < SIZE; i++)
25    a.u32[i] = (b.u32[i] >> ((sizeof (int) * 8) - c.u32[i])) | (b.u32[i] << c.u32[i]);
26}
27
28int main ()
29{
30  vector_rotate32 ();
31  exit (0);
32}
33
34/* { dg-final { scan-assembler "vprotd" } } */
35