[llvm-bugs] [Bug 50537] New: Use xorl instead of xorq when possible
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun May 30 13:10:24 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50537
Bug ID: 50537
Summary: Use xorl instead of xorq when possible
Product: new-bugs
Version: 12.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: josephcsible at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
Consider this C code:
unsigned long f(unsigned long x) {
return ((x & 1) + (x >> 1)) * (((x & 1) ^ 1) + x);
}
With -Oz, Clang produces this:
f: # @f
movl %edi, %eax
andl $1, %eax
movq %rdi, %rcx
shrq %rcx
addq %rax, %rcx
xorq $1, %rax
addq %rdi, %rax
imulq %rcx, %rax
retq
https://godbolt.org/z/Kqsa58Kn9
It should do "xorl $1, %eax" instead of "xorq $1, %rax" there, as they
both have the same effect since rax will always be either 0 or 1 there, and the
latter requires an extra 1-byte REX prefix.
--
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/20210530/58a2e02d/attachment.html>
More information about the llvm-bugs
mailing list