<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 - -mtune when targeting AArch64 can incorrectly affect the architecture version code is generated for"
   href="https://bugs.llvm.org/show_bug.cgi?id=34625">34625</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-mtune when targeting AArch64 can incorrectly affect the architecture version code is generated for
          </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>All
          </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>Backend: AArch64
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kristof.beyls@arm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ cat t.c
int f(int *a, int b, int c) {
  return __sync_val_compare_and_swap (a, b, c);
}

# cas[al] is an instruction introduced in armv8.1, so with the below command
line, generation of the cas instruction is OK (-march=armv8.1a):
$ clang -target aarch64-linux-gnu -march=armv8.1a -S t.c -O2 -o- | grep cas
        casal   w1, w2, [x0]

# thunderx2t99 is a cpu implementing armv8.1a, so generation of the cas
instruction is OK in the below command line (mcpu=thunderx2t99):
$ clang -target aarch64-linux-gnu -mcpu=thunderx2t99 -march=armv8a -S t.c -O2
-o- | grep cas
        casal   w1, w2, [x0]

# mtune shouldn't affect the architecture version targeted, so in the below
command line (march=armv8a mtune=thunderx2t99), the cas instruction should not
have been generated:
$ clang -target aarch64-linux-gnu -mtune=thunderx2t99 -march=armv8a -S t.c -O2
-o- | grep cas
        casal   w1, w2, [x0]</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>