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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

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

--- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 
---
Maybe worth noting that if the complex arguments are passed
by value, to give:

struct complx_t {
    float re;
    float im;
};

complx_t
add(const complx_t a, const complx_t b) {
  return {a.re + b.re, a.im + b.im};
}

and SLP is disabled, we get:

        fmov    w4, s1
        fmov    w3, s3
        fmov    x0, d0
        fmov    x1, d2
        mov     x2, 0
        bfi     x0, x4, 32, 32
        bfi     x1, x3, 32, 32
        fmov    d0, x0
        fmov    d1, x1
        sbfx    x3, x0, 0, 32
        sbfx    x0, x1, 0, 32
        ushr    d1, d1, 32
        fmov    d3, x0
        fmov    d2, x3
        ushr    d0, d0, 32
        fadd    s2, s2, s3
        fadd    s0, s0, s1
        fmov    w1, s2
        fmov    w0, s0
        bfi     x2, x1, 0, 32
        bfi     x2, x0, 32, 32
        lsr     x0, x2, 32
        lsr     w2, w2, 0
        fmov    s1, w0
        fmov    s0, w2
        ret

which is almost impressive, in its way.

I think we need a way in gimple of “SRA-ing” the arguments
and return value, in cases where that's forced by the ABI.
I.e. provide separate incoming values of a.re and a.im,
and store them to “a” on entry.  Then similarly make the
return stmt return RETURN_DECL.re and RETURN_DECL.im
separately.

Reply via email to