Debian Codegraph @

gcc/testsuite/gcc.target/s390/vector/long-double-asm-inout-hard-fp-reg.c

raw
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 sqxbr (long double x)
9 {
10 register long double inout asm("f4") = x;
11
12 asm("sqxbr\t%0,%0" : "+f"(inout));
13 asm("# %0" : "+f"(inout));
14
15 return inout;
16 }
17
18 /* Ideally there should be just one `vmrlg %v6,%v4,%v6`, but the compiler
19 * can't optimize it away, because the UNSPEC pattern operates on the whole
20 * register. Using the SUBREG pattern solves this problem, but it's fragile.
21 */
22 /* { dg-final { scan-assembler-times {\n\tvmrlg\t%v6,%v4,%v6\n} 2 } } */
23 /* { dg-final { scan-assembler-times {\n\tvmrhg\t%v4,%v4,%v6\n} 2 } } */
24
25 int
26 main (void)
27 {
28 long double x = 0x1.0000000000001p+0L,
29 exp = 1.00000000000000011102230246251564788e+0L;
30 assert (sqxbr (x) == exp);
31 }