* config/sparc/sparc.md (prefetch): New.
authorDan Nicolaescu <dann@ics.uci.edu>
Wed, 12 Dec 2001 02:22:51 +0000 (02:22 +0000)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 12 Dec 2001 02:22:51 +0000 (18:22 -0800)
From-SVN: r47911

gcc/ChangeLog
gcc/config/sparc/sparc.md

index 4151ff9361c2456e66472b0d56a721dcea673fa0..48a09e5f73d633aeb93441c0f5c1f2d5d4b5b4bf 100644 (file)
@@ -1,3 +1,7 @@
+2001-12-11  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * config/sparc/sparc.md (prefetch): New.
+
 2001-12-11  Aldy Hernandez  <aldyh@redhat.com>
 
         * output.h (regno_uninitialized): Make argument unsigned.
index 516453fc3e6dd16894fa9a204f4bc734754f47c2..fc3f10bf0d98fc93070fb0c3e826b134e5d1b3fe 100644 (file)
    && short_branch (INSN_UID (insn), INSN_UID (operands[2]))
    && (USING_SJLJ_EXCEPTIONS || ! can_throw_internal (insn))"
   "call\\t%a0, %1\\n\\tadd\\t%%o7, (%l2-.-4), %%o7")
+
+(define_insn "prefetch"
+  [(prefetch (match_operand:DI 0 "address_operand" "p")
+            (match_operand:DI 1 "const_int_operand" "n")
+            (match_operand:DI 2 "const_int_operand" "n"))]
+  "TARGET_V9"
+{
+  static const char * const prefetch_instr[2][4] = {
+    {
+      "prefetch\\t[%a0], 1", /* no locality: prefetch for one read */
+      "prefetch\\t[%a0], 0", /* medium locality: prefetch for several reads */
+      "prefetch\\t[%a0], 0", /* medium locality: prefetch for several reads */
+      "prefetch\\t[%a0], 4", /* high locality: prefetch page */
+    },
+    {
+      "prefetch\\t[%a0], 3", /* no locality: prefetch for one write */
+      "prefetch\\t[%a0], 2", /* medium locality: prefetch for several writes */
+      "prefetch\\t[%a0], 2", /* medium locality: prefetch for several writes */
+      "prefetch\\t[%a0], 4", /* high locality: prefetch page */
+    }
+  };
+  int read_or_write = INTVAL (operands[1]);
+  int locality = INTVAL (operands[2]);
+
+  if (read_or_write != 0 && read_or_write != 1)
+    abort ();
+  if (locality < 0 || locality > 3)
+    abort ();
+  return prefetch_instr [read_or_write][locality];
+}
+  [(set_attr "type" "load")])
 \f
 (define_expand "prologue"
   [(const_int 1)]