summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-07-21 18:17:20 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-26 08:56:30 +0100
commit012262ad6aecf85f8522d057e8eb53f6a8e1df54 (patch)
tree3b5362f8fe014b17939dac724ee4b384cdb3fc90
parent6660e95cbf8b467bfb07bce18a7457639081f1d4 (diff)
downloadpoky-012262ad6aecf85f8522d057e8eb53f6a8e1df54.tar.gz
gcc: Don't use vectorized builtins when Neon is not there
Fixes [YOCTO #9991] (From OE-Core rev: 0d69b3bf6cdeee866642529b6269391146333a43) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/gcc/gcc-6.1.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-6.1/0048-ARM-PR-target-71056-Don-t-use-vectorized-builtins-wh.patch92
2 files changed, 93 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-6.1.inc b/meta/recipes-devtools/gcc/gcc-6.1.inc
index 0426028d79..f52842d676 100644
--- a/meta/recipes-devtools/gcc/gcc-6.1.inc
+++ b/meta/recipes-devtools/gcc/gcc-6.1.inc
@@ -79,6 +79,7 @@ SRC_URI = "\
79 file://0045-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch \ 79 file://0045-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch \
80 file://0046-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \ 80 file://0046-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \
81 file://0047-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \ 81 file://0047-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
82 file://0048-ARM-PR-target-71056-Don-t-use-vectorized-builtins-wh.patch \
82 ${BACKPORTS} \ 83 ${BACKPORTS} \
83 file://CVE-2016-4490.patch \ 84 file://CVE-2016-4490.patch \
84" 85"
diff --git a/meta/recipes-devtools/gcc/gcc-6.1/0048-ARM-PR-target-71056-Don-t-use-vectorized-builtins-wh.patch b/meta/recipes-devtools/gcc/gcc-6.1/0048-ARM-PR-target-71056-Don-t-use-vectorized-builtins-wh.patch
new file mode 100644
index 0000000000..9c39c7f7ad
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-6.1/0048-ARM-PR-target-71056-Don-t-use-vectorized-builtins-wh.patch
@@ -0,0 +1,92 @@
1From 84d2a5509892b65ed60d39e6e2f9719e3762e40e Mon Sep 17 00:00:00 2001
2From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Tue, 31 May 2016 08:29:39 +0000
4Subject: [PATCH] [ARM] PR target/71056: Don't use vectorized builtins when
5 NEON is not available
6
7 PR target/71056
8 * config/arm/arm-builtins.c (arm_builtin_vectorized_function): Return
9 NULL_TREE early if NEON is not available. Remove now redundant check
10 in ARM_CHECK_BUILTIN_MODE.
11
12 * gcc.target/arm/pr71056.c: New test.
13
14
15
16git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@236910 138bc75d-0d04-0410-961f-82ee72b054a4
17---
18Upstream-Status: Backport
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20
21 gcc/ChangeLog | 7 +++++++
22 gcc/config/arm/arm-builtins.c | 6 +++++-
23 gcc/testsuite/ChangeLog | 5 +++++
24 gcc/testsuite/gcc.target/arm/pr71056.c | 32 ++++++++++++++++++++++++++++++++
25 4 files changed, 49 insertions(+), 1 deletion(-)
26 create mode 100644 gcc/testsuite/gcc.target/arm/pr71056.c
27
28diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c
29index 90fb40f..68b2839 100644
30--- a/gcc/config/arm/arm-builtins.c
31+++ b/gcc/config/arm/arm-builtins.c
32@@ -2861,6 +2861,10 @@ arm_builtin_vectorized_function (unsigned int fn, tree type_out, tree type_in)
33 int in_n, out_n;
34 bool out_unsigned_p = TYPE_UNSIGNED (type_out);
35
36+ /* Can't provide any vectorized builtins when we can't use NEON. */
37+ if (!TARGET_NEON)
38+ return NULL_TREE;
39+
40 if (TREE_CODE (type_out) != VECTOR_TYPE
41 || TREE_CODE (type_in) != VECTOR_TYPE)
42 return NULL_TREE;
43@@ -2875,7 +2879,7 @@ arm_builtin_vectorized_function (unsigned int fn, tree type_out, tree type_in)
44 NULL_TREE is returned if no such builtin is available. */
45 #undef ARM_CHECK_BUILTIN_MODE
46 #define ARM_CHECK_BUILTIN_MODE(C) \
47- (TARGET_NEON && TARGET_FPU_ARMV8 \
48+ (TARGET_FPU_ARMV8 \
49 && flag_unsafe_math_optimizations \
50 && ARM_CHECK_BUILTIN_MODE_1 (C))
51
52diff --git a/gcc/testsuite/gcc.target/arm/pr71056.c b/gcc/testsuite/gcc.target/arm/pr71056.c
53new file mode 100644
54index 0000000..136754e
55--- /dev/null
56+++ b/gcc/testsuite/gcc.target/arm/pr71056.c
57@@ -0,0 +1,32 @@
58+/* PR target/71056. */
59+/* { dg-do compile } */
60+/* { dg-require-effective-target arm_vfp3_ok } */
61+/* { dg-options "-O3 -mfpu=vfpv3" } */
62+
63+/* Check that compiling for a non-NEON target doesn't try to introduce
64+ a NEON vectorized builtin. */
65+
66+extern char *buff;
67+int f2 ();
68+struct T1
69+{
70+ int reserved[2];
71+ unsigned int ip;
72+ unsigned short cs;
73+ unsigned short rsrv2;
74+};
75+void
76+f3 (const char *p)
77+{
78+ struct T1 x;
79+ __builtin_memcpy (&x, p, sizeof (struct T1));
80+ x.reserved[0] = __builtin_bswap32 (x.reserved[0]);
81+ x.reserved[1] = __builtin_bswap32 (x.reserved[1]);
82+ x.ip = __builtin_bswap32 (x.ip);
83+ x.cs = x.cs << 8 | x.cs >> 8;
84+ x.rsrv2 = x.rsrv2 << 8 | x.rsrv2 >> 8;
85+ if (f2 ())
86+ {
87+ __builtin_memcpy (buff, "\n", 1);
88+ }
89+}
90--
912.9.0
92