| 1 |
/* Verify that overloaded built-ins for vec_extract() with float |
| 2 |
inputs produce the right code with a P8 (LE or BE) target. */ |
| 3 |
|
| 4 |
/* { dg-do compile } */ |
| 5 |
/* { dg-options "-mdejagnu-cpu=power8 -mvsx -O2" } */ |
| 6 |
/* { dg-require-effective-target powerpc_vsx } */ |
| 7 |
|
| 8 |
// targeting P8, BE and LE. 2 tests. |
| 9 |
// P8 (LE) constants: xxsldwi, xscvspdp |
| 10 |
// P8 (LE) variables: rldicl, subfic, sldi, mtvsrd, xxpermdi, vslo, xscvspdp |
| 11 |
// P8 (BE) constants: xscvspdp |
| 12 |
// P8 (BE) variables: sldi, mtvsrd, xxpermdi, vslo, xscvspdp |
| 13 |
|
| 14 |
/* { dg-final { scan-assembler-times {\mxxsldwi\M} 1 { target { le } } } } */ |
| 15 |
/* { dg-final { scan-assembler-times {\mxscvspdp\M} 2 { target lp64 } } } */ |
| 16 |
/* { dg-final { scan-assembler-times {\mrldicl\M} 1 { target { le } } } } */ |
| 17 |
/* { dg-final { scan-assembler-times {\msubfic\M} 1 { target { le } } } } */ |
| 18 |
/* { dg-final { scan-assembler-times {\msldi\M} 1 { target lp64 } } } */ |
| 19 |
/* { dg-final { scan-assembler-times {\mmtvsrd\M} 1 { target lp64 } } } */ |
| 20 |
/* { dg-final { scan-assembler-times {\mxxpermdi\M} 1 { target lp64 } } } */ |
| 21 |
/* { dg-final { scan-assembler-times {\mvslo\M} 1 { target lp64 } } } */ |
| 22 |
|
| 23 |
/* { dg-final { scan-assembler-times {\mxscvspdp\M} 1 { target ilp32 } } } */ |
| 24 |
/* { dg-final { scan-assembler-times {\mli\M} 1 { target ilp32 } } } */ |
| 25 |
/* { dg-final { scan-assembler-times {\mrlwinm\M} 1 { target ilp32 } } } */ |
| 26 |
/* { dg-final { scan-assembler-times {\mstxvd2x\M} 1 { target ilp32 } } } */ |
| 27 |
/* { dg-final { scan-assembler-times {\mlfs\M} 1 { target ilp32 } } } */ |
| 28 |
/* { dg-final { scan-assembler-times {\maddi?\M} 2 { target ilp32 } } } */ |
| 29 |
|
| 30 |
|
| 31 |
#include <altivec.h> |
| 32 |
|
| 33 |
float |
| 34 |
testf_var (vector float vf2, signed int si) |
| 35 |
{ |
| 36 |
return vec_extract (vf2, si); |
| 37 |
} |
| 38 |
|
| 39 |
float |
| 40 |
testf_cst (vector float vf2) |
| 41 |
{ |
| 42 |
return vec_extract (vf2, 12); |
| 43 |
} |
| 44 |
|