OSDN Git Service

* config/sh/sh.md (mova_const): New pattern.
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Nov 2000 06:20:16 +0000 (06:20 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Nov 2000 06:20:16 +0000 (06:20 +0000)
(GOTaddr2picreg): Use it.
* config/sh/sh.c (broken_move): Match it.
(mova_p): Don't match it.
(machine_dependent_reorg): Adjust it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37690 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/sh/sh.c
gcc/config/sh/sh.md

index 3ea935b..3bb689c 100644 (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.
index 8087eda..e41ae32 100644 (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),
index c09775e..34649e0 100644 (file)
   [(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)))]
   "" "