<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - [AArch64] redundant adrp/ldr on aarch64 (GCC does better)"
   href="https://bugs.llvm.org/show_bug.cgi?id=39170">39170</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AArch64] redundant adrp/ldr on aarch64 (GCC does better)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kcc@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</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>