| 1 |
/* The goal is to have both compile tests which verify the desired instruction |
| 2 |
generation and to functionally test the builtins for correctness. This is |
| 3 |
done in separate test files, vsx-vector-6-func-1op.c and |
| 4 |
vsx-vector-6-func-1op-run.c. The vsx-vector-6-func-1op.c test file only |
| 5 |
generates the calls so the instruction counts do not include the counts |
| 6 |
of the instructions generated as part of the result testing. The result |
| 7 |
checking code differs for BE/LE. */ |
| 8 |
|
| 9 |
#include <altivec.h> |
| 10 |
#include <stdio.h> |
| 11 |
#include <stdlib.h> |
| 12 |
|
| 13 |
void abort (void); |
| 14 |
|
| 15 |
#define FLOAT_TEST(NAME) \ |
| 16 |
vector float __attribute__ ((noipa)) \ |
| 17 |
float_##NAME (vector float f_src) \ |
| 18 |
{ \ |
| 19 |
return vec_##NAME(f_src); \ |
| 20 |
} |
| 21 |
|
| 22 |
FLOAT_TEST (abs) |
| 23 |
FLOAT_TEST (ceil) |
| 24 |
FLOAT_TEST (floor) |
| 25 |
FLOAT_TEST (nearbyint) |
| 26 |
FLOAT_TEST (rint) |
| 27 |
FLOAT_TEST (trunc) |
| 28 |
|
| 29 |
#define DOUBLE_TEST(NAME) \ |
| 30 |
vector double __attribute__ ((noipa)) \ |
| 31 |
double_##NAME (vector double d_src) \ |
| 32 |
{ \ |
| 33 |
return vec_##NAME(d_src); \ |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
DOUBLE_TEST (abs) |
| 38 |
DOUBLE_TEST (ceil) |
| 39 |
DOUBLE_TEST (floor) |
| 40 |
DOUBLE_TEST (nearbyint) |
| 41 |
DOUBLE_TEST (rint) |
| 42 |
DOUBLE_TEST (trunc) |
| 43 |
DOUBLE_TEST (sqrt) |