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

            Bug ID: 26114
           Summary: Many unnecessary mov instructions near call site
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Register Allocator
          Assignee: unassignedb...@nondot.org
          Reporter: mcros...@codeaurora.org
                CC: atr...@apple.com, hfin...@anl.gov,
                    llvm-bugs@lists.llvm.org, qcolom...@apple.com
    Classification: Unclassified

Test case:
void foo(char *c, short s, float X, char C, long long LL, int I, double D);

void test(short s, float X, char C, long long LL, int I, double D) {
  foo("test", s, X, C, LL, I, D);
}

On AArch64 at -O3 the assembly output is as follows:
test:
        mov      w8, w3
        mov      x9, x2
        mov      w10, w1
        mov      w11, w0
        adrp    x0, .L.str
        add     x0, x0, :lo12:.L.str
        mov      w1, w11
        mov      w2, w10
        mov      x3, x9
        mov      w4, w8
        b       foo

We should be able to generate something like this:
test:
        adrp    x5, .LC0
        mov     w4, w3
        mov     x3, x2
        mov     w2, w1
        mov     w1, w0
        add     x0, x5, :lo12:.LC0
        b       foo

Which has 4 fewer moves.

-- 
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