From patchwork Thu Dec 17 09:02:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Bruel X-Patchwork-Id: 558137 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6C9691402ED for ; Thu, 17 Dec 2015 20:02:28 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=G2qi+eqH; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=a5GV2Y6Iul83HhGKm 3/USYFV/jVUcAJUzEKhy0dx4hLqsCJAwmz3iiPzJ8H9J7hgc1bWrwVsXMj9qsICo 4doelnQrVbaJLSPSORlXhM++erHYGUyZePvTRM1xMX5nIz1lh2ZhsJIHb+VxqUdS TqQCwt0hOr0vfoypzXmFwMvv70= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=+hCopTtwCsDMhMnTBWrTs18 0pDo=; b=G2qi+eqHENu6XQn90LdI/HPV0BrgBsnrOqElifVxRjkTZPDXgdolmpV b3sukla+RwHKv+4t0Tosl66kzRUzFJz83p8edptPtqNZXwTeI+QaP3k6XT7R3I+Z LvJtI3qE2dOhaoTKt0lLUFf8w8GsqDgH5i9PFTM/hFtNSoUTvoyY= Received: (qmail 130130 invoked by alias); 17 Dec 2015 09:02:20 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 130116 invoked by uid 89); 17 Dec 2015 09:02:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=H*RU:8.3.389.2, H*r:ip*8.3.389.2, H*RU:pps.filterd, Hx-spam-relays-external:pps.filterd X-HELO: mx07-00178001.pphosted.com Received: from mx07-00178001.pphosted.com (HELO mx07-00178001.pphosted.com) (62.209.51.94) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 17 Dec 2015 09:02:17 +0000 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by m0046037.ppops.net (8.14.5/8.14.5) with SMTP id tBH8qDZe002207; Thu, 17 Dec 2015 10:02:13 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by m0046037.ppops.net with ESMTP id 1ytnr9232j-1 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 17 Dec 2015 10:02:13 +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 7FD965C; Thu, 17 Dec 2015 09:01:31 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas4.st.com [10.75.90.69]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 5B8C22AEA; Thu, 17 Dec 2015 09:02:08 +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.389.2; Thu, 17 Dec 2015 10:02:07 +0100 Subject: Re: [PATCH][LTO,ARM] Fix vector TYPE_MODE in streaming-out To: Richard Biener , Bernd Schmidt References: <56702D44.1010103@st.com> <56703C54.5090309@redhat.com> CC: GCC Patches From: Christian Bruel X-No-Archive: yes Message-ID: <56727A0F.9050103@st.com> Date: Thu, 17 Dec 2015 10:02:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.15.21, 1.0.33, 0.0.0000 definitions=2015-12-16_09:2015-12-16, 2015-12-16, 1970-01-01 signatures=0 X-IsSubscribed: yes On 12/16/2015 10:48 AM, Richard Biener wrote: > On Tue, Dec 15, 2015 at 5:14 PM, Bernd Schmidt wrote: >> On 12/15/2015 04:09 PM, Christian Bruel wrote: >>> >>> in "normal" mode, the TYPE_MODE for vector_type __simd64_int8_t is set >>> to V8QImode by arm_vector_mode_supported_p during the builtins type >>> initializations, thanks to TARGET_NEON set bu the global flag. >>> >>> Now, in LTO mode the streamer writes the information for this >>> vector_type as a scalar DImode, causing ICEs during arm_expand_builtin. >>> The root cause of this is that the streamer-out uses TYPE_MODE in a >>> context where the target_flags are not known return false for TARGET_NEON. >>> >>> The streamer-in then will then read the wrong mode that propagates to >>> the back-end. >> >> >>> static void >>> pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr) >>> { >>> - bp_pack_machine_mode (bp, TYPE_MODE (expr)); >>> + bp_pack_machine_mode (bp, expr->type_common.mode); >> >> >> This looks sensible given that tree-streamer-in uses SET_TYPE_MODE, which >> just writes expr->type_common.mode. >> >> Make a new macro TYPE_MODE_RAW for this and I think the patch is ok >> (although there's precedent for direct access in vector_type_mode, but I >> think that's just bad). > > Yeah, though it's well-hidden ;) > > I think the patch is ok if you add a comment why we're not using TYPE_MODE here > and if the patch passes the x86_64 vectorizer testsuite with -m32 -march=i586 > with no regressions (I do expect some FAILs with -march=i586 but the > patch shouldn't > regress anything). Thanks, no regressions for unix\{-m32/-march=i586,\}, arm and aarch64. I'm about to commit the attached patch. Christian > > Thanks, > Richard. > > >> >> Bernd 2015-12-16 Christian Bruel * tree.h (TYPE_MODE_RAW): New macro. * tree-streamer-out.c (pack_ts_type_common_value_fields): Replace TYPE_MODE by TYPE_MODE_RAW. Index: tree.h =================================================================== --- tree.h (revision 231744) +++ tree.h (working copy) @@ -1793,6 +1793,7 @@ extern void protected_set_expr_location #define TYPE_MAIN_VARIANT(NODE) (TYPE_CHECK (NODE)->type_common.main_variant) #define TYPE_CONTEXT(NODE) (TYPE_CHECK (NODE)->type_common.context) +#define TYPE_MODE_RAW(NODE) (TYPE_CHECK (NODE)->type_common.mode) #define TYPE_MODE(NODE) \ (VECTOR_TYPE_P (TYPE_CHECK (NODE)) \ ? vector_type_mode (NODE) : (NODE)->type_common.mode) Index: tree-streamer-out.c =================================================================== --- tree-streamer-out.c (revision 231744) +++ tree-streamer-out.c (working copy) @@ -308,7 +308,10 @@ pack_ts_function_decl_value_fields (stru static void pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr) { - bp_pack_machine_mode (bp, TYPE_MODE (expr)); + /* for VECTOR_TYPE, TYPE_MODE reevaluates the mode using target_flags + not necessary valid in a global context. + Use the raw value previously set by layout_type. */ + bp_pack_machine_mode (bp, TYPE_MODE_RAW (expr)); bp_pack_value (bp, TYPE_STRING_FLAG (expr), 1); /* TYPE_NO_FORCE_BLK is private to stor-layout and need no streaming. */