| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-maltivec" } */ |
| 3 |
/* { dg-require-effective-target powerpc_altivec } */ |
| 4 |
|
| 5 |
/* Basic test for the new VMX intrinsics. */ |
| 6 |
#include <altivec.h> |
| 7 |
|
| 8 |
int f(vector int a, int b) |
| 9 |
{ |
| 10 |
return vec_extract (a, b); |
| 11 |
} |
| 12 |
short f1(vector short a, int b) |
| 13 |
{ |
| 14 |
return vec_extract (a, b); |
| 15 |
} |
| 16 |
vector short f2(vector short a, int b) |
| 17 |
{ |
| 18 |
return vec_insert (b, a, b); |
| 19 |
} |
| 20 |
vector float f3(vector float a, int b) |
| 21 |
{ |
| 22 |
return vec_insert (b, a, b); |
| 23 |
} |
| 24 |
|
| 25 |
float g(void); |
| 26 |
|
| 27 |
vector float f4(float b, int t) |
| 28 |
{ |
| 29 |
return vec_promote (g(), t); |
| 30 |
} |
| 31 |
vector float f5(float b) |
| 32 |
{ |
| 33 |
return vec_splats (g()); |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
template <int> |
| 40 |
int tf(vector int a, int b) |
| 41 |
{ |
| 42 |
return vec_extract (a, b); |
| 43 |
} |
| 44 |
template <int> |
| 45 |
short tf1(vector short a, int b) |
| 46 |
{ |
| 47 |
return vec_extract (a, b); |
| 48 |
} |
| 49 |
template <int> |
| 50 |
vector short tf2(vector short a, int b) |
| 51 |
{ |
| 52 |
return vec_insert (b, a, b); |
| 53 |
} |
| 54 |
template <int> |
| 55 |
vector float tf3(vector float a, int b) |
| 56 |
{ |
| 57 |
return vec_insert (b, a, b); |
| 58 |
} |
| 59 |
|
| 60 |
template <int> |
| 61 |
vector float tf4(float b, int t) |
| 62 |
{ |
| 63 |
return vec_promote (g(), t); |
| 64 |
} |
| 65 |
template <int> |
| 66 |
vector float tf5(float b) |
| 67 |
{ |
| 68 |
return vec_splats (g()); |
| 69 |
} |
| 70 |
|
| 71 |
int t(vector int a, int b) |
| 72 |
{ |
| 73 |
return tf<1>(a, b); |
| 74 |
} |
| 75 |
short t1(vector short a, int b) |
| 76 |
{ |
| 77 |
return tf1<1>(a, b); |
| 78 |
} |
| 79 |
vector short t2(vector short a, int b) |
| 80 |
{ |
| 81 |
return tf2<1>(a, b); |
| 82 |
} |
| 83 |
vector float t3(vector float a, int b) |
| 84 |
{ |
| 85 |
return tf3<1>(a, b); |
| 86 |
} |
| 87 |
vector float t4(float b, int t) |
| 88 |
{ |
| 89 |
return tf4<1>(b, t); |
| 90 |
} |
| 91 |
vector float t5(float b) |
| 92 |
{ |
| 93 |
return tf5<1>(b); |
| 94 |
} |