<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 - ".arch_extensions crypto" doesn't work as intended"
   href="https://bugs.llvm.org/show_bug.cgi?id=49048">49048</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>".arch_extensions crypto" doesn't work as intended
          </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>martin@martin.st
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>arnaud.degrandmaison@arm.com, llvm-bugs@lists.llvm.org, sander.desmalen@arm.com, smithp352@googlemail.com, Ties.Stuij@arm.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When enabling the extension "crypto" via e.g. ".arch armv8-a+crypto", this
enables a number of other extensions, including aes and sha2. When enabling it
via ".arch_extension crypto", these other extensions aren't enabled.

Repro case:

$ cat test.s
.arch_extension crypto
pmull v2.1q, v2.1d, v1.1d
$ aarch64-linux-gnu-as -c test.s
$ clang -target aarch64-linux-gnu -c test.s
test.s:2:1: error: instruction requires: aes
pmull v2.1q, v2.1d, v1.1d
^

While the corresponding case with .arch works fine:

$ cat test2.s
.arch armv8-a+crypto
pmull v2.1q, v2.1d, v1.1d
$ clang -target aarch64-linux-gnu -c test2.s

These other extensions are enabled via the ExpandCryptoAEK [1] function in e.g.
parseDirectiveArch, but that function isn't called in
parseDirectiveArchExtension. It'd be trivial to fix if we'd have a reference to
the AArch64::ArchKind which is in effect - but do we have that somewhere?

[1]
<a href="https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp#L5361-L5376">https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp#L5361-L5376</a></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>