| 1 |
#ifndef AUTOVEC_H |
| 2 |
#define AUTOVEC_H 1 |
| 3 |
|
| 4 |
#define QUIET_EQ(x, y) ((x) == (y)) |
| 5 |
#define QUIET_GE __builtin_isgreaterequal |
| 6 |
#define QUIET_GT __builtin_isgreater |
| 7 |
#define QUIET_LE __builtin_islessequal |
| 8 |
#define QUIET_LT __builtin_isless |
| 9 |
#define QUIET_ORDERED(x, y) (!__builtin_isunordered ((x), (y))) |
| 10 |
#define QUIET_UNEQ(x, y) (__builtin_isless ((x), (y)) \ |
| 11 |
|| __builtin_isgreater ((x), (y))) |
| 12 |
#define QUIET_UNORDERED __builtin_isunordered |
| 13 |
#define SIGNALING_EQ(x, y) (((x) <= (y)) && ((x) >= (y))) |
| 14 |
#define SIGNALING_GE(x, y) ((x) >= (y)) |
| 15 |
#define SIGNALING_GT(x, y) ((x) > (y)) |
| 16 |
#define SIGNALING_LE(x, y) ((x) <= (y)) |
| 17 |
#define SIGNALING_LT(x, y) ((x) < (y)) |
| 18 |
#define SIGNALING_LTGT(x, y) (((x) < (y)) || ((x) > (y))) |
| 19 |
|
| 20 |
#define AUTOVEC(RESULT_TYPE, OP_TYPE, OP) void \ |
| 21 |
f (RESULT_TYPE *r, const OP_TYPE *x, const OP_TYPE *y) \ |
| 22 |
{ \ |
| 23 |
int i; \ |
| 24 |
\ |
| 25 |
for (i = 0; i < 1000000; i++) \ |
| 26 |
{ \ |
| 27 |
OP_TYPE xi = x[i], yi = y[i]; \ |
| 28 |
\ |
| 29 |
r[i] = OP (xi, yi); \ |
| 30 |
} \ |
| 31 |
} |
| 32 |
|
| 33 |
#define AUTOVEC_DOUBLE(OP) AUTOVEC (long long, double, OP) |
| 34 |
|
| 35 |
#define AUTOVEC_FLOAT(OP) AUTOVEC (int, float, OP) |
| 36 |
|
| 37 |
#ifdef __SIZEOF_INT128__ |
| 38 |
typedef __int128 v1ti __attribute__ ((vector_size (16))); |
| 39 |
typedef long double v1tf __attribute__ ((vector_size (16))); |
| 40 |
#define AUTOVEC_LONG_DOUBLE(OP) AUTOVEC (v1ti, v1tf, OP) |
| 41 |
#endif |
| 42 |
|
| 43 |
#endif |