From 1b8ad134da972e9d151a068e4abfdfec883b0e9f Mon Sep 17 00:00:00 2001 From: Jeffrey A Law Date: Thu, 29 Jul 1999 06:21:12 +0000 Subject: [PATCH] pa.c (emit_move_sequence): Always convert scratch_reg to the proper mode before using it. * pa.c (emit_move_sequence): Always convert scratch_reg to the proper mode before using it. From-SVN: r28331 --- gcc/ChangeLog | 3 +++ gcc/config/pa/pa.c | 47 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 180b2c98eea..6fdd03c0e18 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -5,6 +5,9 @@ Wed Jul 28 12:50:48 1999 Geoff Keating Wed Jul 28 13:18:35 1999 Jeffrey A Law (law@cygnus.com) + * pa.c (emit_move_sequence): Always convert scratch_reg to the + proper mode before using it. + * pa.md (adddi3, subdi3): Turn into a define_expand/define_insn pair. diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index a5753bfee47..42234321b8a 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -1100,7 +1100,11 @@ hppa_address_cost (X) 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. */ + 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) @@ -1161,6 +1165,9 @@ emit_move_sequence (operands, mode, scratch_reg) 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 @@ -1190,7 +1197,11 @@ emit_move_sequence (operands, mode, scratch_reg) 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))) @@ -1224,6 +1235,11 @@ emit_move_sequence (operands, mode, scratch_reg) { 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; @@ -1244,6 +1260,11 @@ emit_move_sequence (operands, mode, scratch_reg) && 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 @@ -1336,7 +1357,13 @@ emit_move_sequence (operands, mode, scratch_reg) /* Figure out what (if any) scratch register to use. */ if (reload_in_progress || reload_completed) - scratch_reg = scratch_reg ? scratch_reg : operand0; + { + 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); @@ -1388,7 +1415,13 @@ emit_move_sequence (operands, mode, scratch_reg) rtx temp; if (reload_in_progress || reload_completed) - temp = scratch_reg ? scratch_reg : operand0; + { + 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); @@ -1421,7 +1454,13 @@ emit_move_sequence (operands, mode, scratch_reg) rtx temp, set; if (reload_in_progress || reload_completed) - temp = scratch_reg ? scratch_reg : operand0; + { + 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); -- 2.30.2