| 1 |
/* PR86731. Verify that the rs6000 gimple-folding code handles the |
| 2 |
left shift operation properly. This is a testcase variation that |
| 3 |
explicitly specifies -fwrapv, which is a condition for the |
| 4 |
gimple folding of the vec_sl() intrinsic. */ |
| 5 |
|
| 6 |
/* specify -mcpu=power8 -mvsx, which provides vec_sl(long long,...) support. */ |
| 7 |
|
| 8 |
/* { dg-do compile } */ |
| 9 |
/* { dg-options "-maltivec -O3 -fwrapv -mvsx " } */ |
| 10 |
/* { dg-additional-options "-mdejagnu-cpu=power8" { target { ! has_arch_pwr8 } } } */ |
| 11 |
/* { dg-require-effective-target powerpc_vsx } */ |
| 12 |
/* { dg-require-effective-target lp64 } */ |
| 13 |
|
| 14 |
#include <altivec.h> |
| 15 |
|
| 16 |
vector unsigned long long splatu4(void) |
| 17 |
{ |
| 18 |
vector unsigned long long mzero = {-1,-1}; |
| 19 |
return (vector unsigned long long) vec_sl(mzero, mzero); |
| 20 |
} |
| 21 |
|
| 22 |
vector signed long long splats4(void) |
| 23 |
{ |
| 24 |
vector unsigned long long mzero = {-1,-1}; |
| 25 |
return (vector signed long long) vec_sl(mzero, mzero); |
| 26 |
} |
| 27 |
|
| 28 |
/* Codegen will consist of splat and shift instructions for most types. If |
| 29 |
folding is enabled, the vec_sl tests using vector long long type will |
| 30 |
generate a lvx instead of a vspltisw+vsld pair. On power10, it will |
| 31 |
generate a xxspltidp instruction instead of the lvx. */ |
| 32 |
|
| 33 |
/* { dg-final { scan-assembler-times {\mvspltis[bhw]\M} 0 } } */ |
| 34 |
/* { dg-final { scan-assembler-times {\mvsl[bhwd]\M} 0 } } */ |
| 35 |
/* { dg-final { scan-assembler-times {\mp?lxv\M|\mlvx\M|\mlxvd2x\M|\mxxspltidp\M} 2 } } */ |
| 36 |
|