From: Christian Bruel <christian.bruel@st.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: "kyrylo.tkachov@foss.arm.com" <kyrylo.tkachov@foss.arm.com>,
Richard Earnshaw <Richard.Earnshaw@arm.com>,
"ramana.radhakrishnan@foss.arm.com"
<ramana.radhakrishnan@foss.arm.com>,
"bschmidt@redhat.com" <bschmidt@redhat.com>,
GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][ARM,AARCH64] target/PR68674: relayout vector_types in expand_expr
Date: Fri, 22 Jan 2016 11:41:00 -0000 [thread overview]
Message-ID: <56A2154F.1050201@st.com> (raw)
In-Reply-To: <CAFiYyc3DP2CRDsNyJQo+qUM3ah5+KxzUd75Cfi1xjy-=Jyk2GA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 440 bytes --]
On 01/19/2016 04:18 PM, Richard Biener wrote:
> maybe just if (currently_expanding_to_rtl)?
>
> But yes, this looks like a safe variant of the fix.
>
> Richard.
>
thanks, currently_expanding_to_rtl works perfectly. So the final version.
I added a test for each target.
bootstrapped / tested for :
unix/-m32/-march=i586
unix
arm-qemu/
arm-qemu//-mfpu=neon
arm-qemu//-mfpu=neon-fp-armv8
aarch64-qemu
[-- Attachment #2: pr68674.patch --]
[-- Type: text/x-patch, Size: 2950 bytes --]
2016-01-21 Christian Bruel <christian.bruel@st.com>
PR target/68674
* expr.c (expand_expr_real_1): Reset DECL_MODE if VECTOR_TYPE_P changed.
2016-01-21 Christian Bruel <christian.bruel@st.com>
PR target/68674
* gcc.target/i386/pr68674.c
* gcc.target/aarch64/pr68674.c
* gcc.target/arm/pr68674.c
Index: gcc/expr.c
===================================================================
--- gcc/expr.c (revision 232724)
+++ gcc/expr.c (working copy)
@@ -9597,7 +9597,16 @@ expand_expr_real_1 (tree exp, rtx target, machine_
decl_rtl = DECL_RTL (exp);
expand_decl_rtl:
gcc_assert (decl_rtl);
- decl_rtl = copy_rtx (decl_rtl);
+
+ /* DECL_MODE might change when TYPE_MODE depends on attribute target
+ settings for VECTOR_TYPE_P that might switch for the function. */
+ if (currently_expanding_to_rtl
+ && code == VAR_DECL && MEM_P (decl_rtl)
+ && VECTOR_TYPE_P (type) && exp && DECL_MODE (exp) != mode)
+ decl_rtl = change_address (decl_rtl, TYPE_MODE (type), 0);
+ else
+ decl_rtl = copy_rtx (decl_rtl);
+
/* Record writes to register variables. */
if (modifier == EXPAND_WRITE
&& REG_P (decl_rtl)
Index: gcc/testsuite/gcc.target/aarch64/pr68674.c
===================================================================
--- gcc/testsuite/gcc.target/aarch64/pr68674.c (revision 0)
+++ gcc/testsuite/gcc.target/aarch64/pr68674.c (working copy)
@@ -0,0 +1,22 @@
+/* PR target/68674 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mcpu=generic+nosimd" } */
+
+#include <arm_neon.h>
+
+int8x8_t a;
+extern int8x8_t b;
+int16x8_t e;
+
+void __attribute__((target("+simd")))
+foo1(void)
+{
+ e = (int16x8_t) vaddl_s8(a, b);
+}
+
+int8x8_t __attribute__((target("+simd")))
+foo2(void)
+{
+ return a;
+}
+
Index: gcc/testsuite/gcc.target/arm/pr68674.c
===================================================================
--- gcc/testsuite/gcc.target/arm/pr68674.c (revision 0)
+++ gcc/testsuite/gcc.target/arm/pr68674.c (working copy)
@@ -0,0 +1,26 @@
+/* PR target/68674 */
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-options "-O2 -mfloat-abi=softfp" } */
+
+#pragma GCC target ("fpu=vfp")
+
+#include <arm_neon.h>
+
+int8x8_t a;
+extern int8x8_t b;
+int16x8_t e;
+
+void __attribute__((target("fpu=neon")))
+foo1(void)
+{
+ e = (int16x8_t) vaddl_s8(a, b);
+}
+
+int8x8_t __attribute__((target("fpu=neon")))
+foo2(void)
+{
+ return b;
+}
+
+
Index: gcc/testsuite/gcc.target/i386/pr68674.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr68674.c (revision 0)
+++ gcc/testsuite/gcc.target/i386/pr68674.c (working copy)
@@ -0,0 +1,15 @@
+/* PR target/68674 */
+/* { dg-do compile } */
+/* { dg-require-effective-target avx } */
+/* { dg-options "-O2" } */
+
+typedef int v8si __attribute__((vector_size(32)));
+
+v8si a;
+
+ __attribute__((target("avx")))
+v8si
+foo()
+{
+ return a;
+}
next prev parent reply other threads:[~2016-01-22 11:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-08 13:29 Christian Bruel
2016-01-14 13:09 ` ping:[PATCH][ARM,AARCH64] " Christian Bruel
2016-01-18 11:36 ` [PATCH][ARM,AARCH64] " Richard Biener
2016-01-19 15:01 ` Christian Bruel
2016-01-19 15:13 ` Christian Bruel
2016-01-19 15:18 ` Richard Biener
2016-01-22 11:41 ` Christian Bruel [this message]
2016-01-22 11:56 ` Richard Biener
2016-01-25 19:06 ` Christophe Lyon
2016-01-26 8:17 ` Christian Bruel
2016-01-26 9:27 ` Kyrill Tkachov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56A2154F.1050201@st.com \
--to=christian.bruel@st.com \
--cc=Richard.Earnshaw@arm.com \
--cc=bschmidt@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=kyrylo.tkachov@foss.arm.com \
--cc=ramana.radhakrishnan@foss.arm.com \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).