IBM Z: Fix usage of "f" constraint with long doubles
authorIlya Leoshkevich <iii@linux.ibm.com>
Thu, 10 Dec 2020 14:43:59 +0000 (15:43 +0100)
committerIlya Leoshkevich <iii@linux.ibm.com>
Mon, 8 Mar 2021 13:41:39 +0000 (14:41 +0100)
commit3cb8aab390ccf31e4581863b080db30c6735e51e
tree94ad54a15d2535fb4ebac9feee12414da40f4556
parent8a6a62614a8ae4544770420416d1632d6c3d3f6e
IBM Z: Fix usage of "f" constraint with long doubles

After switching the s390 backend to store long doubles in vector
registers, "f" constraint broke when used with the former: long doubles
correspond to TFmode, which in combination with "f" corresponds to
hard regs %v0-%v15, however, asm users expect a %f0-%f15 pair.

Fix by using TARGET_MD_ASM_ADJUST hook to convert TFmode values to
FPRX2mode and back.

gcc/ChangeLog:

2020-12-14  Ilya Leoshkevich  <iii@linux.ibm.com>

* config/s390/s390.c (f_constraint_p): New function.
(s390_md_asm_adjust): Implement TARGET_MD_ASM_ADJUST.
(TARGET_MD_ASM_ADJUST): Likewise.

gcc/testsuite/ChangeLog:

2020-12-14  Ilya Leoshkevich  <iii@linux.ibm.com>

* gcc.target/s390/vector/long-double-asm-commutative.c: New
test.
* gcc.target/s390/vector/long-double-asm-earlyclobber.c: New
test.
* gcc.target/s390/vector/long-double-asm-in-out.c: New test.
* gcc.target/s390/vector/long-double-asm-inout.c: New test.
* gcc.target/s390/vector/long-double-asm-matching.c: New test.
* gcc.target/s390/vector/long-double-asm-regmem.c: New test.
* gcc.target/s390/vector/long-double-volatile-from-i64.c: New
test.
gcc/config/s390/s390.c
gcc/testsuite/gcc.target/s390/vector/long-double-asm-commutative.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/vector/long-double-asm-earlyclobber.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/vector/long-double-asm-in-out.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/vector/long-double-asm-inout.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/vector/long-double-asm-matching.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/vector/long-double-asm-regmem.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/vector/long-double-volatile-from-i64.c [new file with mode: 0644]