On Wed, 15 Nov 2017, tamar.christ...@arm.com wrote:

> > -----Original Message-----
> > From: Richard Biener [mailto:rguent...@suse.de]
> > Sent: Wednesday, November 15, 2017 12:50
> > To: Tamar Christina <tamar.christ...@arm.com>
> > Cc: gcc-patches@gcc.gnu.org; nd <n...@arm.com>; l...@redhat.com;
> > i...@airs.com
> > Subject: RE: [PATCH][GCC][mid-end] Allow larger copies when target
> > supports unaligned access [Patch (1/2)]
> > 
> > On Wed, 15 Nov 2017, Tamar Christina wrote:
> > 
> > >
> > >
> > > > -----Original Message-----
> > > > From: Richard Biener [mailto:rguent...@suse.de]
> > > > Sent: Wednesday, November 15, 2017 08:24
> > > > To: Tamar Christina <tamar.christ...@arm.com>
> > > > Cc: gcc-patches@gcc.gnu.org; nd <n...@arm.com>; l...@redhat.com;
> > > > i...@airs.com
> > > > Subject: Re: [PATCH][GCC][mid-end] Allow larger copies when target
> > > > supports unaligned access [Patch (1/2)]
> > > >
> > > > 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?
> > >
> > > No because non_strict_align checks if the target supports unaligned
> > > access at all,
> > >
> > > This no_slow_unalign corresponds instead to the target
> > > slow_unaligned_access which checks that the access you want to make
> > > has a greater cost than doing an aligned access. ARM for instance
> > > always return 1 (value of STRICT_ALIGNMENT) for slow_unaligned_access
> > > while for non_strict_align it may return 0 or 1 based on the options
> > provided to the compiler.
> > >
> > > The problem is I have no way to test STRICT_ALIGNMENT or
> > > slow_unaligned_access So I had to hardcode some targets that I know it
> > does work on.
> > 
> > I see.  But then the slow_unaligned_access implementation should use
> > non_strict_align as default somehow as SLOW_UNALIGNED_ACCESS is
> > defaulted to STRICT_ALIGN.
> > 
> > Given that SLOW_UNALIGNED_ACCESS has different values for different
> > modes it would also make sense to be more specific for the testcase in
> > question, like word_mode_slow_unaligned_access to tell this only applies to
> > word_mode?
> 
> Ah, that's fair enough. I've updated the patch and the new changelog is:

Did you attach the old patch? I don't see strict_aling being tested in
the word_mode_np_slow_unalign test.

Richard.

> 
> gcc/
> 2017-11-15  Tamar Christina  <tamar.christ...@arm.com>
> 
>       * expr.c (copy_blkmode_to_reg): Fix bitsize for targets
>       with fast unaligned access.
>       * doc/sourcebuild.texi (word_mode_no_slow_unalign): New.
>       
> gcc/testsuite/
> 2017-11-15  Tamar Christina  <tamar.christ...@arm.com>
> 
>       * gcc.dg/struct-simple.c: New.
>       * lib/target-supports.exp
>       (check_effective_target_word_mode_no_slow_unalign): New.
> 
> Ok for trunk?
> 
> Thanks,
> Tamar
> 
> > 
> > Thanks,
> > Richard.
> > 
> > > Thanks,
> > > Tamar
> > > >
> > > > 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)
> > >
> > >
> > 
> > --
> > Richard Biener <rguent...@suse.de>
> > SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton,
> > HRB 21284 (AG Nuernberg)
> 

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

Reply via email to