[ARM] PR target/71056: Don't use vectorized builtins when NEON is not available
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>
Thu, 19 May 2016 13:43:58 +0000 (13:43 +0000)
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>
Thu, 19 May 2016 13:43:58 +0000 (13:43 +0000)
PR target/71056
* config/arm/arm-builtins.c (arm_builtin_vectorized_function): Return
NULL_TREE early if NEON is not available.  Remove now redundant check
in ARM_CHECK_BUILTIN_MODE.

* gcc.target/arm/pr71056.c: New test.

From-SVN: r236459

gcc/ChangeLog
gcc/config/arm/arm-builtins.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/pr71056.c [new file with mode: 0644]

index e7d7ab8469a9005f38af144528a0c7484ca55c2d..11c0dc2ec8135df0ee12fa05ac33bf34fba33547 100644 (file)
@@ -1,3 +1,10 @@
+2016-05-19  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       PR target/71056
+       * config/arm/arm-builtins.c (arm_builtin_vectorized_function): Return
+       NULL_TREE early if NEON is not available.  Remove now redundant check
+       in ARM_CHECK_BUILTIN_MODE.
+
 2016-05-19  Maxim Ostapenko  <m.ostapenko@samsung.com>
 
        PR sanitizer/64354
index 90fb40fed24cd31ed7f718664fc9b45e58c3cfa8..68b2839879f78e8d819444fbc11d2a91f8d6279a 100644 (file)
@@ -2861,6 +2861,10 @@ arm_builtin_vectorized_function (unsigned int fn, tree type_out, tree type_in)
   int in_n, out_n;
   bool out_unsigned_p = TYPE_UNSIGNED (type_out);
 
+  /* Can't provide any vectorized builtins when we can't use NEON.  */
+  if (!TARGET_NEON)
+    return NULL_TREE;
+
   if (TREE_CODE (type_out) != VECTOR_TYPE
       || TREE_CODE (type_in) != VECTOR_TYPE)
     return NULL_TREE;
@@ -2875,7 +2879,7 @@ arm_builtin_vectorized_function (unsigned int fn, tree type_out, tree type_in)
    NULL_TREE is returned if no such builtin is available.  */
 #undef ARM_CHECK_BUILTIN_MODE
 #define ARM_CHECK_BUILTIN_MODE(C)    \
-  (TARGET_NEON && TARGET_FPU_ARMV8   \
+  (TARGET_FPU_ARMV8   \
    && flag_unsafe_math_optimizations \
    && ARM_CHECK_BUILTIN_MODE_1 (C))
 
index 037d1401e3a84cfda1ebfef47e72b87e3b10b6e3..e8bf513d41f36eb733ef2305e6c1067296c760ef 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-19  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       PR target/71056
+       * gcc.target/arm/pr71056.c: New test.
+
 2016-05-19  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        * c-c++-common/pr69669.c: Check the used mode.
diff --git a/gcc/testsuite/gcc.target/arm/pr71056.c b/gcc/testsuite/gcc.target/arm/pr71056.c
new file mode 100644 (file)
index 0000000..136754e
--- /dev/null
@@ -0,0 +1,32 @@
+/* PR target/71056.  */
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_vfp3_ok } */
+/* { dg-options "-O3 -mfpu=vfpv3" } */
+
+/* Check that compiling for a non-NEON target doesn't try to introduce
+   a NEON vectorized builtin.  */
+
+extern char *buff;
+int f2 ();
+struct T1
+{
+  int reserved[2];
+  unsigned int ip;
+  unsigned short cs;
+  unsigned short rsrv2;
+};
+void
+f3 (const char *p)
+{
+  struct T1 x;
+  __builtin_memcpy (&x, p, sizeof (struct T1));
+  x.reserved[0] = __builtin_bswap32 (x.reserved[0]);
+  x.reserved[1] = __builtin_bswap32 (x.reserved[1]);
+  x.ip = __builtin_bswap32 (x.ip);
+  x.cs = x.cs << 8 | x.cs >> 8;
+  x.rsrv2 = x.rsrv2 << 8 | x.rsrv2 >> 8;
+  if (f2 ())
+    {
+      __builtin_memcpy (buff, "\n", 1);
+    }
+}