diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-12-11 09:42:59 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-12-11 09:42:59 +0000 |
commit | 20e3b4b380e949af32eeb4f184c51bfd62286f1a (patch) | |
tree | 7f97eebcd1c8322d1e0257e5c642042e2bd55c39 /lib/Target/X86/README.txt | |
parent | a9688c4b5769be7a6a89350888b3173c97fe87ed (diff) | |
download | external_llvm-20e3b4b380e949af32eeb4f184c51bfd62286f1a.zip external_llvm-20e3b4b380e949af32eeb4f184c51bfd62286f1a.tar.gz external_llvm-20e3b4b380e949af32eeb4f184c51bfd62286f1a.tar.bz2 |
Factor the (x & 2^n) ? 2^m : 0 instcombine into its own method and generalize it
to catch cases where n != m with a shift.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121608 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/README.txt')
-rw-r--r-- | lib/Target/X86/README.txt | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/lib/Target/X86/README.txt b/lib/Target/X86/README.txt index a305ae6..181c1bd 100644 --- a/lib/Target/X86/README.txt +++ b/lib/Target/X86/README.txt @@ -1736,46 +1736,6 @@ Ideal output: //===---------------------------------------------------------------------===// -Testcase: -int x(int a) { return (a & 0x80) ? 0x100 : 0; } -int y(int a) { return (a & 0x80) *2; } - -Current: - testl $128, 4(%esp) - setne %al - movzbl %al, %eax - shll $8, %eax - ret - -Better: - movl 4(%esp), %eax - addl %eax, %eax - andl $256, %eax - ret - -This is another general instcombine transformation that is profitable on all -targets. In LLVM IR, these functions look like this: - -define i32 @x(i32 %a) nounwind readnone { -entry: - %0 = and i32 %a, 128 - %1 = icmp eq i32 %0, 0 - %iftmp.0.0 = select i1 %1, i32 0, i32 256 - ret i32 %iftmp.0.0 -} - -define i32 @y(i32 %a) nounwind readnone { -entry: - %0 = shl i32 %a, 1 - %1 = and i32 %0, 256 - ret i32 %1 -} - -Replacing an icmp+select with a shift should always be considered profitable in -instcombine. - -//===---------------------------------------------------------------------===// - Re-implement atomic builtins __sync_add_and_fetch() and __sync_sub_and_fetch properly. |