<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] __builtin_readcyclecounter() lead to illegal hardware instruction"
   href="https://bugs.llvm.org/show_bug.cgi?id=44307">44307</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AArch64] __builtin_readcyclecounter() lead to illegal hardware instruction
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jaron@kent-dobias.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>On my AArch64 machine (Pinebook) running Archlinux ARM, clang compiles
__builtin_readycyclecounter() but the resulting binaries crash with an illegal
hardware instruction. I'm using the version of clang packaged by Archlinux ARM.

Information on the Pinebook processor:
<a href="https://www.arm.com/products/processors/cortex-a/cortex-a53-processor.php">https://www.arm.com/products/processors/cortex-a/cortex-a53-processor.php</a>

Steps to reproduce:

% cat buildcyclecounter.c
int main(int argc, char* argv[]) {
#if __has_builtin(__builtin_readcyclecounter)
    return __builtin_readcyclecounter();
#else
#  error "__builtin_readcyclecounter not available"
#endif
}
% clang buildcyclecounter.c
% ./a.out
[1]    19966 illegal hardware instruction (core dumped)  ./a.out

System information:

% uname -a        :(
Linux HAL 5.4.3-1-ARCH #1 SMP Sat Dec 14 22:09:49 EST 2019 aarch64 GNU/Linux
% clang -v
clang version 9.0.0 (tags/RELEASE_900/final)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation:
/usr/bin/../lib/gcc/aarch64-unknown-linux-gnu/8.3.0
Found candidate GCC installation: /usr/lib/gcc/aarch64-unknown-linux-gnu/8.3.0
Selected GCC installation: /usr/bin/../lib/gcc/aarch64-unknown-linux-gnu/8.3.0
Candidate multilib: .;@m64
Selected multilib: .;@m64</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>