diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-07-08 11:39:10 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-07-08 11:39:10 +0000 |
| commit | 2321e6a4d4c229b58f56647275894c3e45ea57dd (patch) | |
| tree | 15204def2095617ab587cf082eee0657ef0ada43 /clang/lib/Driver/Option.cpp | |
| parent | e51a119fc6a0fbd38ee13c210c19aea657d8c746 (diff) | |
| download | bcm5719-llvm-2321e6a4d4c229b58f56647275894c3e45ea57dd.tar.gz bcm5719-llvm-2321e6a4d4c229b58f56647275894c3e45ea57dd.zip | |
Teach instcombine to transform
(X >s -1) ? C1 : C2 and (X <s 0) ? C2 : C1
into ((X >>s 31) & (C2 - C1)) + C1, avoiding the conditional.
This optimization could be extended to take non-const C1 and C2 but we better
stay conservative to avoid code size bloat for now.
for
int sel(int n) {
return n >= 0 ? 60 : 100;
}
we now generate
sarl $31, %edi
andl $40, %edi
leal 60(%rdi), %eax
instead of
testl %edi, %edi
movl $60, %ecx
movl $100, %eax
cmovnsl %ecx, %eax
llvm-svn: 107866
Diffstat (limited to 'clang/lib/Driver/Option.cpp')
0 files changed, 0 insertions, 0 deletions

