| 1 |
/* Verify that overloaded built-ins for vec_extract() with float |
| 2 |
inputs produce the right code with a P7 (BE) target. */ |
| 3 |
|
| 4 |
/* { dg-do compile } */ |
| 5 |
/* { dg-options "-mdejagnu-cpu=power7 -O2 " } */ |
| 6 |
/* { dg-require-effective-target powerpc_vsx } */ |
| 7 |
|
| 8 |
// targeting P7 (BE), 2 tests. |
| 9 |
// P7 constants: xscvspdp |
| 10 |
// P7 variables: li, addi, stxvd2x, rldic, addi, lfsx |
| 11 |
|
| 12 |
/* { dg-final { scan-assembler-times {\mxscvspdp\M} 1 } } */ |
| 13 |
/* { dg-final { scan-assembler-times {\mli\M} 1 } } */ |
| 14 |
/* -m32 as an add in place of an addi. */ |
| 15 |
/* { dg-final { scan-assembler-times {\maddi?\M} 2 } } */ |
| 16 |
/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstvx\M|\mstxv\M} 1 } } */ |
| 17 |
/* -m32 uses rlwinm in place of rldic */ |
| 18 |
/* { dg-final { scan-assembler-times {\mrldic\M|\mrlwinm\M} 1 } } */ |
| 19 |
/* -m32 has lfs in place of lfsx */ |
| 20 |
/* { dg-final { scan-assembler-times {\mlfsx?\M} 1 } } */ |
| 21 |
|
| 22 |
#include <altivec.h> |
| 23 |
|
| 24 |
float |
| 25 |
testf_var (vector float vf2, signed int si) |
| 26 |
{ |
| 27 |
return vec_extract (vf2, si); |
| 28 |
} |
| 29 |
|
| 30 |
float |
| 31 |
testf_cst (vector float vf2) |
| 32 |
{ |
| 33 |
return vec_extract (vf2, 12); |
| 34 |
} |
| 35 |
|