https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80399

wilco at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wilco at gcc dot gnu.org

--- Comment #3 from wilco at gcc dot gnu.org ---
(In reply to Andrew Pinski from comment #2)
> Related case (but I know it goes down a different path) is:
> struct ss
> {
>   int aa;
>   int s;
> };
> 
> int
> f(int a, struct ss *rn, int i)
> {
>   return rn[i-1].s == a;
> }
> 
> Which shows up in SPEC INT.

This works for me (unlike similar cases where we fail to use loads with
offsets):

        add     x1, x1, x2, sxtw 3
        ldr     w1, [x1, -4]
        cmp     w1, w0
        cset    w0, eq
        ret

That's the best possible code as when you use a[i-1], a[i], a[i+1] you don't
want 3 address computations but a single shared one and loads/stores with
simple immediate offsets.

Reply via email to