From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78638 invoked by alias); 22 Jan 2016 11:41:16 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 78623 invoked by uid 89); 22 Jan 2016 11:41:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=BAYES_05,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,KHOP_DYNAMIC,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=neonfparmv8, neon-fp-armv8, sk:christi, christianbruelstcom X-HELO: mx07-00178001.pphosted.com Received: from mx08-00178001.pphosted.com (HELO mx07-00178001.pphosted.com) (91.207.212.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 22 Jan 2016 11:41:13 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id u0MBdFGF013246; Fri, 22 Jan 2016 12:41:07 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 20fbv8psus-1 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 22 Jan 2016 12:41:07 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id EEDC531; Fri, 22 Jan 2016 11:40:16 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas5.st.com [10.75.90.71]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 33EAC1454; Fri, 22 Jan 2016 11:41:04 +0000 (GMT) Received: from [164.129.122.197] (164.129.122.197) by webmail-eu.st.com (10.75.90.13) with Microsoft SMTP Server (TLS) id 8.3.406.0; Fri, 22 Jan 2016 12:41:03 +0100 Subject: Re: [PATCH][ARM,AARCH64] target/PR68674: relayout vector_types in expand_expr To: Richard Biener References: <568FB9AA.5020706@st.com> <569E4FCA.3070704@st.com> <569E5281.2050009@st.com> CC: "kyrylo.tkachov@foss.arm.com" , Richard Earnshaw , "ramana.radhakrishnan@foss.arm.com" , "bschmidt@redhat.com" , GCC Patches From: Christian Bruel X-No-Archive: yes Message-ID: <56A2154F.1050201@st.com> Date: Fri, 22 Jan 2016 11:41:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------050406000406000404050603" X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-01-22_04:,, signatures=0 X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg01735.txt.bz2 --------------050406000406000404050603 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 440 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 --------------050406000406000404050603 Content-Type: text/x-patch; name="pr68674.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr68674.patch" Content-length: 2950 2016-01-21 Christian Bruel PR target/68674 * expr.c (expand_expr_real_1): Reset DECL_MODE if VECTOR_TYPE_P changed. 2016-01-21 Christian Bruel 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 + +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 + +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; +} --------------050406000406000404050603--