llvm-6502/lib/Transforms/InstCombine
Benjamin Kramer 1db071f0da 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107866 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 11:39:10 +00:00
..
CMakeLists.txt
InstCombine.h use ArgOperand API, also tighten the type of visitFree to make this work out smoothly 2010-06-24 12:21:15 +00:00
InstCombineAddSub.cpp Floating-point add, sub, and mul are now spelled fadd, fsub, and fmul, 2010-03-02 01:11:08 +00:00
InstCombineAndOrXor.cpp Minor code simplification. 2010-04-09 14:53:59 +00:00
InstCombineCalls.cpp use getArgOperand (corrected by CallInst::ArgOffset) instead of getOperand 2010-06-30 12:38:26 +00:00
InstCombineCasts.cpp Fix instcombine's handling of alloca to accept non-i32 types. 2010-05-28 04:33:04 +00:00
InstCombineCompares.cpp use ArgOperand API 2010-06-24 16:11:44 +00:00
InstCombineLoadStoreAlloca.cpp Move FindAvailableLoadedValue isSafeToLoadUnconditionally out of 2010-05-28 16:19:17 +00:00
InstCombineMulDivRem.cpp Floating-point add, sub, and mul are now spelled fadd, fsub, and fmul, 2010-03-02 01:11:08 +00:00
InstCombinePHI.cpp fix PR6512, a case where instcombine would incorrectly merge loads 2010-03-05 18:53:28 +00:00
InstCombineSelect.cpp Teach instcombine to transform 2010-07-08 11:39:10 +00:00
InstCombineShifts.cpp use ArgOperand API 2010-06-24 00:44:01 +00:00
InstCombineSimplifyDemanded.cpp use ArgOperand API 2010-06-28 16:45:00 +00:00
InstCombineVectorOps.cpp
InstCombineWorklist.h I got tired of VISIBILITY_HIDDEN colliding with the gcc enum. Rename it 2010-05-11 20:16:09 +00:00
InstructionCombining.cpp use ArgOperand API, also tighten the type of visitFree to make this work out smoothly 2010-06-24 12:21:15 +00:00
Makefile