| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -mvsx" } */ |
| 3 |
/* { dg-require-effective-target powerpc_vsx } */ |
| 4 |
|
| 5 |
#include <altivec.h> |
| 6 |
vector float b = {0.0f, 0.0f, 0.0f, 0.0f}; |
| 7 |
|
| 8 |
|
| 9 |
vector float foo1 (vector float x) |
| 10 |
{ |
| 11 |
vector int c = {0, 1, 4, 5}; |
| 12 |
return __builtin_shuffle (x, b, c); |
| 13 |
} |
| 14 |
|
| 15 |
vector float foo2 (vector float x) |
| 16 |
{ |
| 17 |
vector int c = {2, 3, 4, 5}; |
| 18 |
return __builtin_shuffle (x, b, c); |
| 19 |
} |
| 20 |
|
| 21 |
vector float foo3 (vector float x) |
| 22 |
{ |
| 23 |
vector int c = {0, 1, 6, 7}; |
| 24 |
return __builtin_shuffle (x, b, c); |
| 25 |
} |
| 26 |
|
| 27 |
vector float foo4 (vector float x) |
| 28 |
{ |
| 29 |
vector int c = {2, 3, 6, 7}; |
| 30 |
return __builtin_shuffle (x, b, c); |
| 31 |
} |
| 32 |
|
| 33 |
vector unsigned char foo5 (vector unsigned char x) |
| 34 |
{ |
| 35 |
vector unsigned char c = {0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7}; |
| 36 |
return __builtin_shuffle (x, c); |
| 37 |
} |
| 38 |
|
| 39 |
vector unsigned char foo6 (vector unsigned char x) |
| 40 |
{ |
| 41 |
vector unsigned char c = {8, 9, 10, 11, 12, 13, 14, 15, 8, 9, 10, 11, 12, 13, 14, 15}; |
| 42 |
return __builtin_shuffle (x, c); |
| 43 |
} |
| 44 |
|
| 45 |
vector unsigned char foo7 (vector unsigned char x) |
| 46 |
{ |
| 47 |
vector unsigned char c = {8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7}; |
| 48 |
return __builtin_shuffle (x, c); |
| 49 |
} |
| 50 |
|
| 51 |
/* { dg-final { scan-assembler-times {\mxxpermdi\M} 7 { target has_arch_pwr9 } } } */ |
| 52 |
/* { dg-final { scan-assembler-times {\mxxpermdi\M} 7 { target { {! has_arch_pwr9} && be } } } } */ |
| 53 |
/* { dg-final { scan-assembler-times {\mxxpermdi\M} 11 { target { {! has_arch_pwr9} && le } } } } */ |