From 1907712374ed4ab9ce8446916508fd0bafba971d Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Thu, 22 Sep 2011 18:54:34 +0000 Subject: [PATCH] reload.c (find_reloads): Set operand_mode to Pmode for address operands consisting of just a CONST_INT. 2011-09-22 Andreas Krebbel * reload.c (find_reloads): Set operand_mode to Pmode for address operands consisting of just a CONST_INT. From-SVN: r179099 --- gcc/ChangeLog | 5 ++ gcc/reload.c | 7 ++ .../gcc.target/s390/addr-constraints-1.c | 70 +++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 gcc/testsuite/gcc.target/s390/addr-constraints-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a0c8b075ec3..da3374b3940 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-09-22 Andreas Krebbel + + * reload.c (find_reloads): Set operand_mode to Pmode for address + operands consisting of just a CONST_INT. + 2011-09-22 Uros Bizjak PR target/50482 diff --git a/gcc/reload.c b/gcc/reload.c index c671765ba93..53dcd2dafed 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -2825,6 +2825,13 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, /* Address operands are reloaded in their existing mode, no matter what is specified in the machine description. */ operand_mode[i] = GET_MODE (recog_data.operand[i]); + + /* If the address is a single CONST_INT pick address mode + instead otherwise we will later not know in which mode + the reload should be performed. */ + if (operand_mode[i] == VOIDmode) + operand_mode[i] = Pmode; + } else if (code == MEM) { diff --git a/gcc/testsuite/gcc.target/s390/addr-constraints-1.c b/gcc/testsuite/gcc.target/s390/addr-constraints-1.c new file mode 100644 index 00000000000..fbb48f282b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/addr-constraints-1.c @@ -0,0 +1,70 @@ +/* { dg-compile } */ +/* { dg-options "-O2" } */ + +static inline unsigned long +lay_uw(unsigned long addr) +{ + unsigned long result; + + __asm__ ("lay %[result],%a[addr]" + : [result] "=d" (result) + : [addr] "UW" (addr)); + return result; +} + +static inline unsigned long +la_u(unsigned long addr) +{ + unsigned long result; + + __asm__ ("la %[result],%a[addr]" + : [result] "=d" (result) + : [addr] "U" (addr)); + return result; +} + +static inline unsigned long +lay_zqzrzszt(unsigned long addr) +{ + unsigned long result; + + __asm__ ("lay %[result],%a[addr]" + : [result] "=d" (result) + : [addr] "ZQZRZSZT" (addr)); + return result; +} + +static inline unsigned long +la_zqzr(unsigned long addr) +{ + unsigned long result; + + __asm__ ("la %[result],%a[addr]" + : [result] "=d" (result) + : [addr] "ZQZR" (addr)); + return result; +} + + +extern unsigned long a[15]; + +int main(void) +{ + a[1] = lay_uw(3333); + a[2] = lay_uw(4444); + a[3] = lay_uw(1000000); + a[4] = lay_uw(a[0]); + + a[5] = la_u(2222); + a[6] = la_u(5555); + a[7] = la_u(a[0]); + + a[8] = lay_zqzrzszt(3333); + a[9] = lay_zqzrzszt(4444); + a[10] = lay_zqzrzszt(1000000); + a[11] = lay_zqzrzszt(a[0]); + + a[12] = la_zqzr(2222); + a[13] = la_zqzr(5555); + a[14] = la_zqzr(a[0]); +} -- 2.30.2