Commit 105766f3 by Joern Rennecke Committed by Joern Rennecke

epiphany.md (GPR_1): New constant.

        * config/epiphany/epiphany.md (GPR_1): New constant.
        (define_expand "mov<mode>cc): FAIL if gen_compare_reg returned 0.
        * config/epiphany/epiphany.c (gen_compare_reg):
        For flag_finite_math_only, avoid swapping operands when r0 and/or r1
        is already in place.
        Use GPR_0 / GPR_1 instead of 0/1 for r0/r1 register numbers.
        Don't require being called during rtl expansion; If y operlaps r0,
        return 0.
        (epiphany_compute_frame_size, epiphany_expand_prologue): Use GPR_1.
        (epiphany_expand_epilogue): Likewise.

From-SVN: r197586
parent 10064630
2013-04-08 Joern Rennecke <joern.rennecke@embecosm.com>
* config/epiphany/epiphany.md (GPR_1): New constant.
(define_expand "mov<mode>cc): FAIL if gen_compare_reg returned 0.
* config/epiphany/epiphany.c (gen_compare_reg):
For flag_finite_math_only, avoid swapping operands when r0 and/or r1
is already in place.
Use GPR_0 / GPR_1 instead of 0/1 for r0/r1 register numbers.
Don't require being called during rtl expansion; If y operlaps r0,
return 0.
(epiphany_compute_frame_size, epiphany_expand_prologue): Use GPR_1.
(epiphany_expand_epilogue): Likewise.
2013-04-08 Jakub Jelinek <jakub@redhat.com> 2013-04-08 Jakub Jelinek <jakub@redhat.com>
PR c++/34949 PR c++/34949
......
...@@ -537,24 +537,47 @@ gen_compare_reg (enum machine_mode cmode, enum rtx_code code, ...@@ -537,24 +537,47 @@ gen_compare_reg (enum machine_mode cmode, enum rtx_code code,
if (mode == CC_FP_GTEmode if (mode == CC_FP_GTEmode
&& (code == LE || code == LT || code == UNGT || code == UNGE)) && (code == LE || code == LT || code == UNGT || code == UNGE))
{ {
rtx tmp = x; x = y; y = tmp; if (flag_finite_math_only
code = swap_condition (code); && ((REG_P (x) && REGNO (x) == GPR_0)
|| (REG_P (y) && REGNO (y) == GPR_1)))
switch (code)
{
case LE: code = UNLE; break;
case LT: code = UNLT; break;
case UNGT: code = GT; break;
case UNGE: code = GE; break;
default: gcc_unreachable ();
}
else
{
rtx tmp = x; x = y; y = tmp;
code = swap_condition (code);
}
} }
cc_reg = gen_rtx_REG (mode, CC_REGNUM); cc_reg = gen_rtx_REG (mode, CC_REGNUM);
} }
if ((mode == CC_FP_EQmode || mode == CC_FP_GTEmode if ((mode == CC_FP_EQmode || mode == CC_FP_GTEmode
|| mode == CC_FP_ORDmode || mode == CC_FP_UNEQmode) || mode == CC_FP_ORDmode || mode == CC_FP_UNEQmode)
/* mov<mode>cc might want to re-emit a comparison during ifcvt. */ /* mov<mode>cc might want to re-emit a comparison during ifcvt. */
&& (!REG_P (x) || REGNO (x) != 0 || !REG_P (y) || REGNO (y) != 1)) && (!REG_P (x) || REGNO (x) != GPR_0
|| !REG_P (y) || REGNO (y) != GPR_1))
{ {
rtx reg; rtx reg;
#if 0
/* ??? We should really do the r0/r1 clobber only during rtl expansion,
but just like the flag clobber of movsicc, we have to allow
this for ifcvt to work, on the assumption that we'll only want
to do this if these registers have been used before by the
pre-ifcvt code. */
gcc_assert (currently_expanding_to_rtl); gcc_assert (currently_expanding_to_rtl);
reg = gen_rtx_REG (in_mode, 0); #endif
gcc_assert (!reg_overlap_mentioned_p (reg, y)); reg = gen_rtx_REG (in_mode, GPR_0);
if (reg_overlap_mentioned_p (reg, y))
return 0;
emit_move_insn (reg, x); emit_move_insn (reg, x);
x = reg; x = reg;
reg = gen_rtx_REG (in_mode, 1); reg = gen_rtx_REG (in_mode, GPR_1);
emit_move_insn (reg, y); emit_move_insn (reg, y);
y = reg; y = reg;
} }
...@@ -1020,7 +1043,7 @@ epiphany_compute_frame_size (int size /* # of var. bytes allocated. */) ...@@ -1020,7 +1043,7 @@ epiphany_compute_frame_size (int size /* # of var. bytes allocated. */)
first_slot = regno; first_slot = regno;
else if (last_slot < 0 else if (last_slot < 0
&& (first_slot ^ regno) != 1 && (first_slot ^ regno) != 1
&& (!interrupt_p || regno > GPR_0 + 1)) && (!interrupt_p || regno > GPR_1))
last_slot = regno; last_slot = regno;
} }
} }
...@@ -1665,7 +1688,7 @@ epiphany_expand_prologue (void) ...@@ -1665,7 +1688,7 @@ epiphany_expand_prologue (void)
gen_rtx_REG (DImode, GPR_0)); gen_rtx_REG (DImode, GPR_0));
frame_move_insn (gen_rtx_REG (SImode, GPR_0), frame_move_insn (gen_rtx_REG (SImode, GPR_0),
gen_rtx_REG (word_mode, STATUS_REGNUM)); gen_rtx_REG (word_mode, STATUS_REGNUM));
frame_move_insn (gen_rtx_REG (SImode, GPR_0+1), frame_move_insn (gen_rtx_REG (SImode, GPR_1),
gen_rtx_REG (word_mode, IRET_REGNUM)); gen_rtx_REG (word_mode, IRET_REGNUM));
mem = gen_frame_mem (BLKmode, stack_pointer_rtx); mem = gen_frame_mem (BLKmode, stack_pointer_rtx);
off = GEN_INT (-current_frame_info.first_slot_offset); off = GEN_INT (-current_frame_info.first_slot_offset);
...@@ -1841,7 +1864,7 @@ epiphany_expand_epilogue (int sibcall_p) ...@@ -1841,7 +1864,7 @@ epiphany_expand_epilogue (int sibcall_p)
emit_move_insn (gen_rtx_REG (word_mode, STATUS_REGNUM), emit_move_insn (gen_rtx_REG (word_mode, STATUS_REGNUM),
gen_rtx_REG (SImode, GPR_0)); gen_rtx_REG (SImode, GPR_0));
emit_move_insn (gen_rtx_REG (word_mode, IRET_REGNUM), emit_move_insn (gen_rtx_REG (word_mode, IRET_REGNUM),
gen_rtx_REG (SImode, GPR_0+1)); gen_rtx_REG (SImode, GPR_1));
addr = plus_constant (Pmode, stack_pointer_rtx, addr = plus_constant (Pmode, stack_pointer_rtx,
- (HOST_WIDE_INT) 2 * UNITS_PER_WORD); - (HOST_WIDE_INT) 2 * UNITS_PER_WORD);
emit_move_insn (gen_rtx_REG (DImode, GPR_0), emit_move_insn (gen_rtx_REG (DImode, GPR_0),
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
(define_constants (define_constants
[(GPR_0 0) [(GPR_0 0)
(GPR_1 1)
(GPR_FP 11) (GPR_FP 11)
(GPR_IP 12) (GPR_IP 12)
(GPR_SP 13) (GPR_SP 13)
...@@ -1820,6 +1821,8 @@ ...@@ -1820,6 +1821,8 @@
operations - if we get some. */ operations - if we get some. */
operands[1] operands[1]
= gen_compare_reg (<MODE>mode, code, cmp_in_mode, cmp_op0, cmp_op1); = gen_compare_reg (<MODE>mode, code, cmp_in_mode, cmp_op0, cmp_op1);
if (!operands[1])
FAIL;
} }
}) })
......
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