summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Don't call SimplifyDemandedBits on vectorsChris Lattner2006-03-251-1/+2
| | | | llvm-svn: 27128
* fold insertelement(buildvector) -> buildvector if the inserted element # isChris Lattner2006-03-191-0/+42
| | | | | | a constant. This implements test_constant_insert in CodeGen/Generic/vector.ll llvm-svn: 26851
* Remove BRTWOWAY*Nate Begeman2006-03-171-68/+0
| | | | | | | | Make the PPC backend not dependent on BRTWOWAY_CC and make the branch selector smarter about the code it generates, fixing a case in the readme. llvm-svn: 26814
* make sure dead token factor nodes are removed by the dag combiner.Chris Lattner2006-03-131-0/+1
| | | | llvm-svn: 26731
* Fold X+Y -> X|Y when safe. This implements:Chris Lattner2006-03-131-1/+19
| | | | | | | | Regression/CodeGen/PowerPC/and_add.ll a case that occurs with dynamic allocas of constant size. llvm-svn: 26727
* add a couple of missing foldsChris Lattner2006-03-131-0/+12
| | | | llvm-svn: 26724
* Reinstate this now that the offending opposite xform has been removed.Chris Lattner2006-03-051-0/+7
| | | | llvm-svn: 26548
* Back out fold (shl (add x, c1), c2) -> (add (shl x, c2), c1<<c2) for now.Evan Cheng2006-03-051-7/+0
| | | | | | It's causing an infinite loop compiling ldecod on x86 / Darwin. llvm-svn: 26544
* Add some simple copysign foldsChris Lattner2006-03-051-7/+59
| | | | llvm-svn: 26543
* fold (mul (add x, c1), c2) -> (add (mul x, c2), c1*c2)Chris Lattner2006-03-041-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fold (shl (add x, c1), c2) -> (add (shl x, c2), c1<<c2) This allows us to compile CodeGen/PowerPC/addi-reassoc.ll into: _test1: slwi r2, r4, 4 add r2, r2, r3 lwz r3, 36(r2) blr _test2: mulli r2, r4, 5 add r2, r2, r3 lbz r2, 11(r2) extsb r3, r2 blr instead of: _test1: addi r2, r4, 2 slwi r2, r2, 4 add r2, r3, r2 lwz r3, 4(r2) blr _test2: addi r2, r4, 2 mulli r2, r2, 5 add r2, r3, r2 lbz r2, 1(r2) extsb r3, r2 blr llvm-svn: 26535
* Fix CodeGen/Generic/2006-03-01-dagcombineinfloop.ll, an infinite loopChris Lattner2006-03-011-4/+9
| | | | | | in the dag combiner on 176.gcc on x86. llvm-svn: 26459
* Fix a typo evan noticedChris Lattner2006-03-011-1/+1
| | | | llvm-svn: 26454
* Add support for target-specific dag combinesChris Lattner2006-03-011-13/+58
| | | | llvm-svn: 26443
* Add a new AddToWorkList method, start using itChris Lattner2006-03-011-57/+63
| | | | llvm-svn: 26441
* Pull shifts by a constant through multiplies (a form of reassociation),Chris Lattner2006-03-011-0/+27
| | | | | | implementing Regression/CodeGen/X86/mul-shift-reassoc.ll llvm-svn: 26440
* Vector ops lowering.Evan Cheng2006-03-011-1/+1
| | | | llvm-svn: 26436
* Compile:Chris Lattner2006-02-281-10/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | unsigned foo4(unsigned short *P) { return *P & 255; } unsigned foo5(short *P) { return *P & 255; } to: _foo4: lbz r3,1(r3) blr _foo5: lbz r3,1(r3) blr not: _foo4: lhz r2, 0(r3) rlwinm r3, r2, 0, 24, 31 blr _foo5: lhz r2, 0(r3) rlwinm r3, r2, 0, 24, 31 blr llvm-svn: 26419
* Fold "and (LOAD P), 255" -> zextload. This allows us to compile:Chris Lattner2006-02-281-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | unsigned foo3(unsigned *P) { return *P & 255; } as: _foo3: lbz r3, 3(r3) blr instead of: _foo3: lwz r2, 0(r3) rlwinm r3, r2, 0, 24, 31 blr and: unsigned short foo2(float a) { return a; } as: _foo2: fctiwz f0, f1 stfd f0, -8(r1) lhz r3, -2(r1) blr instead of: _foo2: fctiwz f0, f1 stfd f0, -8(r1) lwz r2, -4(r1) rlwinm r3, r2, 0, 16, 31 blr llvm-svn: 26417
* fold (sra (sra x, c1), c2) -> (sra x, c1+c2)Chris Lattner2006-02-281-3/+11
| | | | llvm-svn: 26416
* remove some completed notesChris Lattner2006-02-271-4/+0
| | | | llvm-svn: 26390
* Fix a problem Nate and Duraid reported where simplifying nodes can causeChris Lattner2006-02-201-4/+8
| | | | | | | them to get ressurected, in which case, deleting the undead nodes is unfriendly. llvm-svn: 26291
* Add checks to make sure we don't create bogus extend nodes, and fix a bugNate Begeman2006-02-181-4/+10
| | | | | | | where we were doing exactly that which was causing failures on x86 and alpha. llvm-svn: 26284
* Fix a tricky issue in the SimplifyDemandedBits code where CombineTo wasn'tChris Lattner2006-02-171-9/+34
| | | | | | | exactly the API we wanted to call into. This fixes the crash on crafty last night. llvm-svn: 26269
* Clean up DemandedBitsAreZero interfaceNate Begeman2006-02-171-22/+26
| | | | | | | Make more use of the new mask helpers in valuetypes.h Combine (sra (srl x, c1), c1) -> sext_inreg if legal llvm-svn: 26263
* Don't expand sdiv by power of two before legalize, since it will likelyNate Begeman2006-02-171-2/+2
| | | | | | generate illegal nodes. llvm-svn: 26261
* kill ADD_PARTS & SUB_PARTS and replace them with fancy new ADDC, ADDE, SUBCNate Begeman2006-02-171-46/+0
| | | | | | | and SUBE nodes that actually expose what's going on and allow for significant simplifications in the targets. llvm-svn: 26255
* Rework the SelectionDAG-based implementations of SimplifyDemandedBitsNate Begeman2006-02-161-35/+17
| | | | | | | and ComputeMaskedBits to match the new improved versions in instcombine. Tested against all of multisource/benchmarks on ppc. llvm-svn: 26238
* Lowering of sdiv X, pow2 was broken, this fixes it. This patch is writtenChris Lattner2006-02-161-6/+12
| | | | | | by Nate, I'm just committing it for him. llvm-svn: 26230
* Should not combine ISD::LOCATIONs until we have scheme to remove fromJim Laskey2006-02-151-34/+0
| | | | | | MachineDebugInfo tables. llvm-svn: 26216
* Compile this:Chris Lattner2006-02-081-0/+26
| | | | | | | | | | | | | | | xori r6, r2, 1 rlwinm r6, r6, 0, 31, 31 cmpwi cr0, r6, 0 bne cr0, LBB1_3 ; endif to this: rlwinm r6, r2, 0, 31, 31 cmpwi cr0, r6, 0 beq cr0, LBB1_3 ; endif llvm-svn: 26047
* Back out previous commit, it isn't safe.Nate Begeman2006-02-051-6/+0
| | | | llvm-svn: 26006
* fold c1 << (x + c2) into (c1 << c2) << x. fix a warning.Nate Begeman2006-02-051-1/+7
| | | | llvm-svn: 26005
* Handle urem by shifted powers of 2.Nate Begeman2006-02-051-4/+15
| | | | llvm-svn: 26001
* handle combining A / (B << N) into A >>u (log2(B)+N) when B is a power of 2Nate Begeman2006-02-051-2/+13
| | | | llvm-svn: 26000
* Add a framework for eliminating instructions that produces undemanded bits.Nate Begeman2006-02-031-10/+30
| | | | llvm-svn: 25945
* Add common code for reassociating ops in the dag combinerNate Begeman2006-02-031-50/+55
| | | | llvm-svn: 25934
* Turn any_extend nodes into zero_extend nodes when it allows us to remove anChris Lattner2006-02-021-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and instruction. This allows us to compile stuff like this: bool %X(int %X) { %Y = add int %X, 14 %Z = setne int %Y, 12345 ret bool %Z } to this: _X: cmpl $12331, 4(%esp) setne %al movzbl %al, %eax ret instead of this: _X: cmpl $12331, 4(%esp) setne %al movzbl %al, %eax andl $1, %eax ret This occurs quite a bit with the X86 backend. For example, 25 times in lambda, 30 times in 177.mesa, 14 times in galgel, 70 times in fma3d, 25 times in vpr, several hundred times in gcc, ~45 times in crafty, ~60 times in parser, ~140 times in eon, 110 times in perlbmk, 55 on gap, 16 times on bzip2, 14 times on twolf, and 1-2 times in many other SPEC2K programs. llvm-svn: 25901
* add two dag combines:Chris Lattner2006-02-021-8/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (C1-X) == C2 --> X == C1-C2 (X+C1) == C2 --> X == C2-C1 This allows us to compile this: bool %X(int %X) { %Y = add int %X, 14 %Z = setne int %Y, 12345 ret bool %Z } into this: _X: cmpl $12331, 4(%esp) setne %al movzbl %al, %eax andl $1, %eax ret not this: _X: movl $14, %eax addl 4(%esp), %eax cmpl $12345, %eax setne %al movzbl %al, %eax andl $1, %eax ret Testcase here: Regression/CodeGen/X86/compare-add.ll nukage of the and coming up next. llvm-svn: 25898
* Fix some of the stuff in the PPC README file, and clean up legalizationNate Begeman2006-02-011-3/+49
| | | | | | of the SELECT_CC, BR_CC, and BRTWOWAY_CC nodes. llvm-svn: 25875
* Move MaskedValueIsZero from the DAGCombiner to the TargetLowering ↵Chris Lattner2006-01-301-120/+21
| | | | | | interface,making isMaskedValueZeroForTargetNode simpler, and useable from other partsof the compiler. llvm-svn: 25803
* pass the address of MaskedValueIsZero into isMaskedValueZeroForTargetNode,Chris Lattner2006-01-301-1/+1
| | | | | | to permit recursion llvm-svn: 25799
* eliminate uses of SelectionDAG::getBR2Way_CCChris Lattner2006-01-291-3/+10
| | | | llvm-svn: 25767
* Add a missing case to the dag combiner.Nate Begeman2006-01-281-2/+3
| | | | llvm-svn: 25723
* Add explicit #includes of <iostream>Chris Lattner2006-01-221-0/+1
| | | | llvm-svn: 25515
* Get rid of code in the DAGCombiner that is duplicated in SelectionDAG.cppNate Begeman2006-01-181-74/+80
| | | | | | Now all constant folding in the code generator is in one place. llvm-svn: 25426
* Fix a backwards conditional that caused an inf loop in some cases. ThisChris Lattner2006-01-181-1/+1
| | | | | | fixes: test/Regression/CodeGen/Generic/2005-01-18-SetUO-InfLoop.ll llvm-svn: 25419
* Disable two transformations that contribute to bus errors on SparcV8.Chris Lattner2006-01-151-2/+6
| | | | llvm-svn: 25339
* Add a simple missing fold to produce this:Chris Lattner2006-01-121-0/+8
| | | | | | | | | | | subfic r3, r2, 33 instead of this: subfic r2, r2, 32 addi r3, r2, 1 llvm-svn: 25255
* Don't create rotate instructions in unsupported types, because we don't haveChris Lattner2006-01-121-2/+2
| | | | | | promote/expand code yet. This fixes the 177.mesa failure on PPC. llvm-svn: 25250
* Add bswap, rotl, and rotr nodesNate Begeman2006-01-111-2/+36
| | | | | | | | | Add dag combiner code to recognize rotl, rotr Add ppc code to match rotl Targets should add rotl/rotr patterns if they have them llvm-svn: 25222
OpenPOWER on IntegriCloud