diff options
author | Chris Lattner <sabre@nondot.org> | 2010-12-05 01:23:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-12-05 01:23:24 +0000 |
commit | 342e6ea5f92608893dc864eba0bb60151fd90b82 (patch) | |
tree | afb19717bc67597a42cc4d7eb4ba39d25a5ba56b /clang/lib/CodeGen/CGObjC.cpp | |
parent | 0523388d608583398eed1c6989b687f902e8c1b0 (diff) | |
download | bcm5719-llvm-342e6ea5f92608893dc864eba0bb60151fd90b82.tar.gz bcm5719-llvm-342e6ea5f92608893dc864eba0bb60151fd90b82.zip |
Improve an integer select optimization in two ways:
1. generalize
(select (x == 0), -1, 0) -> (sign_bit (x - 1))
to:
(select (x == 0), -1, y) -> (sign_bit (x - 1)) | y
2. Handle the identical pattern that happens with !=:
(select (x != 0), y, -1) -> (sign_bit (x - 1)) | y
cmov is often high latency and can't fold immediates or
memory operands. For example for (x == 0) ? -1 : 1, before
we got:
< testb %sil, %sil
< movl $-1, %ecx
< movl $1, %eax
< cmovel %ecx, %eax
now we get:
> cmpb $1, %sil
> sbbl %eax, %eax
> orl $1, %eax
llvm-svn: 120929
Diffstat (limited to 'clang/lib/CodeGen/CGObjC.cpp')
0 files changed, 0 insertions, 0 deletions