From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 73298 invoked by alias); 28 Aug 2019 09:42:46 -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 73280 invoked by uid 89); 28 Aug 2019 09:42:46 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=H*i:sk:AM6PR10 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Aug 2019 09:42:45 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 35546337; Wed, 28 Aug 2019 02:42:43 -0700 (PDT) Received: from [10.2.206.47] (e120808-lin.cambridge.arm.com [10.2.206.47]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2D2EF3F59C; Wed, 28 Aug 2019 02:42:42 -0700 (PDT) Subject: Re: [PATCH] Sanitizing the middle-end interface to the back-end for strict alignment To: Bernd Edlinger , Richard Biener Cc: "gcc-patches@gcc.gnu.org" , Richard Earnshaw , Ramana Radhakrishnan , Eric Botcazou , Jeff Law , Jakub Jelinek References: <52c7ef9f-9fa2-6126-abf3-dc48c1a2d580@foss.arm.com> From: Kyrill Tkachov Message-ID: <86a19366-e1ee-87a4-9c5b-2fb1d32782a0@foss.arm.com> Date: Wed, 28 Aug 2019 12:01:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2019-08/txt/msg01884.txt.bz2 On 8/28/19 10:38 AM, Bernd Edlinger wrote: > On 8/27/19 11:25 AM, Kyrill Tkachov wrote: >> Hi Bernd, >> >> On 8/15/19 8:47 PM, Bernd Edlinger wrote: >>> Hi, >>> >>> this is the split out part from the "Fix not 8-byte aligned ldrd/strd on ARMv5 (PR 89544)" >>> which is sanitizing the middle-end interface to the back-end for strict alignment, >>> and a couple of bug-fixes that are necessary to survive boot-strap. >>> It is intended to be applied after the PR 89544 fix. >>> >>> I think it would be possible to change the default implementation of STACK_SLOT_ALIGNMENT >>> to make all stack variables always naturally aligned instead of doing that only >>> in assign_parm_setup_stack, but would still like to avoid changing too many things >>> that do not seem to have a problem.  Since this would affect many targets, and more >>> kinds of variables that may probably not have a strict alignment problem. >>> But I am ready to take your advice though. >>> >>> >>> Boot-strapped and reg-tested on x86_64-pc-linux-gnu and arm-linux-gnueabihf >>> Is it OK for trunk? >> I'm not opposed to the checks but... >> >> >>> Thanks >>> Bernd. >>> >> Index: gcc/config/arm/vec-common.md >> =================================================================== >> --- gcc/config/arm/vec-common.md    (Revision 274531) >> +++ gcc/config/arm/vec-common.md    (Arbeitskopie) >> @@ -26,6 +26,12 @@ >>    "TARGET_NEON >>     || (TARGET_REALLY_IWMMXT && VALID_IWMMXT_REG_MODE (mode))" >>  { >> +  gcc_checking_assert (!MEM_P (operands[0]) >> +               || MEM_ALIGN (operands[0]) >> +              >= GET_MODE_ALIGNMENT (mode)); >> +  gcc_checking_assert (!MEM_P (operands[1]) >> +               || MEM_ALIGN (operands[1]) >> +              >= GET_MODE_ALIGNMENT (mode)); >>    if (can_create_pseudo_p ()) >>      { >>        if (!REG_P (operands[0])) >> >> ... can we please factor the (!MEM_P (operands[0]) || MEM_ALIGN (operands[0]) >= GET_MODE_ALIGNMENT (mode)) checks into a common function and use that? >> > Sure, good idea. How about converting it to a predicate? > This creates 1:1 equivalent code to the open coded assertions. > > Is it OK for trunk? > > > Thanks > Bernd. patch-strict-align.diff 2019-08-15 Bernd Edlinger Richard Biener * expr.c (expand_assignment): Handle misaligned DECLs. (expand_expr_real_1): Handle FUNCTION_DECL as unaligned. * function.c (assign_parm_adjust_stack_rtl): Check movmisalign optab too. (assign_parm_setup_stack): Allocate properly aligned stack slots. * varasm.c (build_constant_desc): Align constants of misaligned types. * config/arm/predicates.md (aligned_operand): New predicate. * config/arm/arm.md (movdi, movsi, movhi, movhf, movsf, movdf): Use sligned_operand to check restrictions on memory addresses. typo in "aligned_operand"  * config/arm/neon.md (movti, mov, mov): Likewise. * config/arm/vec-common.md (mov): Likewise. Looks good now. Ok, thanks! Kyrill