This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
pa.c::emit_move_sequence bugfix
- To: gcc at gcc dot gnu dot org
- Subject: pa.c::emit_move_sequence bugfix
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Thu, 29 Jul 1999 00:23:30 -0600
- Reply-To: law at cygnus dot com
This was found while working on the PA64 code generator.
The mode of the hard scratch register provided to emit_move_sequence may not
be a mode that we can actually use. Most of the code already converted the
register into the right mode. This patch adds the conversion in a few more
places.
* pa.c (emit_move_sequence): Always convert scratch_reg to the
proper mode before using it.
Index: pa.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/pa/pa.c,v
retrieving revision 1.150
diff -c -3 -p -r1.150 pa.c
*** pa.c 1999/07/28 23:52:23 1.150
--- pa.c 1999/07/29 06:17:54
*************** hppa_address_cost (X)
*** 1112,1119 ****
Return 1 if we have written out everything that needs to be done to
do the move. Otherwise, return 0 and the caller will emit the move
! normally. */
int
emit_move_sequence (operands, mode, scratch_reg)
rtx *operands;
--- 1112,1123 ----
Return 1 if we have written out everything that needs to be done to
do the move. Otherwise, return 0 and the caller will emit the move
! normally.
+ Note SCRATCH_REG may not be in the proper mode depending on how it
+ will be used. This routine is resposible for creating a new copy
+ of SCRATCH_REG in the proper mode. */
+
int
emit_move_sequence (operands, mode, scratch_reg)
rtx *operands;
*************** emit_move_sequence (operands, mode, scra
*** 1173,1178 ****
--- 1177,1185 ----
if (GET_CODE (operand1) == SUBREG)
operand1 = XEXP (operand1, 0);
+ /* SCRATCH_REG will hold an address and maybe the actual data. We want
+ it in WORD_MODE regardless of what mode it was originally given
+ to us. */
scratch_reg = gen_rtx_REG (word_mode, REGNO (scratch_reg));
/* D might not fit in 14 bits either; for such cases load D into
*************** emit_move_sequence (operands, mode, scra
*** 1202,1208 ****
--- 1209,1219 ----
if (GET_CODE (operand0) == SUBREG)
operand0 = XEXP (operand0, 0);
+ /* SCRATCH_REG will hold an address and maybe the actual data. We want
+ it in WORD_MODE regardless of what mode it was originally given
+ to us. */
scratch_reg = gen_rtx_REG (word_mode, REGNO (scratch_reg));
+
/* D might not fit in 14 bits either; for such cases load D into
scratch reg. */
if (!memory_address_p (Pmode, XEXP (operand0, 0)))
*************** emit_move_sequence (operands, mode, scra
*** 1236,1241 ****
--- 1247,1257 ----
{
rtx xoperands[2];
+ /* SCRATCH_REG will hold an address and maybe the actual data. We want
+ it in WORD_MODE regardless of what mode it was originally given
+ to us. */
+ scratch_reg = gen_rtx_REG (word_mode, REGNO (scratch_reg));
+
/* Force the constant into memory and put the address of the
memory location into scratch_reg. */
xoperands[0] = scratch_reg;
*************** emit_move_sequence (operands, mode, scra
*** 1256,1261 ****
--- 1272,1282 ----
&& FP_REG_CLASS_P (REGNO_REG_CLASS (REGNO (operand1)))))
&& scratch_reg)
{
+ /* SCRATCH_REG will hold an address and maybe the actual data. We want
+ it in WORD_MODE regardless of what mode it was originally given
+ to us. */
+ scratch_reg = gen_rtx_REG (word_mode, REGNO (scratch_reg));
+
/* D might not fit in 14 bits either; for such cases load D into
scratch reg. */
if (GET_CODE (operand1) == MEM
*************** emit_move_sequence (operands, mode, scra
*** 1348,1354 ****
/* Figure out what (if any) scratch register to use. */
if (reload_in_progress || reload_completed)
! scratch_reg = scratch_reg ? scratch_reg : operand0;
else if (flag_pic)
scratch_reg = gen_reg_rtx (Pmode);
--- 1369,1381 ----
/* Figure out what (if any) scratch register to use. */
if (reload_in_progress || reload_completed)
! {
! scratch_reg = scratch_reg ? scratch_reg : operand0;
! /* SCRATCH_REG will hold an address and maybe the actual
! data. We want it in WORD_MODE regardless of what mode it
! was originally given to us. */
! scratch_reg = gen_rtx_REG (word_mode, REGNO (scratch_reg));
! }
else if (flag_pic)
scratch_reg = gen_reg_rtx (Pmode);
*************** emit_move_sequence (operands, mode, scra
*** 1400,1406 ****
rtx temp;
if (reload_in_progress || reload_completed)
! temp = scratch_reg ? scratch_reg : operand0;
else
temp = gen_reg_rtx (Pmode);
--- 1427,1439 ----
rtx temp;
if (reload_in_progress || reload_completed)
! {
! temp = scratch_reg ? scratch_reg : operand0;
! /* TEMP will hold an address and maybe the actual
! data. We want it in WORD_MODE regardless of what mode it
! was originally given to us. */
! temp = gen_rtx_REG (word_mode, REGNO (temp));
! }
else
temp = gen_reg_rtx (Pmode);
*************** emit_move_sequence (operands, mode, scra
*** 1433,1439 ****
rtx temp, set;
if (reload_in_progress || reload_completed)
! temp = scratch_reg ? scratch_reg : operand0;
else
temp = gen_reg_rtx (mode);
--- 1466,1478 ----
rtx temp, set;
if (reload_in_progress || reload_completed)
! {
! temp = scratch_reg ? scratch_reg : operand0;
! /* TEMP will hold an address and maybe the actual
! data. We want it in WORD_MODE regardless of what mode it
! was originally given to us. */
! temp = gen_rtx_REG (word_mode, REGNO (temp));
! }
else
temp = gen_reg_rtx (mode);