]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PATCH AArch64] Prefer dup to zip for vec_perm_const; enable dup for bigendian; add...
authorAlan Lawrence <alan.lawrence@arm.com>
Wed, 6 Aug 2014 10:17:05 +0000 (10:17 +0000)
committerAlan Lawrence <alalaw01@gcc.gnu.org>
Wed, 6 Aug 2014 10:17:05 +0000 (10:17 +0000)
gcc/:
* config/aarch64/aarch64.c (aarch64_evpc_dup): Enable for bigendian.
(aarch64_expand_vec_perm_const): Check for dup before zip.

gcc/testsuite:

* gcc.target/aarch64/vdup_n_2.c: New test.

From-SVN: r213659

gcc/ChangeLog
gcc/config/aarch64/aarch64.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/vdup_n_2.c [new file with mode: 0644]

index b0999838df7809bd21e7c2d20c3990486b1a22b8..39111746c3bfbaecdfb90945c6a56e490b811ceb 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-06  Alan Lawrence  <alan.lawrence@arm.com>
+
+       * config/aarch64/aarch64.c (aarch64_evpc_dup): Enable for bigendian.
+       (aarch64_expand_vec_perm_const): Check for dup before zip.
+
 2014-08-06  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * config/aarch64/aarch64.c (aarch64_classify_address): Use REG_P and
index 5ccd860e400573cbdcb3cdb9a30c1de403dab4ee..11654283055996a59a17f721948d0f3cdbb8229b 100644 (file)
@@ -9378,10 +9378,6 @@ aarch64_evpc_dup (struct expand_vec_perm_d *d)
   unsigned int i, elt, nelt = d->nelt;
   rtx lane;
 
-  /* TODO: This may not be big-endian safe.  */
-  if (BYTES_BIG_ENDIAN)
-    return false;
-
   elt = d->perm[0];
   for (i = 1; i < nelt; i++)
     {
@@ -9395,7 +9391,7 @@ aarch64_evpc_dup (struct expand_vec_perm_d *d)
      use d->op0 and need not do any extra arithmetic to get the
      correct lane number.  */
   in0 = d->op0;
-  lane = GEN_INT (elt);
+  lane = GEN_INT (elt); /* The pattern corrects for big-endian.  */
 
   switch (vmode)
     {
@@ -9476,14 +9472,14 @@ aarch64_expand_vec_perm_const_1 (struct expand_vec_perm_d *d)
        return true;
       else if (aarch64_evpc_ext (d))
        return true;
+      else if (aarch64_evpc_dup (d))
+       return true;
       else if (aarch64_evpc_zip (d))
        return true;
       else if (aarch64_evpc_uzp (d))
        return true;
       else if (aarch64_evpc_trn (d))
        return true;
-      else if (aarch64_evpc_dup (d))
-       return true;
       return aarch64_evpc_tbl (d);
     }
   return false;
index 7f517fa4a62238e15d5595fe5d24a507cce31a11..096c489696f0e13a61b231f7757d534d67a8d3c1 100644 (file)
@@ -1,3 +1,7 @@
+2014-08-06  Alan Lawrence  <alan.lawrence@arm.com>
+
+       * gcc.target/aarch64/vdup_n_2.c: New test.
+
 2014-08-06  Maciej W. Rozycki  <macro@codesourcery.com>
 
        * gcc.dg/pr44194-1.c: Also exclude powerpc*-*-linux*, except if
diff --git a/gcc/testsuite/gcc.target/aarch64/vdup_n_2.c b/gcc/testsuite/gcc.target/aarch64/vdup_n_2.c
new file mode 100644 (file)
index 0000000..660fb0f
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline --save-temps" } */
+
+extern void abort (void);
+
+typedef float float32x2_t __attribute__ ((__vector_size__ ((8))));
+typedef unsigned int uint32x2_t __attribute__ ((__vector_size__ ((8))));
+
+float32x2_t
+test_dup_1 (float32x2_t in)
+{
+  return __builtin_shuffle (in, (uint32x2_t) {1, 1});
+}
+
+int
+main (int argc, char **argv)
+{
+  float32x2_t test = {2.718, 3.141};
+  float32x2_t res = test_dup_1 (test);
+  if (res[0] != test[1] || res[1] != test[1])
+    abort ();
+  return 0;
+}
+
+/* { dg-final { scan-assembler-times "\[ \t\]*dup\[ \t\]+v\[0-9\]+\.2s, ?v\[0-9\]+\.s\\\[\[01\]\\\]" 1 } } */
+/* { dg-final { scan-assembler-not "zip" } } */
+/* { dg-final { cleanup-saved-temps } } */
+