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

            Bug ID: 64134
           Summary: (vector float){0, 0, b, a} Uses stores when it does
                    need to
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
            Target: aarch64

Take the following code:
#define vector __attribute__((vector_size(16)))

float a; float b;
vector float fb(void) { return (vector float){ 0,0,b,a};}

--- CUT ---
This produces:
fb:
    adrp    x1, b
    adrp    x0, a
    ldr    w1, [x1, #:lo12:b]
    fmov    s0, wzr
    ldr    w0, [x0, #:lo12:a]
    sub    sp, sp, #16
    stp    s0, s0, [sp]
    str    w1, [sp, 8]
    str    w0, [sp, 12]
    ldr    q0, [sp]
    add    sp, sp, 16
    ret


This is really horrible and should be done as:
fb:
    adrp    x0, a
    adrp    x1, b
    movi    v0.4s, 0
    ldr    s1, [x0, #:lo12:a]
    ldr    s2, [x1, #:lo12:b]
    ins    v0.s[3], v1.s[0]
    ins    v0.s[2], v2.s[0]
    ret

Reply via email to