aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Greenhalgh <james.greenhalgh@arm.com>2017-06-16 17:29:56 +0000
committerJames Greenhalgh <jgreenhalgh@gcc.gnu.org>2017-06-16 17:29:56 +0000
commit56960fd6d17aa4dcec9e8e261389337374cc738f (patch)
treec7a6d44001848a887fd3d9e59e0a80f00b70f604
parentec73e54d0a0d2f14f1bde8f30bdb4c089dd19857 (diff)
downloadgcc-56960fd6d17aa4dcec9e8e261389337374cc738f.zip
gcc-56960fd6d17aa4dcec9e8e261389337374cc738f.tar.gz
gcc-56960fd6d17aa4dcec9e8e261389337374cc738f.tar.bz2
[Patch ARM] Fix PR71778
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: r249272
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/arm/arm-builtins.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/arm/pr71778.c24
4 files changed, 42 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 169f014..2a4b3b7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+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-16 Jan Hubicka <hubicka@ucw.cz>
* profile.c (compare_freqs): New function.
diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c
index a0569ed..8ecf581 100644
--- a/gcc/config/arm/arm-builtins.c
+++ b/gcc/config/arm/arm-builtins.c
@@ -2245,7 +2245,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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3f91cab..84d81d3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-06-16 James Greenhalgh <james.greenhalgh@arm.com>
+
+ PR target/71778
+ * gcc.target/arm/pr71778.c: New.
+
2017-06-16 Jan Hubicka <hubicka@ucw.cz>
* gcc.dg/tree-ssa/ssa-lim-11.c: Disable branch prediction.
diff --git a/gcc/testsuite/gcc.target/arm/pr71778.c b/gcc/testsuite/gcc.target/arm/pr71778.c
new file mode 100644
index 0000000..d5b0d04
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr71778.c
@@ -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);
+}
+