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>mode))"
  {
+  gcc_checking_assert (!MEM_P (operands[0])
+               || MEM_ALIGN (operands[0])
+              >= GET_MODE_ALIGNMENT (<MODE>mode));
+  gcc_checking_assert (!MEM_P (operands[1])
+               || MEM_ALIGN (operands[1])
+              >= GET_MODE_ALIGNMENT (<MODE>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>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<bernd.edlin...@hotmail.de>
            Richard Biener<rguent...@suse.de>

        * 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<VSTRUCT>, mov<VH>): Likewise.
        * config/arm/vec-common.md (mov<VALL>): Likewise.


Looks good now.

Ok, thanks!

Kyrill

Reply via email to