On Tue, 14 Nov 2017, Tamar Christina wrote:

> Hi All,
> 
> This patch allows larger bitsizes to be used as copy size
> when the target does not have SLOW_UNALIGNED_ACCESS.
> 
> fun3:
>       adrp    x2, .LANCHOR0
>       add     x2, x2, :lo12:.LANCHOR0
>       mov     x0, 0
>       sub     sp, sp, #16
>       ldrh    w1, [x2, 16]
>       ldrb    w2, [x2, 18]
>       add     sp, sp, 16
>       bfi     x0, x1, 0, 8
>       ubfx    x1, x1, 8, 8
>       bfi     x0, x1, 8, 8
>       bfi     x0, x2, 16, 8
>       ret
> 
> is turned into
> 
> fun3:
>       adrp    x0, .LANCHOR0
>       add     x0, x0, :lo12:.LANCHOR0
>       sub     sp, sp, #16
>       ldrh    w1, [x0, 16]
>       ldrb    w0, [x0, 18]
>       strh    w1, [sp, 8]
>       strb    w0, [sp, 10]
>       ldr     w0, [sp, 8]
>       add     sp, sp, 16
>       ret
> 
> which avoids the bfi's for a simple 3 byte struct copy.
> 
> Regression tested on aarch64-none-linux-gnu and x86_64-pc-linux-gnu and no 
> regressions.
> 
> This patch is just splitting off from the previous combined patch with 
> AArch64 and adding
> a testcase.
> 
> I assume Jeff's ACK from 
> https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01523.html is still
> valid as the code did not change.

Given your no_slow_unalign isn't mode specific can't you use the existing
non_strict_align?

Otherwise the expr.c change looks ok.

Thanks,
Richard.

> Thanks,
> Tamar
> 
> 
> gcc/
> 2017-11-14  Tamar Christina  <tamar.christ...@arm.com>
> 
>       * expr.c (copy_blkmode_to_reg): Fix bitsize for targets
>       with fast unaligned access.
>       * doc/sourcebuild.texi (no_slow_unalign): New.
>       
> gcc/testsuite/
> 2017-11-14  Tamar Christina  <tamar.christ...@arm.com>
> 
>       * gcc.dg/struct-simple.c: New.
>       * lib/target-supports.exp
>       (check_effective_target_no_slow_unalign): New.
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 
21284 (AG Nuernberg)

Reply via email to