[LLVMbugs] [Bug 18602] New: A move to a specific target register is often not optimized away
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Jan 24 09:36:27 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=18602
Bug ID: 18602
Summary: A move to a specific target register is often not
optimized away
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: jn at sirrida.de
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
A move to a specific target register is often not optimized away.
This unnecessarily costs 2 bytes code:
int test(int x) {
return ((x>>2) & 15) ^ ((x>>3) & 31);
}
=> clang -O3
movl %edi, %eax
shrl $2, %eax
andl $15, %eax
shrl $3, %edi
andl $31, %edi
xorl %eax, %edi //
movl %edi, %eax // could become xorl %edi, %eax
retq // we need %eax here
int test(int x, int y) {
return (((x>>2) & 15) ^ ((x<<3) & ~31)) / y;
}
=> clang -O3
movl %edi, %eax
shrl $2, %eax
andl $15, %eax
shll $3, %edi
andl $-32, %edi
orl %eax, %edi //
movl %edi, %eax // could become orl %edi, %eax
cltd // we need %eax here
idivl %esi
retq
--
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/20140124/74b423fc/attachment.html>
More information about the llvm-bugs
mailing list