Add prefetch support for aarch64
authorGanesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com>
Thu, 4 Dec 2014 10:51:54 +0000 (10:51 +0000)
committerGanesh Gopalasubramanian <gganesh@gcc.gnu.org>
Thu, 4 Dec 2014 10:51:54 +0000 (10:51 +0000)
From-SVN: r218349

gcc/ChangeLog
gcc/config/aarch64/aarch64.md

index 61b1a3026a9f200e8200168613547bb0f1ef985c..8b7bbda075f9c4c14eb4db1f6cc7db5f6cad87e0 100644 (file)
@@ -1,3 +1,7 @@
+2014-12-04 Ganesh Gopalasubramanian  <Ganesh.Gopalasubramanian@amd.com>
+
+       * config/aarch64/aarch64.md (define_insn "prefetch"): New.
+
 2014-12-04  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        * doc/install.texi: Remove mentions of cloog and ppl.
index 597ff8c2e1ef39668db339c7ee2a9ea8edbecb6d..1b0d30257444c140359a1015d4c96bd22bc10310 100644 (file)
   [(set_attr "type" "no_insn")]
 )
 
+(define_insn "prefetch"
+  [(prefetch (match_operand:DI 0 "address_operand" "r")
+            (match_operand:QI 1 "const_int_operand" "")
+            (match_operand:QI 2 "const_int_operand" ""))]
+  ""
+  {
+    const char * pftype[2][4] = 
+    {
+      {"prfm\\tPLDL1STRM, %a0",
+       "prfm\\tPLDL3KEEP, %a0",
+       "prfm\\tPLDL2KEEP, %a0",
+       "prfm\\tPLDL1KEEP, %a0"},
+      {"prfm\\tPSTL1STRM, %a0",
+       "prfm\\tPSTL3KEEP, %a0",
+       "prfm\\tPSTL2KEEP, %a0",
+       "prfm\\tPSTL1KEEP, %a0"},
+    };
+
+    int locality = INTVAL (operands[2]);
+
+    gcc_assert (IN_RANGE (locality, 0, 3));
+
+    return pftype[INTVAL(operands[1])][locality];
+  }
+  [(set_attr "type" "load1")]
+)
+
 (define_insn "trap"
   [(trap_if (const_int 1) (const_int 8))]
   ""