[llvm-bugs] [Bug 27577] New: Inefficient code gen for cmove
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Apr 29 13:27:06 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27577
Bug ID: 27577
Summary: Inefficient code gen for cmove
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: hjl.tools at gmail.com
CC: david.l.kreitzer at intel.com, llvm-bugs at lists.llvm.org,
zia.ansari at intel.com
Classification: Unclassified
On x86-64, at -O2, for
---
extern int a, b;
int foo(int cond)
{
return cond == -1 ? a : b;
}
---
clang 3.7 and 3.9 generate
---
cmpl $-1, %edi
movl $a, %eax
movl $b, %ecx
cmoveq %rax, %rcx
movl (%rcx), %eax
retq
---
---
cmpl $-1, %edi
movl a(%rip), %eax
cmovne b(%rip), %eax
ret
---
is better.
--
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/20160429/624fa57a/attachment-0001.html>
More information about the llvm-bugs
mailing list