This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH: ARM] PR 45335 Use ldrd and strd to access two consecutive words
- From: Paul Brook <paul at codesourcery dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: Carrot Wei <carrot at google dot com>, Richard Earnshaw <rearnsha at arm dot com>, gcc-patches at gcc dot gnu dot org, ramana dot radhakrishnan at arm dot com
- Date: Wed, 12 Jan 2011 13:19:52 +0000
- Subject: Re: [PATCH: ARM] PR 45335 Use ldrd and strd to access two consecutive words
- References: <AANLkTim+nD_6m5PwDBkz0BVz1Ftr+DYyih17nXX5LMue@mail.gmail.com> <AANLkTi=rdaKqDmLppspFbPuVKdtuw-PiXF89+w3Jk6u=@mail.gmail.com> <4D2C66FB.9090100@redhat.com>
> > Why is this restricted to Thumb mode? The ARM variant of ldrd isn't quite
> > as flexible, but still provides a useful improvement over ldm.
>
> I agree the ARM version is also useful. But it brings much less
> benefit with too much complexity (due to more restriction and insn
> pattern conflict with ldm). So I will leave it as a future
> improvement.
I'm still not convinced. Surely there's no more complexity than the current
ldm fallback bits.
> >> + /* Now ldm/stm is possible. Check for special cases ldm/stm has lower
> >> + cost. */
> >> + return false;
> >
> > Code clearly doesn't match the comment. In fact this function always
> > returns false.
>
> Richard mentioned that in some cases (specifically cortex A9) ldm has
> less cost than ldrd and we should model this in the insn pattern. This
> function is used for this. But I don't know the cortex A9 architecture
> detail, so it should be filled by somebody with more knowledge about
> it in future.
This is trivially dead code. As such it should be removed.
I consider this sort of thing to be actively harmful. At best it's likely to
bitrot and need rewriting when you implement your "future" changes. At worst
it triggers incorrectly and breaks something.
> --- pr40457-1.c (revision 165492)
> +++ pr40457-1.c (working copy)
> @@ -1,9 +1,9 @@
> -/* { dg-options "-Os" } */
> +/* { dg-options "-O2" } */
>
> /* { dg-do compile } */
>
> int bar(int* p)
This looks wrong. ldm is always smaller but is only faster on some cores, so
I'd expect compiling with -O2 to make this test less reliable.
Paul