<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 - Inline assembly, sha256rnds2 and "error: invalid input constraint 'Yz' in asm""
href="https://bugs.llvm.org/show_bug.cgi?id=32727">32727</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Inline assembly, sha256rnds2 and "error: invalid input constraint 'Yz' in asm"
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.9
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>noloader@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>skylake $ cat test.cxx
#include <immintrin.h>
int main(int argc, char* argv[])
{
__m128i a, b, c;
asm ("sha256rnds2 %2, %1, %0" : "+x"(a) : "xm"(b), "Yz" (c));
}
skylake $ clang++ test.cxx -c
test.cxx:5:56: error: invalid input constraint 'Yz' in asm
asm ("sha256rnds2 %2, %1, %0" : "+x"(a) : "xm"(b), "Yz" (c));
^
1 error generated.
According to Intel, the operand labeled 'c' must be placed in %xmm0 [1].
According to GCC and manual page on machine constraints [2], the constraint is
"Yz". From [1]:
The third input to sha256rnds2 is the message dwords (Wn) added to the round
constants (Kn). This W+K value must be in the architectural XMM0 register,
since the register is implicitly used by the instruction.
$ clang++ --version
clang version 3.9.1 (tags/RELEASE_391/final)
Target: x86_64-unknown-linux-gnu
$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 25 (Twenty Five)
[1] <a href="https://software.intel.com/en-us/articles/intel-sha-extensions">https://software.intel.com/en-us/articles/intel-sha-extensions</a>
[2] <a href="https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html">https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html</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>