| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */ |
| 3 |
/* { dg-do run { target { s390_z14_hw } } } */ |
| 4 |
#include <assert.h> |
| 5 |
#include <stdint.h> |
| 6 |
|
| 7 |
__attribute__ ((noipa)) static long double |
| 8 |
xsqrt (long double x) |
| 9 |
{ |
| 10 |
long double res; |
| 11 |
asm("sqxbr\t%0,%1" : "=f"(res) : "f"(x)); |
| 12 |
return res; |
| 13 |
} |
| 14 |
|
| 15 |
/* Check that the generated code is very small and straightforward. In |
| 16 |
particular, there must be no unnecessary copying and no stack frame. */ |
| 17 |
/* { dg-final { scan-assembler {\n\tld\t[^\n]*;ld\t[^\n]*\n(#[^\n]*\n)*\tsqxbr\t.*\n(#[^\n]*\n)*\tstd\t[^\n]*\n\tstd\t[^\n]*\n\tbr\t%r14\n} } } */ |
| 18 |
|
| 19 |
int |
| 20 |
main (void) |
| 21 |
{ |
| 22 |
long double res, x = 0x1.0000000000001p+0L, |
| 23 |
exp = 1.00000000000000011102230246251564788e+0L; |
| 24 |
res = xsqrt (x); |
| 25 |
assert (res == exp); |
| 26 |
} |