Message ID | AM6PR10MB2566CF802CF95AF0488FDD25E4B50@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM |
---|---|
State | New |
Headers | show |
Series | Fix PR 91684 | expand |
I just noticed that the effective target is not right, this needs to be prefer_ldrd_strd instead of arm_ldrd_strd_ok, otherwise the ldrd is not generated. Committed the following fix to the test case as obvious: Index: gcc.target/arm/pr91684.c =================================================================== --- gcc.target/arm/pr91684.c (revision 275488) +++ gcc.target/arm/pr91684.c (revision 275489) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-require-effective-target arm_ldrd_strd_ok } */ +/* { dg-require-effective-target arm_prefer_ldrd_strd } */ /* { dg-options "-O3" } */ typedef struct { int a, b, c; } S; Index: ChangeLog =================================================================== --- ChangeLog (revision 275488) +++ ChangeLog (revision 275489) @@ -1,3 +1,7 @@ +2019-09-07 Bernd Edlinger <bernd.edlinger@hotmail.de> + + * gcc.target/arm/pr91684.c: Use effective-target arm_prefer_ldrd_strd. + 2019-09-07 David Edelsohn <dje.gcc@gmail.com> * g++.dg/cpp2a/decomp2.C: Add TLS options. On 9/7/19 6:39 AM, Bernd Edlinger wrote: > Hi, > > this fixes PR 91684, where an only 4-byte aligned memory is used with movdi, > which is formally invalid for strict alignment, but okay for prefer_ldrd_strd > targets. > > > Boot-strapped and reg-tested on arm-linux-gnueabihf. > Patch was approved via BZ. > Applied to trunk. > > > Thanks > Bernd. >
2019-09-06 Bernd Edlinger <bernd.edlinger@hotmail.de> * config/arm/arm.c (arm_block_set_aligned_non_vect): Use gen_unaligned_storedi for 4-byte aligned addresses. testsuite: 2019-09-06 Bernd Edlinger <bernd.edlinger@hotmail.de> * gcc.target/arm/pr91684.c: New test. Index: gcc/config/arm/arm.c =================================================================== --- gcc/config/arm/arm.c (revision 275409) +++ gcc/config/arm/arm.c (working copy) @@ -30352,7 +30352,10 @@ arm_block_set_aligned_non_vect (rtx dstbase, { addr = plus_constant (Pmode, dst, i); mem = adjust_automodify_address (dstbase, DImode, addr, i); - emit_move_insn (mem, reg); + if (MEM_ALIGN (mem) >= 2 * BITS_PER_WORD) + emit_move_insn (mem, reg); + else + emit_insn (gen_unaligned_storedi (mem, reg)); } } else Index: gcc/testsuite/gcc.target/arm/pr91684.c =================================================================== --- gcc/testsuite/gcc.target/arm/pr91684.c (revision 0) +++ gcc/testsuite/gcc.target/arm/pr91684.c (working copy) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_ldrd_strd_ok } */ +/* { dg-options "-O3" } */ + +typedef struct { int a, b, c; } S; + +void g (S *s); +void bug1 (void) +{ + S s; + __builtin_memset (&s, 0, sizeof (S)); + g (&s); +} + +/* { dg-final { scan-assembler-times "strd" 1 } } */