| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-mdejagnu-cpu=power9 -maltivec -O2" } */ |
| 3 |
/* { dg-require-effective-target powerpc_vsx } */ |
| 4 |
/* { dg-require-effective-target lp64 } */ |
| 5 |
|
| 6 |
/* Ensure that if we set a pragma gcc target for an |
| 7 |
older processor, we do not compile builtins that |
| 8 |
the older target does not support. */ |
| 9 |
|
| 10 |
#include <altivec.h> |
| 11 |
|
| 12 |
vector bool int |
| 13 |
test1 (vector signed int a, vector signed int b) |
| 14 |
{ |
| 15 |
return vec_cmpnez (a, b); |
| 16 |
} |
| 17 |
|
| 18 |
#pragma GCC target ("cpu=power8") |
| 19 |
vector bool int |
| 20 |
test2 (vector signed int a, vector signed int b) |
| 21 |
{ |
| 22 |
return vec_cmpnez (a, b); |
| 23 |
/* { dg-error "'__builtin_altivec_vcmpnezw' requires the '-mcpu=power9' and '-mvsx' options" "" { target *-*-* } .-1 } */ |
| 24 |
} |
| 25 |
|
| 26 |
#pragma GCC target ("cpu=power7") |
| 27 |
vector signed int |
| 28 |
test3 (vector signed int a, vector signed int b) |
| 29 |
{ |
| 30 |
return vec_mergee (a, b); |
| 31 |
/* { dg-error "'__builtin_altivec_vmrgew_v4si' requires the '-mcpu=power8' and '-mvsx' options" "" { target *-*-* } .-1 } */ |
| 32 |
} |
| 33 |
|
| 34 |
#pragma GCC target ("cpu=power6") |
| 35 |
vector signed int |
| 36 |
test4 (vector int a, vector int b) |
| 37 |
{ |
| 38 |
return vec_sldw (a, b, 2); |
| 39 |
/* { dg-error "'__builtin_vsx_xxsldwi_4si' requires the '-mvsx' option" "" { target *-*-* } .-1 } */ |
| 40 |
} |
| 41 |
|
| 42 |
vector int |
| 43 |
test5 (vector int a, vector int b) |
| 44 |
{ |
| 45 |
return vec_add (a, b); |
| 46 |
} |
| 47 |
|