| 1 |
/* { dg-do run { target powerpc64*-*-* } } */ |
| 2 |
/* { dg-require-effective-target p8vector_hw } */ |
| 3 |
/* { dg-skip-if "" { powerpc*-*-darwin* } } */ |
| 4 |
/* { dg-options "-mdejagnu-cpu=power8" } */ |
| 5 |
|
| 6 |
#include <stdlib.h> |
| 7 |
#include <stdio.h> |
| 8 |
#include <altivec.h> |
| 9 |
|
| 10 |
static int failed; |
| 11 |
static void test (void); |
| 12 |
|
| 13 |
static void check (int result, const char *name) |
| 14 |
{ |
| 15 |
if (!result) |
| 16 |
{ |
| 17 |
failed++; |
| 18 |
printf ("fail %s\n", name); |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
int main (void) |
| 23 |
{ |
| 24 |
test (); |
| 25 |
if (failed) |
| 26 |
abort (); |
| 27 |
return 0; |
| 28 |
} |
| 29 |
|
| 30 |
vector double x = { 81.0, 76.0 }; |
| 31 |
vector long long y = { 81, 76 }; |
| 32 |
|
| 33 |
static void test() |
| 34 |
{ |
| 35 |
vector long long a = vec_cts (x, 0); |
| 36 |
vector double b = vec_ctf (a, 0); |
| 37 |
vector long long c = __builtin_vsx_xvcvdpuxds_scale (x, 0); |
| 38 |
vector double d = vec_ctf (c, 0); |
| 39 |
check (vec_all_eq (a, y), "vec_cts"); |
| 40 |
check (vec_all_eq (b, x), "vec_ctf"); |
| 41 |
check (vec_all_eq (c, y), "xvcvdpuxds"); |
| 42 |
check (vec_all_eq (d, x), "vec_ctf unsigned"); |
| 43 |
} |