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