This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: reload_indi with scratch == target?
- From: "Ulrich Weigand" <Ulrich dot Weigand at de dot ibm dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Tue, 12 Mar 2002 15:41:30 +0100
- Subject: Re: reload_indi with scratch == target?
Richard Henderson wrote:
>On Mon, Mar 11, 2002 at 09:57:26PM +0100, Ulrich Weigand wrote:
>
>> Should I implement a similar workaround to sparc64 for our platform?
>
>Yes. We do this for Alpha as well.
OK, thanks for the info.
I've committed the following fix to trunk and branch.
Bye,
Ulrich
ChangeLog:
* config/s390/s390.md (reload_insi, reload_indi): Change mode of
scratch register to DImode / TImode.
config/s390/s390.c (s390_expand_plus_operand): Make sure scratch
register used does not overlap the target.
Index: gcc/config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.28
diff -c -p -r1.28 s390.c
*** s390.c 2002/02/27 20:20:54 1.28
--- s390.c 2002/03/12 13:03:03
***************
*** 1,5 ****
/* Subroutines used for code generation on IBM S/390 and zSeries
! Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Hartmut Penner (hpenner@de.ibm.com) and
Ulrich Weigand (uweigand@de.ibm.com).
--- 1,5 ----
/* Subroutines used for code generation on IBM S/390 and zSeries
! Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Hartmut Penner (hpenner@de.ibm.com) and
Ulrich Weigand (uweigand@de.ibm.com).
*************** s390_plus_operand (op, mode)
*** 1169,1182 ****
SCRATCH may be used as scratch register. */
void
! s390_expand_plus_operand (target, src, scratch)
register rtx target;
register rtx src;
! register rtx scratch;
{
! /* src must be a PLUS; get its two operands. */
! rtx sum1, sum2;
if (GET_CODE (src) != PLUS || GET_MODE (src) != Pmode)
abort ();
--- 1169,1191 ----
SCRATCH may be used as scratch register. */
void
! s390_expand_plus_operand (target, src, scratch_in)
register rtx target;
register rtx src;
! register rtx scratch_in;
{
! rtx sum1, sum2, scratch;
!
! /* ??? reload apparently does not ensure that the scratch register
! and the target do not overlap. We absolutely require this to be
! the case, however. Therefore the reload_in[sd]i patterns ask for
! a double-sized scratch register, and if one part happens to be
! equal to the target, we use the other one. */
! scratch = gen_rtx_REG (Pmode, REGNO (scratch_in));
! if (rtx_equal_p (scratch, target))
! scratch = gen_rtx_REG (Pmode, REGNO (scratch_in) + 1);
+ /* src must be a PLUS; get its two operands. */
if (GET_CODE (src) != PLUS || GET_MODE (src) != Pmode)
abort ();
Index: gcc/config/s390/s390.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.md,v
retrieving revision 1.17
diff -c -p -r1.17 s390.md
*** s390.md 2002/02/15 23:30:03 1.17
--- s390.md 2002/03/12 13:03:06
***************
*** 1,5 ****
;;- Machine description for GNU compiler -- S/390 / zSeries version.
! ;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
;; Contributed by Hartmut Penner (hpenner@de.ibm.com) and
;; Ulrich Weigand (uweigand@de.ibm.com).
;; This file is part of GNU CC.
--- 1,5 ----
;;- Machine description for GNU compiler -- S/390 / zSeries version.
! ;; Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
;; Contributed by Hartmut Penner (hpenner@de.ibm.com) and
;; Ulrich Weigand (uweigand@de.ibm.com).
;; This file is part of GNU CC.
***************
*** 3151,3157 ****
(define_expand "reload_indi"
[(parallel [(match_operand:DI 0 "register_operand" "=a")
(match_operand:DI 1 "s390_plus_operand" "")
! (match_operand:DI 2 "register_operand" "=&a")])]
"TARGET_64BIT"
"
{
--- 3151,3157 ----
(define_expand "reload_indi"
[(parallel [(match_operand:DI 0 "register_operand" "=a")
(match_operand:DI 1 "s390_plus_operand" "")
! (match_operand:TI 2 "register_operand" "=&a")])]
"TARGET_64BIT"
"
{
***************
*** 3238,3244 ****
(define_expand "reload_insi"
[(parallel [(match_operand:SI 0 "register_operand" "=a")
(match_operand:SI 1 "s390_plus_operand" "")
! (match_operand:SI 2 "register_operand" "=&a")])]
"!TARGET_64BIT"
"
{
--- 3238,3244 ----
(define_expand "reload_insi"
[(parallel [(match_operand:SI 0 "register_operand" "=a")
(match_operand:SI 1 "s390_plus_operand" "")
! (match_operand:DI 2 "register_operand" "=&a")])]
"!TARGET_64BIT"
"
{