llvm-6502/lib/Transforms/Scalar
Chris Lattner 87875dac89 Turn select C, (X+Y), (X-Y) --> (X+(select C, Y, (-Y))). This occurs in
the 'sim' program and probably elsewhere.  In sim, it comes up for cases
like this:

#define round(x) ((x)>0.0 ? (x)+0.5 : (x)-0.5)
double G;
void T(double X) { G = round(X); }

(it uses the round macro a lot).  This changes the LLVM code from:

        %tmp.1 = setgt double %X, 0.000000e+00          ; <bool> [#uses=1]
        %tmp.4 = add double %X, 5.000000e-01            ; <double> [#uses=1]
        %tmp.6 = sub double %X, 5.000000e-01            ; <double> [#uses=1]
        %mem_tmp.0 = select bool %tmp.1, double %tmp.4, double %tmp.6
        store double %mem_tmp.0, double* %G

to:

        %tmp.1 = setgt double %X, 0.000000e+00          ; <bool> [#uses=1]
        %mem_tmp.0.p = select bool %tmp.1, double 5.000000e-01, double -5.000000e-01
        %mem_tmp.0 = add double %mem_tmp.0.p, %X
        store double %mem_tmp.0, double* %G
        ret void


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19537 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13 22:52:24 +00:00
..
ADCE.cpp Change indentation of a whole bunch of code, no real changes here. 2004-12-12 23:49:37 +00:00
BasicBlockPlacement.cpp Add more missing createXxxPass functions. 2005-01-08 17:21:40 +00:00
ConstantProp.cpp Prototype these functions more accurately 2004-09-20 04:43:15 +00:00
CorrelatedExprs.cpp Prototype these functions more accurately 2004-09-20 04:43:15 +00:00
DCE.cpp Prototype these functions more accurately 2004-09-20 04:43:15 +00:00
DeadStoreElimination.cpp Fix uint64_t -> unsigned VS warnings. 2005-01-08 19:42:22 +00:00
GCSE.cpp Simplify code and do not invalidate iterators. 2004-12-12 18:23:20 +00:00
IndVarSimplify.cpp Convert 'struct' to 'class' in various places to adhere to the coding standards 2004-10-27 16:14:51 +00:00
InstructionCombining.cpp Turn select C, (X+Y), (X-Y) --> (X+(select C, Y, (-Y))). This occurs in 2005-01-13 22:52:24 +00:00
LICM.cpp Adjust to new interfaces 2004-12-15 07:22:25 +00:00
LoopStrengthReduce.cpp Initial implementation of the strength reduction for GEP instructions in 2004-10-18 21:08:22 +00:00
LoopUnroll.cpp Silence VS warnings. 2005-01-08 19:37:20 +00:00
LoopUnswitch.cpp Put createLoopUnswitchPass() into proper namespace 2005-01-06 05:47:18 +00:00
LowerConstantExprs.cpp Fix #includes of i*.h => Instructions.h as per PR403. 2004-07-29 17:05:13 +00:00
LowerGC.cpp Initialize with the correct constant type 2004-10-27 03:55:24 +00:00
LowerPacked.cpp Fix the exposed prototype for the lower packed pass, thanks to 2004-11-19 16:49:34 +00:00
Makefile Change Library Names Not To Conflict With Others When Installed 2004-10-27 23:18:45 +00:00
PRE.cpp Add more missing createXxxPass functions. 2005-01-08 17:21:40 +00:00
Reassociate.cpp Changes For Bug 352 2004-09-01 22:55:40 +00:00
ScalarReplAggregates.cpp Silence warnings 2005-01-08 19:34:41 +00:00
SCCP.cpp Silence warnings 2005-01-08 19:34:41 +00:00
SimplifyCFG.cpp Hrm, some people complain when the compiler cheerfully tells them what it's 2004-10-19 06:33:16 +00:00
TailDuplication.cpp Do not count debugger intrinsics in size estimation. 2004-11-22 17:23:57 +00:00
TailRecursionElimination.cpp Changes For Bug 352 2004-09-01 22:55:40 +00:00