diff options
author | Kaz Kojima <kkojima@gcc.gnu.org> | 2011-06-02 22:26:42 +0000 |
---|---|---|
committer | Kaz Kojima <kkojima@gcc.gnu.org> | 2011-06-02 22:26:42 +0000 |
commit | a700b5f073c45564f513ff035b2c0d5fb0edfaa0 (patch) | |
tree | 4d23397d21aeaa5440d07cc7bdf414f59f96eea0 | |
parent | 76015c34a97c58e6e6fb058f8d34a5be56d3a713 (diff) | |
download | gcc-a700b5f073c45564f513ff035b2c0d5fb0edfaa0.zip gcc-a700b5f073c45564f513ff035b2c0d5fb0edfaa0.tar.gz gcc-a700b5f073c45564f513ff035b2c0d5fb0edfaa0.tar.bz2 |
predicates.md (general_movsrc_operand): Return 0 for memory and memory subreg of which address is an invalid indexed...
* config/sh/predicates.md (general_movsrc_operand): Return 0
for memory and memory subreg of which address is an invalid
indexed address for QI and HImode.
(general_movdst_operand): Likewise.
* gcc.c-torture/compile/pr49163.c: New.
From-SVN: r174586
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/sh/predicates.md | 24 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr49163.c | 35 |
4 files changed, 72 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4533f58..a6fd4de 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2011-06-02 Kaz Kojima <kkojima@gcc.gnu.org> + + PR target/49163 + * config/sh/predicates.md (general_movsrc_operand): Return 0 + for memory and memory subreg of which address is an invalid + indexed address for QI and HImode. + (general_movdst_operand): Likewise. + 2011-06-02 Eric Botcazou <ebotcazou@adacore.com> * cse.c (cse_find_path): Refine change to exclude EDGE_ABNORMAL_CALL diff --git a/gcc/config/sh/predicates.md b/gcc/config/sh/predicates.md index b6508b7..2035458 100644 --- a/gcc/config/sh/predicates.md +++ b/gcc/config/sh/predicates.md @@ -394,6 +394,18 @@ return 0; } + if ((mode == QImode || mode == HImode) + && (MEM_P (op) + || (GET_CODE (op) == SUBREG && MEM_P (SUBREG_REG (op))))) + { + rtx x = XEXP ((MEM_P (op) ? op : SUBREG_REG (op)), 0); + + if (GET_CODE (x) == PLUS + && REG_P (XEXP (x, 0)) + && CONST_INT_P (XEXP (x, 1))) + return sh_legitimate_index_p (mode, XEXP (x, 1)); + } + if (TARGET_SHMEDIA && (GET_CODE (op) == PARALLEL || GET_CODE (op) == CONST_VECTOR) && sh_rep_vec (op, mode)) @@ -419,6 +431,18 @@ && ! (high_life_started || reload_completed)) return 0; + if ((mode == QImode || mode == HImode) + && (MEM_P (op) + || (GET_CODE (op) == SUBREG && MEM_P (SUBREG_REG (op))))) + { + rtx x = XEXP ((MEM_P (op) ? op : SUBREG_REG (op)), 0); + + if (GET_CODE (x) == PLUS + && REG_P (XEXP (x, 0)) + && CONST_INT_P (XEXP (x, 1))) + return sh_legitimate_index_p (mode, XEXP (x, 1)); + } + return general_operand (op, mode); }) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 135087c..7c9adb1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-06-02 Kaz Kojima <kkojima@gcc.gnu.org> + + PR target/49163 + * gcc.c-torture/compile/pr49163.c: New. + 2011-06-02 Asher Langton <langton2@llnl.gov> PR fortran/49268 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr49163.c b/gcc/testsuite/gcc.c-torture/compile/pr49163.c new file mode 100644 index 0000000..f14ab15 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr49163.c @@ -0,0 +1,35 @@ +/* PR target/49163 */ +struct S1 +{ + unsigned f0:18; + int f1; +} __attribute__ ((packed)); + +struct S2 +{ + volatile long long f0; + int f1; +}; + +struct S1 s1; +struct S2 s2; +const struct S2 s2array[2][1] = { }; + +struct S2 **sptr; + +extern int bar (char a, long long b, int * c, long long d, long long e); +extern int baz (void); + +int i; +int *ptr; + +void +foo (int *arg) +{ + for (i = 0; i < 1; i = baz()) + { + *arg = *(int *)sptr; + *ptr = bar (*arg, s2.f1, ptr, + bar (s2array[1][0].f0, *arg, ptr, s1.f1, *ptr), *arg); + } +} |