https://bugs.llvm.org/show_bug.cgi?id=39170

            Bug ID: 39170
           Summary: [AArch64] redundant adrp/ldr on aarch64 (GCC does
                    better)
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: k...@google.com
                CC: llvm-bugs@lists.llvm.org

clang version 8.0.0 (trunk 343550)

typedef struct {
  long a, b;
} S;
void foo(S *s) {
  s->a = 1;
  s->b = 0;
}

clang++ -fomit-frame-pointer  -O3  -S -o - store16.c -target aarch64-linux

        adrp    x8, .LCPI0_0                <<<<<<<<<<<<
        ldr     q0, [x8, :lo12:.LCPI0_0]    <<<<<<<<<<<<
        str     q0, [x0]
        ret

While gcc 6.3 does this (much nicer!!): 
        mov     x1, 1           
        stp     x1, xzr, [x0]
        ret


If I change "s->b = 0" to "s->b = 1" clang generates the same code
(loads the constant)

but gcc keeps avoiding loads (still better!!)
        mov     x2, 1
        mov     x1, 2
        stp     x2, x1, [x0]
        ret

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to