<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] 64-bit rev16 patterns are not recognized"
href="https://bugs.llvm.org/show_bug.cgi?id=52142">52142</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[AArch64] 64-bit rev16 patterns are not recognized
</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>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Keywords</th>
<td>beginner
</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>pavel.iliin@arm.com
</td>
</tr>
<tr>
<th>CC</th>
<td>arnaud.degrandmaison@arm.com, llvm-bugs@lists.llvm.org, smithp352@googlemail.com, Ties.Stuij@arm.com
</td>
</tr></table>
<p>
<div>
<pre>For the following patterns:
unsigned int
rev16_32a (unsigned int a)
{
return (((unsigned int)(a) & (unsigned int)0xff00ff00UL) >> 8)
| (((unsigned int)(a) & (unsigned int)0x00ff00ffUL) << 8);
}
unsigned int
rev16_32b (unsigned int a)
{
return (((unsigned int)(a) & (unsigned int)0xa00ff00ffUL) << 8)
| (((unsigned int)(a) & (unsigned int)0xff00ff00UL) >> 8);
}
unsigned long long
rev16_64a (unsigned long long a)
{
return (((unsigned long long)(a)
& (unsigned long long)0xff00ff00ff00ff00UL) >> 8)
| (((unsigned long long)(a)
& (unsigned long long)0x00ff00ff00ff00ffUL) << 8);
}
unsigned long long
rev16_64b (unsigned long long a)
{
return (((unsigned long long)(a)
& (unsigned long long)0x00ff00ff00ff00ffUL) << 8)
| (((unsigned long long)(a)
& (unsigned long long)0xff00ff00ff00ff00UL) >> 8);
}
aarch64 clang -O2 generates:
rev16_32a(unsigned int): // @rev16_32a(unsigned int)
rev16 w0, w0
ret
rev16_32b(unsigned int): // @rev16_32b(unsigned int)
rev16 w0, w0
ret
rev16_64a(unsigned long long): // @rev16_64a(unsigned
long long)
lsr x8, x0, #8
lsl x9, x0, #8
and x8, x8, #0xff00ff00ff00ff
and x9, x9, #0xff00ff00ff00ff00
orr x0, x8, x9
ret
rev16_64b(unsigned long long): // @rev16_64b(unsigned
long long)
lsl x8, x0, #8
lsr x9, x0, #8
and x8, x8, #0xff00ff00ff00ff00
and x9, x9, #0xff00ff00ff00ff
orr x0, x8, x9
ret
The 32-bit forms of rev16 are recognised, but the 64-bit forms could also map
down to rev16 on X-regs.</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>