sh.md (mova_const): New pattern.

* config/sh/sh.md (mova_const): New pattern.
(GOTaddr2picreg): Use it.
* config/sh/sh.c (broken_move): Match it.
(mova_p): Don't match it.
(machine_dependent_reorg): Adjust it.

From-SVN: r37690
This commit is contained in:
Alexandre Oliva 2000-11-23 06:20:16 +00:00 committed by Alexandre Oliva
parent 5e18f6d629
commit 43c0563453
3 changed files with 31 additions and 11 deletions

View File

@ -1,3 +1,11 @@
Thu Nov 23 04:10:30 2000 Alexandre Oliva <aoliva@redhat.com>
* config/sh/sh.md (mova_const): New pattern.
(GOTaddr2picreg): Use it.
* config/sh/sh.c (broken_move): Match it.
(mova_p): Don't match it.
(machine_dependent_reorg): Adjust it.
Thu Nov 23 02:09:09 2000 Alexandre Oliva <aoliva@redhat.com>
* config/sh/sh.h (FIRST_GENERAL_REG, LAST_GENERAL_REG): New.

View File

@ -2071,7 +2071,11 @@ broken_move (insn)
/* We can load any 8 bit value if we don't care what the high
order bits end up as. */
&& GET_MODE (SET_DEST (pat)) != QImode
&& CONSTANT_P (SET_SRC (pat))
&& (CONSTANT_P (SET_SRC (pat))
/* Match mova_const. */
|| (GET_CODE (SET_SRC (pat)) == UNSPEC
&& XINT (SET_SRC (pat), 1) == UNSPEC_MOVA
&& GET_CODE (XVECEXP (SET_SRC (pat), 0, 0)) == CONST))
&& ! (TARGET_SH3E
&& GET_CODE (SET_SRC (pat)) == CONST_DOUBLE
&& (fp_zero_operand (SET_SRC (pat))
@ -2097,7 +2101,9 @@ mova_p (insn)
return (GET_CODE (insn) == INSN
&& GET_CODE (PATTERN (insn)) == SET
&& GET_CODE (SET_SRC (PATTERN (insn))) == UNSPEC
&& XINT (SET_SRC (PATTERN (insn)), 1) == UNSPEC_MOVA);
&& XINT (SET_SRC (PATTERN (insn)), 1) == UNSPEC_MOVA
/* Don't match mova_const. */
&& XVECEXP (SET_SRC (PATTERN (insn)), 0, 0) == LABEL_REF);
}
/* Find the last barrier from insn FROM which is close enough to hold the
@ -3280,14 +3286,11 @@ machine_dependent_reorg (first)
XEXP (clobber, 0) = gen_rtx_SCRATCH (Pmode);
}
/* This is a mova needing a label. Create it. */
else if (GET_CODE (src) == CONST
&& GET_CODE (XEXP (src, 0)) == UNSPEC
&& XINT (XEXP (src, 0), 1) == UNSPEC_MOVA
&& GET_CODE (XVECEXP (XEXP (src, 0),
0, 0)) == CONST)
else if (GET_CODE (src) == UNSPEC
&& XINT (src, 1) == UNSPEC_MOVA
&& GET_CODE (XVECEXP (src, 0, 0)) == CONST)
{
lab = add_constant (XVECEXP (XEXP (src, 0),
0, 0), mode, 0);
lab = add_constant (XVECEXP (src, 0, 0), mode, 0);
newsrc = gen_rtx_LABEL_REF (VOIDmode, lab);
newsrc = gen_rtx_UNSPEC (VOIDmode,
gen_rtvec (1, newsrc),

View File

@ -3570,10 +3570,19 @@
[(set_attr "in_delay_slot" "no")
(set_attr "type" "arith")])
;; machine_dependent_reorg() will make this a `mova'.
(define_insn "mova_const"
[(set (reg:SI R0_REG)
(unspec [(match_operand 0 "immediate_operand" "i")] 1))]
""
"#"
[(set_attr "in_delay_slot" "no")
(set_attr "type" "arith")])
(define_expand "GOTaddr2picreg"
[(set (reg:SI R0_REG)
(const (unspec [(const (unspec [(match_dup 1)] UNSPEC_PIC))]
UNSPEC_MOVA)))
(unspec [(const (unspec [(match_dup 1)] UNSPEC_PIC))]
UNSPEC_MOVA))
(set (match_dup 0) (const (unspec [(match_dup 1)] UNSPEC_PIC)))
(set (match_dup 0) (plus:SI (match_dup 0) (reg:SI R0_REG)))]
"" "