https://bugs.llvm.org/show_bug.cgi?id=44469
Bug ID: 44469
Summary: [x86] x & ~0xFFFF could be emitted as 16-bit xor
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedb...@nondot.org
Reporter: til...@gmail.com
CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
llvm-...@redking.me.uk, spatel+l...@rotateright.com
uint64_t foo(uint64_t x)
{
return x & 0xFFFF'FFFF'FFFF'0000;
}
GCC: xor ax, ax (3 bytes)
Clang: and rax, 0xFFFF'0000 (6 bytes)
Same thing for 32-bit "x & 0xFFFF'0000".
As far as I'm aware the only reason 16-bit instructions are usually avoided is
because they always implicitly depend on the upper bits (but this dependency is
required here) and because the size override increases encoding length (not the
case here because it saves a 32-bit immediate).
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs