sh.md (prefetch): Simplify expander.
authorOleg Endo <olegendo@gcc.gnu.org>
Sun, 12 Aug 2012 22:50:51 +0000 (22:50 +0000)
committerOleg Endo <olegendo@gcc.gnu.org>
Sun, 12 Aug 2012 22:50:51 +0000 (22:50 +0000)
* config/sh/sh.md (prefetch): Simplify expander.  Fix condition to
allow SH3.
(*prefetch_media): Move insn below expander.
(*prefetch): Fix condition to allow SH3.

* gcc.target/sh/prefetch.c: Add -m3* to inclusion list.

From-SVN: r190332

gcc/ChangeLog
gcc/config/sh/sh.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/sh/prefetch.c

index c327437dc000a4e2dc55c6d8663defd68b1011b1..35390e4dba6333adcf63789fcaa2b77b16c81415 100644 (file)
@@ -1,3 +1,10 @@
+2012-08-12  Oleg Endo  <olegendo@gcc.gnu.org>
+
+       * config/sh/sh.md (prefetch): Simplify expander.  Fix condition to
+       allow SH3.
+       (*prefetch_media): Move insn below expander.
+       (*prefetch): Fix condition to allow SH3.
+
 2012-08-12  Oleg Endo  <olegendo@gcc.gnu.org>
 
        PR target/51244
index 8af99f8e49e60d2de39dc06fca9830d7b4a8f022..aee416e5fb4a0153ca683ee21aa2be2eed791869 100644 (file)
@@ -13868,44 +13868,36 @@ label:
   "byterev     %1, %0"
   [(set_attr "type" "arith_media")])
 
-(define_insn "*prefetch_media"
-  [(prefetch (match_operand:QI 0 "address_operand" "p")
-             (match_operand:SI 1 "const_int_operand" "n")
-             (match_operand:SI 2 "const_int_operand" "n"))]
-  "TARGET_SHMEDIA"
-{
-  operands[0] = gen_rtx_MEM (QImode, operands[0]);
-  output_asm_insn ("ld%M0.b    %m0,r63", operands);
-  return "";
-}
-  [(set_attr "type" "other")])
-
 ;; In user mode, the "pref" instruction will raise a RADDERR exception
 ;; for accesses to [0x80000000,0xffffffff].  This makes it an unsuitable
 ;; implementation of __builtin_prefetch for VxWorks RTPs.
 (define_expand "prefetch"
-  [(prefetch (match_operand 0 "address_operand" "p")
-             (match_operand:SI 1 "const_int_operand" "n")
-             (match_operand:SI 2 "const_int_operand" "n"))]
-  "TARGET_SH2A || ((TARGET_HARD_SH4 || TARGET_SH5)
-   && (TARGET_SHMEDIA || !TARGET_VXWORKS_RTP))"
-{
-  if (GET_MODE (operands[0]) != Pmode
-      || !CONST_INT_P (operands[1])
-      || !CONST_INT_P (operands[2]))
-    FAIL;
-  if (! TARGET_SHMEDIA)
-    operands[0] = force_reg (Pmode, operands[0]);
-})
+  [(prefetch (match_operand 0 "address_operand" "")
+             (match_operand:SI 1 "const_int_operand" "")
+             (match_operand:SI 2 "const_int_operand" ""))]
+  "(TARGET_SH2A || TARGET_SH3 || TARGET_SH5)
+   && (TARGET_SHMEDIA || ! TARGET_VXWORKS_RTP)")
 
 (define_insn "*prefetch"
   [(prefetch (match_operand:SI 0 "register_operand" "r")
             (match_operand:SI 1 "const_int_operand" "n")
             (match_operand:SI 2 "const_int_operand" "n"))]
-  "(TARGET_SH2A || TARGET_HARD_SH4 || TARGET_SHCOMPACT) && !TARGET_VXWORKS_RTP"
+  "(TARGET_SH2A || TARGET_SH3 || TARGET_SHCOMPACT) && ! TARGET_VXWORKS_RTP"
   "pref        @%0"
   [(set_attr "type" "other")])
 
+(define_insn "*prefetch_media"
+  [(prefetch (match_operand:QI 0 "address_operand" "p")
+             (match_operand:SI 1 "const_int_operand" "n")
+             (match_operand:SI 2 "const_int_operand" "n"))]
+  "TARGET_SHMEDIA"
+{
+  operands[0] = gen_rtx_MEM (QImode, operands[0]);
+  output_asm_insn ("ld%M0.b    %m0,r63", operands);
+  return "";
+}
+  [(set_attr "type" "other")])
+
 (define_insn "alloco_i"
   [(set (mem:BLK (match_operand:QI 0 "cache_address_operand" "p"))
        (unspec:BLK [(const_int 0)] UNSPEC_ALLOCO))]
index f8b52217b2b23e80ddbed6a791477812855d2aba..a9df8b75264a81058ce385db545b8b91da1d8f8f 100644 (file)
@@ -1,3 +1,7 @@
+2012-08-12  Oleg Endo  <olegendo@gcc.gnu.org>
+
+       * gcc.target/sh/prefetch.c: Add -m3* to inclusion list.
+
 2012-08-12  Oleg Endo  <olegendo@gcc.gnu.org>
 
        PR target/51244
index b34b115d6b8fde66d6ae2d8c7941f329549cd6c3..e0873737453e5cfbe7815b84b284a64838d6a356 100644 (file)
@@ -2,7 +2,7 @@
    instruction PREF @Rm.  */
 /* { dg-do assemble {target sh*-*-*}}  */
 /* { dg-options "-O0" }  */
-/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" "-m4*" } }  */
+/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" "-m3*" "-m4*" } }  */
 /* { dg-final { scan-assembler "pref"} }  */
 
 void