<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 - Improved support for cpu_dispatch/cpu_specific attributes and function multi-versioning in AArch64 Clang"
   href="https://bugs.llvm.org/show_bug.cgi?id=50400">50400</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Improved support for cpu_dispatch/cpu_specific attributes and function multi-versioning in AArch64 Clang
          </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>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>Backend: AArch64
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>arnaud.degrandmaison@arm.com, kristof.beyls@arm.com, llozano@chromium.org, llvm-bugs@lists.llvm.org, smithp352@googlemail.com, Ties.Stuij@arm.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre><a href="https://lwn.net/Articles/691932/">https://lwn.net/Articles/691932/</a> describes function multi-versioning (FMV),
which has a different implementation in Clang based on using the attributes
<a href="https://clang.llvm.org/docs/AttributeReference.html#cpu-dispatch">https://clang.llvm.org/docs/AttributeReference.html#cpu-dispatch</a> and
<a href="https://clang.llvm.org/docs/AttributeReference.html#cpu-specific">https://clang.llvm.org/docs/AttributeReference.html#cpu-specific</a>. This
currently is implemented only for x86 targets, and doesn't work for other
(sub-)architectures like the many variants of AArch64.

The standard implementation in
<a href="https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Basic/TargetInfo.h#L1311">https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Basic/TargetInfo.h#L1311</a>
for `CPUSpecificManglingCharacter()` makes it unreachable for unsupported
architectures. Only
<a href="https://github.com/llvm/llvm-project/blob/main/clang/lib/Basic/Targets/X86.cpp#L1081">https://github.com/llvm/llvm-project/blob/main/clang/lib/Basic/Targets/X86.cpp#L1081</a>
shows an override for this function, and also implements the other necessary
helpers for function multi-versioning.

Function multi-versioning support for AArch64 would be a substantial help in
accelerating common library code both on the Android platform and for
developers shipping native applications. In each case, we often have to choose
the lowest common denominator version of AArch64 to ensure that our software
remains portable. Manually using ifuncs is insufficient because that requires
too much effort for most developers. Other AArch64 customers would also
probably benefit from having this feature as well.</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>