| 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-2lop.c and |
| 4 |
vsx-vector-6-func-2lop-run.c. The vsx-vector-6-func-2lop.c test file only |
| 5 |
generates the calls so the instruction counts do not include the counts of |
| 6 |
the instructions generated as part of the result testing. The result |
| 7 |
checking code differs for BE/LE. */ |
| 8 |
|
| 9 |
|
| 10 |
#include <altivec.h> |
| 11 |
#include <stdio.h> |
| 12 |
#include <stdlib.h> |
| 13 |
|
| 14 |
union conv_t { |
| 15 |
vector float f; |
| 16 |
vector unsigned int u; |
| 17 |
vector double d; |
| 18 |
vector unsigned long ul; |
| 19 |
} conv_result, conv_exp, conv_src_a, conv_src_b; |
| 20 |
|
| 21 |
void abort (void); |
| 22 |
|
| 23 |
#define FLOAT_TEST(NAME) \ |
| 24 |
vector float __attribute__ ((noipa)) \ |
| 25 |
float_##NAME (vector float f_src_a, vector float f_src_b) \ |
| 26 |
{ \ |
| 27 |
return vec_##NAME (f_src_a, f_src_b); \ |
| 28 |
} |
| 29 |
|
| 30 |
FLOAT_TEST (and) |
| 31 |
FLOAT_TEST (andc) |
| 32 |
FLOAT_TEST (nor) |
| 33 |
FLOAT_TEST (or) |
| 34 |
FLOAT_TEST (xor) |
| 35 |
|
| 36 |
#define DOUBLE_TEST(NAME) \ |
| 37 |
vector double __attribute__ ((noipa)) \ |
| 38 |
double_##NAME (vector double d_src_a, vector double d_src_b) \ |
| 39 |
{ \ |
| 40 |
return vec_##NAME (d_src_a, d_src_b); \ |
| 41 |
} |
| 42 |
|
| 43 |
DOUBLE_TEST (and) |
| 44 |
DOUBLE_TEST (andc) |
| 45 |
DOUBLE_TEST (nor) |
| 46 |
DOUBLE_TEST (or) |
| 47 |
DOUBLE_TEST (xor) |