Commit bb8df8a6 by Eric Christopher

rs6000.c (mems_ok_for_quad_peep): Rewrite.

2005-08-10  Eric Christopher  <echristo@apple.com>

        * config/rs6000/rs6000.c (mems_ok_for_quad_peep): Rewrite.
        * config/rs6000/rs6000.md (*lfq_power2, *stfq_power2): Use
        V2DFmode.

From-SVN: r102956
parent 4f8dbd34
2005-08-10 Eric Christopher <echristo@apple.com>
* config/rs6000/rs6000.c (mems_ok_for_quad_peep): Rewrite.
* config/rs6000/rs6000.md (*lfq_power2, *stfq_power2): Use
V2DFmode.
2005-08-10 Andrew Pinski <pinskia@physics.uc.edu> 2005-08-10 Andrew Pinski <pinskia@physics.uc.edu>
* config/darwin.c (machopic_indirect_data_reference): Use a new register * config/darwin.c (machopic_indirect_data_reference): Use a new register
......
...@@ -9647,8 +9647,8 @@ int ...@@ -9647,8 +9647,8 @@ int
mems_ok_for_quad_peep (rtx mem1, rtx mem2) mems_ok_for_quad_peep (rtx mem1, rtx mem2)
{ {
rtx addr1, addr2; rtx addr1, addr2;
unsigned int reg1; unsigned int reg1, reg2;
int offset1; int offset1, offset2;
/* The mems cannot be volatile. */ /* The mems cannot be volatile. */
if (MEM_VOLATILE_P (mem1) || MEM_VOLATILE_P (mem2)) if (MEM_VOLATILE_P (mem1) || MEM_VOLATILE_P (mem2))
...@@ -9681,23 +9681,36 @@ mems_ok_for_quad_peep (rtx mem1, rtx mem2) ...@@ -9681,23 +9681,36 @@ mems_ok_for_quad_peep (rtx mem1, rtx mem2)
offset1 = 0; offset1 = 0;
} }
/* Make sure the second address is a (mem (plus (reg) (const_int))) /* And now for the second addr. */
or if it is (mem (reg)) then make sure that offset1 is -8 and the same if (GET_CODE (addr2) == PLUS)
register as addr1. */ {
if (offset1 == -8 && GET_CODE (addr2) == REG && reg1 == REGNO (addr2)) /* If not a REG, return zero. */
return 1; if (GET_CODE (XEXP (addr2, 0)) != REG)
if (GET_CODE (addr2) != PLUS)
return 0; return 0;
else
if (GET_CODE (XEXP (addr2, 0)) != REG {
|| GET_CODE (XEXP (addr2, 1)) != CONST_INT) reg2 = REGNO (XEXP (addr2, 0));
/* The offset must be constant. */
if (GET_CODE (XEXP (addr2, 1)) != CONST_INT)
return 0; return 0;
offset2 = INTVAL (XEXP (addr2, 1));
}
}
else if (GET_CODE (addr2) != REG)
return 0;
else
{
reg2 = REGNO (addr2);
/* This was a simple (mem (reg)) expression. Offset is 0. */
offset2 = 0;
}
if (reg1 != REGNO (XEXP (addr2, 0))) /* Both of these must have the same base register. */
if (reg1 != reg2)
return 0; return 0;
/* The offset for the second addr must be 8 more than the first addr. */ /* The offset for the second addr must be 8 more than the first addr. */
if (INTVAL (XEXP (addr2, 1)) != offset1 + 8) if (offset2 != offset1 + 8)
return 0; return 0;
/* All the tests passed. addr1 and addr2 are valid for lfq or stfq /* All the tests passed. addr1 and addr2 are valid for lfq or stfq
......
...@@ -9144,8 +9144,8 @@ ...@@ -9144,8 +9144,8 @@
;; Peephole to convert two consecutive FP loads or stores into lfq/stfq. ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
(define_insn "*lfq_power2" (define_insn "*lfq_power2"
[(set (match_operand:TF 0 "gpc_reg_operand" "=f") [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
(match_operand:TF 1 "memory_operand" ""))] (match_operand:V2DF 1 "memory_operand" ""))]
"TARGET_POWER2 "TARGET_POWER2
&& TARGET_HARD_FLOAT && TARGET_FPRS" && TARGET_HARD_FLOAT && TARGET_FPRS"
"lfq%U1%X1 %0,%1") "lfq%U1%X1 %0,%1")
...@@ -9161,12 +9161,12 @@ ...@@ -9161,12 +9161,12 @@
&& mems_ok_for_quad_peep (operands[1], operands[3])" && mems_ok_for_quad_peep (operands[1], operands[3])"
[(set (match_dup 0) [(set (match_dup 0)
(match_dup 1))] (match_dup 1))]
"operands[1] = widen_memory_access (operands[1], TFmode, 0); "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
operands[0] = gen_rtx_REG (TFmode, REGNO (operands[0]));") operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
(define_insn "*stfq_power2" (define_insn "*stfq_power2"
[(set (match_operand:TF 0 "memory_operand" "") [(set (match_operand:V2DF 0 "memory_operand" "")
(match_operand:TF 1 "gpc_reg_operand" "f"))] (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
"TARGET_POWER2 "TARGET_POWER2
&& TARGET_HARD_FLOAT && TARGET_FPRS" && TARGET_HARD_FLOAT && TARGET_FPRS"
"stfq%U0%X0 %1,%0") "stfq%U0%X0 %1,%0")
...@@ -9183,8 +9183,8 @@ ...@@ -9183,8 +9183,8 @@
&& mems_ok_for_quad_peep (operands[0], operands[2])" && mems_ok_for_quad_peep (operands[0], operands[2])"
[(set (match_dup 0) [(set (match_dup 0)
(match_dup 1))] (match_dup 1))]
"operands[0] = widen_memory_access (operands[0], TFmode, 0); "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
operands[1] = gen_rtx_REG (TFmode, REGNO (operands[1]));") operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
;; after inserting conditional returns we can sometimes have ;; after inserting conditional returns we can sometimes have
;; unnecessary register moves. Unfortunately we cannot have a ;; unnecessary register moves. Unfortunately we cannot have a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment