<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Many unnecessary mov instructions near call site"
   href="https://llvm.org/bugs/show_bug.cgi?id=26114">26114</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Many unnecessary mov instructions near call site
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Register Allocator
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mcrosier@codeaurora.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>atrick@apple.com, hfinkel@anl.gov, llvm-bugs@lists.llvm.org, qcolombet@apple.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>