summaryrefslogtreecommitdiff
path: root/gcc/config/mn10300
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1998-07-16 14:10:24 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1998-07-16 14:10:24 +0000
commit58e7b01f92628181984c01da885e5a19c749a01c (patch)
treea2690045230b0798c06c17885f7e7a609099ced1 /gcc/config/mn10300
parent492cb13116ca4f5718a7810ee1901d9e00b14e97 (diff)
downloadgcc-58e7b01f92628181984c01da885e5a19c749a01c.tar.gz
* mn10300.c (count_tst_insns): New arg oreg_countp. Callers changed.
Simplify tests for clearing an address register. (expand_prologue): Corresponding changes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@21215 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/mn10300')
-rw-r--r--gcc/config/mn10300/mn10300.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index 7456c32febe..c6102acb1fc 100644
--- a/gcc/config/mn10300/mn10300.c
+++ b/gcc/config/mn10300/mn10300.c
@@ -382,15 +382,17 @@ can_use_return_insn ()
/* Count the number of tst insns which compare a data or address
register with zero. */
static void
-count_tst_insns (dreg_countp, areg_countp)
+count_tst_insns (dreg_countp, areg_countp, oreg_countp)
int *dreg_countp;
int *areg_countp;
+ int *oreg_countp;
{
rtx insn;
/* Assume no tst insns exist. */
*dreg_countp = 0;
*areg_countp = 0;
+ *oreg_countp = 0;
/* If not optimizing, then quit now. */
if (!optimize)
@@ -424,8 +426,7 @@ count_tst_insns (dreg_countp, areg_countp)
/* Setting an address register to zero can also be optimized,
so count it just like a tst insn. */
if (GET_CODE (SET_DEST (pat)) == REG
- && GET_CODE (SET_SRC (pat)) == CONST_INT
- && INTVAL (SET_SRC (pat)) == 0
+ && SET_SRC (pat) == CONST0_RTX (GET_MODE (SET_DEST (pat)))
&& REGNO_REG_CLASS (REGNO (SET_DEST (pat))) == ADDRESS_REGS)
(*areg_countp)++;
}
@@ -447,16 +448,16 @@ expand_prologue ()
|| regs_ever_live[6] || regs_ever_live[7]
|| frame_pointer_needed)
{
- int dreg_count, areg_count;
+ int dreg_count, areg_count, oreg_count;
/* Get a count of the number of tst insns which use address and
data registers. */
- count_tst_insns (&dreg_count, &areg_count);
+ count_tst_insns (&dreg_count, &areg_count, &oreg_count);
/* If there's more than one tst insn using a data register, then
this optimization is a win. */
- if (dreg_count > 1
- && (!regs_ever_live[2] || !regs_ever_live[3]))
+ if ((dreg_count > 1 || oreg_count > 1)
+ && (!regs_ever_live[2] || !regs_ever_live[3]))
{
if (!regs_ever_live[2])
{
@@ -474,8 +475,8 @@ expand_prologue ()
/* If there's more than two tst insns using an address register,
then this optimization is a win. */
- if (areg_count > 2
- && (!regs_ever_live[6] || !regs_ever_live[7]))
+ if ((areg_count > 2 || oreg_count > 1)
+ && (!regs_ever_live[6] || !regs_ever_live[7]))
{
if (!regs_ever_live[6])
{