From 1abcd5eb462c4f64c4902b7208c5818094fcd9aa Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Fri, 11 Jan 2013 16:43:49 +0000 Subject: [PATCH] re PR rtl-optimization/55719 (ICE: Segmentation fault) 2013-01-11 Andreas Krebbel PR target/55719 * config/s390/s390.c (s390_preferred_reload_class): Do not return NO_REGS for larl operands. (s390_reload_larl_operand): Use s390_load_address instead of emit_move_insn. 2013-01-11 Andreas Krebbel PR target/55719 * gcc.target/s390/pr55719.c: New testcase. From-SVN: r195109 --- gcc/ChangeLog | 8 ++++++++ gcc/config/s390/s390.c | 18 ++++++++++++++++-- gcc/testsuite/ChangeLog | 7 ++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ea6987d4a2b..238ec2f4b1d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-01-11 Andreas Krebbel + + PR target/55719 + * config/s390/s390.c (s390_preferred_reload_class): Do not return + NO_REGS for larl operands. + (s390_reload_larl_operand): Use s390_load_address instead of + emit_move_insn. + 2013-01-11 Richard Biener * tree-cfg.c (verify_node_sharing_1): Split out from ... diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 621f1bc4490..7e87dcd547d 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -2978,9 +2978,23 @@ s390_preferred_reload_class (rtx op, reg_class_t rclass) it is most likely being used as an address, so prefer ADDR_REGS. If 'class' is not a superset of ADDR_REGS, e.g. FP_REGS, reject this reload. */ + case CONST: + /* A larl operand with odd addend will get fixed via secondary + reload. So don't request it to be pushed into literal + pool. */ + if (TARGET_CPU_ZARCH + && GET_CODE (XEXP (op, 0)) == PLUS + && GET_CODE (XEXP (XEXP(op, 0), 0)) == SYMBOL_REF + && GET_CODE (XEXP (XEXP(op, 0), 1)) == CONST_INT) + { + if (reg_class_subset_p (ADDR_REGS, rclass)) + return ADDR_REGS; + else + return NO_REGS; + } + /* fallthrough */ case LABEL_REF: case SYMBOL_REF: - case CONST: if (!legitimate_reload_constant_p (op)) return NO_REGS; /* fallthrough */ @@ -3061,7 +3075,7 @@ s390_reload_larl_operand (rtx reg, rtx addr, rtx scratch) emit_move_insn (scratch, symref); /* Increment the address using la in order to avoid clobbering cc. */ - emit_move_insn (reg, gen_rtx_PLUS (Pmode, scratch, const1_rtx)); + s390_load_address (reg, gen_rtx_PLUS (Pmode, scratch, const1_rtx)); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index df0378f1d12..2d463399120 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,9 @@ -2012-01-11 Richard Guenther +2013-01-11 Andreas Krebbel + + PR target/55719 + * gcc.target/s390/pr55719.c: New testcase. + +2013-01-11 Richard Guenther PR tree-optimization/44061 * gcc.dg/pr44061.c: New testcase.