constraints.md (I28): New constraint.
authorJayant R Sonar <jayant.sonar@kpitcummins.com>
Tue, 25 Mar 2008 13:36:11 +0000 (13:36 +0000)
committerKaz Kojima <kkojima@gcc.gnu.org>
Tue, 25 Mar 2008 13:36:11 +0000 (13:36 +0000)
* config/sh/constraints.md (I28): New constraint.
* config/sh/sh.c (broken_move): Add support for movi20s.
* config/sh/sh.md (movsi_ie): Add the alternative for
movi20s.

* gcc.target/sh/sh2a-movi20s.c: New test.

Co-Authored-By: Naveen.H.S <naveen.hs@kpitcummins.com>
From-SVN: r133514

gcc/ChangeLog
gcc/config/sh/constraints.md
gcc/config/sh/sh.c
gcc/config/sh/sh.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/sh/sh2a-movi20s.c [new file with mode: 0644]

index 071d094d4db635962c3a82b5323e5e84db245558..7ca50285e1f81343049fe1c2a92b65820559fab4 100644 (file)
@@ -1,3 +1,11 @@
+2008-03-25  Jayant Sonar  <Jayant.sonar@kpitcummins.com>
+           Naveen.H.S  <naveen.hs@kpitcummins.com>
+
+       * config/sh/constraints.md (I28): New constraint.
+       * config/sh/sh.c (broken_move): Add support for movi20s.
+       * config/sh/sh.md (movsi_ie): Add the alternative for
+       movi20s.
+
 2008-03-25  Anil Paranjape  <anil.paranjape@kpitcummins.com>
            Jayant Sonar  <Jayant.sonar@kpitcummins.com>
            Naveen.H.S  <naveen.hs@kpitcummins.com>
index 333c5beccb99043f63eb0dfba064d3f2d69e61b3..7509fae67ee1cfd863d4a9d06551f89f938cc14a 100644 (file)
        (match_test "ival >= -524288 && ival <= 524287")
        (match_test "TARGET_SH2A")))
 
+(define_constraint "I28"
+  "A signed 28-bit constant, as used in SH2A movi20s."
+  (and (match_code "const_int")
+       (match_test "ival >=  -134217728 && ival <= 134217727")
+       (match_test "(ival & 255) == 0")
+       (match_test "TARGET_SH2A")))
 (define_constraint "J16"
   "0xffffffff00000000 or 0x00000000ffffffff."
   (and (match_code "const_int")
index 57049ea738f070f8a53aa54ab03afd40f3e2ef07..df959d82746a51e70d4246e171964365165a8cea 100644 (file)
@@ -3753,7 +3753,8 @@ broken_move (rtx insn)
                && FP_REGISTER_P (REGNO (SET_DEST (pat))))
          && ! (TARGET_SH2A
                && GET_MODE (SET_DEST (pat)) == SImode
-               && satisfies_constraint_I20 (SET_SRC (pat)))
+               && (satisfies_constraint_I20 (SET_SRC (pat))
+                  || satisfies_constraint_I28 (SET_SRC (pat))))
          && ! satisfies_constraint_I08 (SET_SRC (pat)))
        return 1;
     }
index 6dae438f9f9c6e8d34337b20b0267dd3a75bf97a..750e9d36d96df56fe86297622e7eb311542f94e7 100644 (file)
@@ -4937,9 +4937,9 @@ label:
 ;; TARGET_FMOVD is in effect, and mode switching is done before reload.
 (define_insn "movsi_ie"
   [(set (match_operand:SI 0 "general_movdst_operand"
-           "=r,r,r,r,t,r,r,r,r,m,<,<,x,l,x,l,y,<,r,y,r,*f,y,*f,y")
+           "=r,r,r,r,r,t,r,r,r,r,m,<,<,x,l,x,l,y,<,r,y,r,*f,y,*f,y")
        (match_operand:SI 1 "general_movsrc_operand"
-        "Q,r,I08,I20,r,mr,x,l,t,r,x,l,r,r,>,>,>,y,i,r,y,y,*f,*f,y"))]
+        "Q,r,I08,I20,I28,r,mr,x,l,t,r,x,l,r,r,>,>,>,y,i,r,y,y,*f,*f,y"))]
   "(TARGET_SH2E || TARGET_SH2A)
    && (register_operand (operands[0], SImode)
        || register_operand (operands[1], SImode))"
@@ -4948,6 +4948,7 @@ label:
        mov     %1,%0
        mov     %1,%0
        movi20  %1,%0
+       movi20s %1,%0
        cmp/pl  %1
        mov.l   %1,%0
        sts     %1,%0
@@ -4969,13 +4970,14 @@ label:
        flds    %1,fpul
        fmov    %1,%0
        ! move optimized away"
-  [(set_attr "type" "pcload_si,move,movi8,move,*,load_si,mac_gp,prget,arith,store,mac_mem,pstore,gp_mac,prset,mem_mac,pload,load,fstore,pcload_si,gp_fpul,fpul_gp,fmove,fmove,fmove,nil")
-   (set_attr "late_fp_use" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,yes,*,*,yes,*,*,*,*")
+  [(set_attr "type" "pcload_si,move,movi8,move,move,*,load_si,mac_gp,prget,arith,store,mac_mem,pstore,gp_mac,prset,mem_mac,pload,load,fstore,pcload_si,gp_fpul,fpul_gp,fmove,fmove,fmove,nil")
+   (set_attr "late_fp_use" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,yes,*,*,yes,*,*,*,*")
    (set_attr_alternative "length"
      [(const_int 2)
       (const_int 2)
       (const_int 2)
       (const_int 4)
+      (const_int 4)
       (const_int 2)
       (if_then_else
        (ne (symbol_ref "TARGET_SH2A") (const_int 0))
index 103aaf20414c078513b6993d99d09ce9d2a3efe0..7cee9300aed4545af914a5b9cf8d11e33b3e554b 100644 (file)
@@ -1,3 +1,8 @@
+2008-03-25  Jayant Sonar  <Jayant.sonar@kpitcummins.com>
+           Naveen.H.S  <naveen.hs@kpitcummins.com>
+
+       * gcc.target/sh/sh2a-movi20s.c: New test.
+
 2008-03-25  Anil Paranjape  <anil.paranjape@kpitcummins.com>
            Jayant Sonar  <Jayant.sonar@kpitcummins.com>
            Naveen.H.S  <naveen.hs@kpitcummins.com>
diff --git a/gcc/testsuite/gcc.target/sh/sh2a-movi20s.c b/gcc/testsuite/gcc.target/sh/sh2a-movi20s.c
new file mode 100644 (file)
index 0000000..55d2f66
--- /dev/null
@@ -0,0 +1,14 @@
+/* Testcase to check generation of 'MOVI20S #imm20, Rn'.  */
+/* { dg-do assemble {target sh*-*-*}}  */
+/* { dg-options "-O0" } */
+/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" }  */
+/* { dg-final { scan-assembler "movi20s"} }  */
+
+volatile long la;
+
+void
+testfun (void)
+{
+  la = -134217728;
+  la = 134217216;
+}