[llvm-bugs] [Bug 52142] New: [AArch64] 64-bit rev16 patterns are not recognized
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Oct 11 13:44:33 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52142
Bug ID: 52142
Summary: [AArch64] 64-bit rev16 patterns are not recognized
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Keywords: beginner
Severity: enhancement
Priority: P
Component: Backend: AArch64
Assignee: unassignedbugs at nondot.org
Reporter: pavel.iliin at arm.com
CC: arnaud.degrandmaison at arm.com,
llvm-bugs at lists.llvm.org, smithp352 at googlemail.com,
Ties.Stuij at arm.com
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211011/5f48d165/attachment.html>
More information about the llvm-bugs
mailing list