]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport: [Patch ARM] Fix PR71778
authorJames Greenhalgh <james.greenhalgh@arm.com>
Mon, 19 Jun 2017 17:12:12 +0000 (17:12 +0000)
committerJames Greenhalgh <jgreenhalgh@gcc.gnu.org>
Mon, 19 Jun 2017 17:12:12 +0000 (17:12 +0000)
gcc/

PR target/71778
* config/arm/arm-builtins.c (arm_expand_builtin_args): Return TARGET
if given a non-constant argument for an intrinsic which requires a
constant.

gcc/testsuite/

PR target/71778
* gcc.target/arm/pr71778.c: New.

From-SVN: r249380

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

index 02a6b92be58660e4c0715552f501c59664ab705b..b24b70c7ef819ea3b45b6019b0db4ad37c6dfce8 100644 (file)
@@ -1,3 +1,13 @@
+2017-06-19  James Greenhalgh  <james.greenhalgh@arm.com>
+
+       Backport from mainline
+       2017-06-16  James Greenhalgh  <james.greenhalgh@arm.com>
+
+       PR target/71778
+       * config/arm/arm-builtins.c (arm_expand_builtin_args): Return TARGET
+       if given a non-constant argument for an intrinsic which requires a
+       constant.
+
 2017-06-15  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR rtl-optimization/80474
index 68b2839879f78e8d819444fbc11d2a91f8d6279a..92293c26824881bf5ca5c401fd54c3f2f162552c 100644 (file)
@@ -2121,7 +2121,12 @@ constant_arg:
                {
                  error ("%Kargument %d must be a constant immediate",
                         exp, argc + 1);
-                 return const0_rtx;
+                 /* We have failed to expand the pattern, and are safely
+                    in to invalid code.  But the mid-end will still try to
+                    build an assignment for this node while it expands,
+                    before stopping for the error, just pass it back
+                    TARGET to ensure a valid assignment.  */
+                 return target;
                }
              break;
 
index 0ea0587a70240a5b1f10aef2bdee0310e9eb70a2..620e3c616de4ed0d8c3d6de08fa2cc657543da4e 100644 (file)
@@ -1,3 +1,11 @@
+2017-06-19  James Greenhalgh  <james.greenhalgh@arm.com>
+
+       Backport from mainline
+       2017-06-16  James Greenhalgh  <james.greenhalgh@arm.com>
+
+       PR target/71778
+       * gcc.target/arm/pr71778.c: New.
+
 2017-06-09  Janus Weil  <janus@gcc.gnu.org>
 
        Backport from trunk
diff --git a/gcc/testsuite/gcc.target/arm/pr71778.c b/gcc/testsuite/gcc.target/arm/pr71778.c
new file mode 100644 (file)
index 0000000..d5b0d04
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile }  */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_neon } */
+
+typedef __simd128_int32_t int32x4_t;
+
+__extension__ extern __inline int32x4_t
+__attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
+vshrq_n_s32 (int32x4_t __a, const int __b)
+{
+  /* Errors for arm_neon.h intrinsics using constants end up on the line
+     in arm_neon.h rather than the source file line.  That means we
+     need to put the dg-error up here, rather than on line 22 where we'd
+     like it.  */
+  return (int32x4_t)__builtin_neon_vshrs_nv4si (__a, __b); /* { dg-error "argument 2 must be a constant immediate" } */
+}
+
+int32x4_t
+shift (int32x4_t a, int b)
+{
+  return vshrq_n_s32 (a, b);
+}
+