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: [email protected]
Reporter: [email protected]
CC: [email protected],
[email protected], [email protected],
[email protected]
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._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs