| 1 |
/* { dg-options "-Ofast -mlow-precision-sqrt" } */ |
| 2 |
|
| 3 |
#define DEF_LOOP(TYPE, FN) \ |
| 4 |
void \ |
| 5 |
test_##TYPE (TYPE *x, int n) \ |
| 6 |
{ \ |
| 7 |
for (int i = 0; i < n; ++i) \ |
| 8 |
x[i] = (TYPE) 1 / FN (x[i]); \ |
| 9 |
} |
| 10 |
|
| 11 |
#define TEST_ALL(T) \ |
| 12 |
T (_Float16, __builtin_sqrtf16) \ |
| 13 |
T (float, __builtin_sqrtf) \ |
| 14 |
T (double, __builtin_sqrt) |
| 15 |
|
| 16 |
TEST_ALL (DEF_LOOP) |
| 17 |
|
| 18 |
/* { dg-final { scan-assembler-not {\tfrsqrte\tz[0-9]+\.h} } } */ |
| 19 |
/* { dg-final { scan-assembler-not {\tfrsqrts\tz[0-9]+\.h} } } */ |
| 20 |
|
| 21 |
/* { dg-final { scan-assembler-times {\tfmul\tz[0-9]+\.s} 2 } } */ |
| 22 |
/* { dg-final { scan-assembler-times {\tfrsqrte\tz[0-9]+\.s} 1 } } */ |
| 23 |
/* { dg-final { scan-assembler-times {\tfrsqrts\tz[0-9]+\.s} 1 } } */ |
| 24 |
|
| 25 |
/* { dg-final { scan-assembler-times {\tfmul\tz[0-9]+\.d} 4 } } */ |
| 26 |
/* { dg-final { scan-assembler-times {\tfrsqrte\tz[0-9]+\.d} 1 } } */ |
| 27 |
/* { dg-final { scan-assembler-times {\tfrsqrts\tz[0-9]+\.d} 2 } } */ |