oota-llvm.git
19 years agoadd a little peephole optimization. This allows us to codegen:
Chris Lattner [Sat, 9 Apr 2005 21:43:54 +0000 (21:43 +0000)]
add a little peephole optimization.  This allows us to codegen:

int a(short i) {
        return i & 1;
}

as

_a:
        andi. r3, r3, 1
        blr

instead of:

_a:
        rlwinm r2, r3, 0, 16, 31
        andi. r3, r2, 1
        blr

on ppc.  It should also help the other risc targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21189 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agodo not set the root to null if an argument is dead
Chris Lattner [Sat, 9 Apr 2005 21:23:24 +0000 (21:23 +0000)]
do not set the root to null if an argument is dead

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21188 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd rlwnm instruction for variable rotate
Nate Begeman [Sat, 9 Apr 2005 20:09:12 +0000 (20:09 +0000)]
Add rlwnm instruction for variable rotate
Generate rotate left/right immediate
Generate code for brcondtwoway
Use new livein/liveout functionality

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21187 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix a crash on 173.applu by asking for a constant bigger than 32-bits.
Chris Lattner [Sat, 9 Apr 2005 19:47:21 +0000 (19:47 +0000)]
Fix a crash on 173.applu by asking for a constant bigger than 32-bits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21185 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSwitch this instruction selector over to using liveins and liveouts, eliminating
Chris Lattner [Sat, 9 Apr 2005 16:32:30 +0000 (16:32 +0000)]
Switch this instruction selector over to using liveins and liveouts, eliminating
implicit defs on entry to the function.  yaay :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21184 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agothere is no need to remove this instruction, linscan does it already as it
Chris Lattner [Sat, 9 Apr 2005 16:24:20 +0000 (16:24 +0000)]
there is no need to remove this instruction, linscan does it already as it
removes noop moves.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21183 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdjust live intervals to support a livein set
Chris Lattner [Sat, 9 Apr 2005 16:17:50 +0000 (16:17 +0000)]
Adjust live intervals to support a livein set

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21182 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoUse live out sets for return values instead of imp_defs, which is cleaner and faster.
Chris Lattner [Sat, 9 Apr 2005 15:23:56 +0000 (15:23 +0000)]
Use live out sets for return values instead of imp_defs, which is cleaner and faster.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21181 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoConsider the livein/out set for a function, allowing targets to not have to
Chris Lattner [Sat, 9 Apr 2005 15:23:25 +0000 (15:23 +0000)]
Consider the livein/out set for a function, allowing targets to not have to
use ugly imp_def/imp_uses for arguments and return values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21180 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoadd routines to track the livein/out set for a function
Chris Lattner [Sat, 9 Apr 2005 15:22:53 +0000 (15:22 +0000)]
add routines to track the livein/out set for a function

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21179 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agook, the "ia64 has a boatload of registers" joke stopped being funny today ;)
Duraid Madina [Sat, 9 Apr 2005 11:53:00 +0000 (11:53 +0000)]
ok, the "ia64 has a boatload of registers" joke stopped being funny today ;)

  * fix overallocation of integer (stacked) registers: we can't allocate
  registers for local use if they are required as output registers

this fixes 'toast' in the test suite, and all sorts of larger programs
like bzip2 etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21178 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoOptimize FSEL a bit for fneg arguments. This fixes the recently added test
Nate Begeman [Sat, 9 Apr 2005 09:33:07 +0000 (09:33 +0000)]
Optimize FSEL a bit for fneg arguments.  This fixes the recently added test
case so that we emit

_test_fneg_sel:
.LBB_test_fneg_sel_0:   ;
        fsel f1, f1, f3, f2
        blr

instead of:

_test_fneg_sel:
.LBB_test_fneg_sel_0:   ;
        fneg f0, f1
        fneg f0, f0
        fsel f1, f0, f3, f2
        blr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21177 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd a testcase to make sure that we don't emit two fneg instructions back
Nate Begeman [Sat, 9 Apr 2005 09:30:09 +0000 (09:30 +0000)]
Add a testcase to make sure that we don't emit two fneg instructions back
to back for certain fsel instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21176 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd cases to cover the rest of the patterns we should be matching
Nate Begeman [Sat, 9 Apr 2005 08:29:59 +0000 (08:29 +0000)]
Add cases to cover the rest of the patterns we should be matching

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21175 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix CodeGen/SparcV9/2005-05-09-GEP-Crash.ll a crash on some specfp program
Chris Lattner [Sat, 9 Apr 2005 06:27:14 +0000 (06:27 +0000)]
Fix CodeGen/SparcV9/2005-05-09-GEP-Crash.ll a crash on some specfp program
lets hope this doesn't break other programs with induced entropy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21174 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoNew testcase that the sparc backend crashes on
Chris Lattner [Sat, 9 Apr 2005 06:26:27 +0000 (06:26 +0000)]
New testcase that the sparc backend crashes on

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21173 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agorecognize some patterns as fabs operations, so that fabs at the source level
Chris Lattner [Sat, 9 Apr 2005 05:15:53 +0000 (05:15 +0000)]
recognize some patterns as fabs operations, so that fabs at the source level
is deconstructed then reconstructed here.  This catches 19 fabs's in 177.mesa
9 in 168.wupwise, 5 in 171.swim, 3 in 172.mgrid, and 14 in 173.applu out of
specfp2000.

This allows the X86 code generator to make MUCH better code than before for
each of these and saves one instr on ppc.

This depends on the previous CFE patch to expose these correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21171 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agomake this test more interesting
Chris Lattner [Sat, 9 Apr 2005 04:55:14 +0000 (04:55 +0000)]
make this test more interesting

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21170 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoadd a test for fnabs
Chris Lattner [Sat, 9 Apr 2005 04:03:16 +0000 (04:03 +0000)]
add a test for fnabs

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21169 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoadd a partial test for the fma operations that ppc supports. I'm sure I'm
Chris Lattner [Sat, 9 Apr 2005 04:01:32 +0000 (04:01 +0000)]
add a partial test for the fma operations that ppc supports.  I'm sure I'm
missing some and not all of these match yet, but I'm sure that Nate will
clean up my mess :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21168 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoEmit BRCONDTWOWAY when possible.
Chris Lattner [Sat, 9 Apr 2005 03:30:29 +0000 (03:30 +0000)]
Emit BRCONDTWOWAY when possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21167 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoLegalize BRCONDTWOWAY into a BRCOND/BR pair if a target doesn't support it.
Chris Lattner [Sat, 9 Apr 2005 03:30:19 +0000 (03:30 +0000)]
Legalize BRCONDTWOWAY into a BRCOND/BR pair if a target doesn't support it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21166 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoprint and fold BRCONDTWOWAY correctly
Chris Lattner [Sat, 9 Apr 2005 03:27:28 +0000 (03:27 +0000)]
print and fold BRCONDTWOWAY correctly

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21165 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoThis target does not support/want ISD::BRCONDTWOWAY
Chris Lattner [Sat, 9 Apr 2005 03:22:37 +0000 (03:22 +0000)]
This target does not support/want ISD::BRCONDTWOWAY

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21164 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoThis target does not yet support ISD::BRCONDTWOWAY
Chris Lattner [Sat, 9 Apr 2005 03:22:30 +0000 (03:22 +0000)]
This target does not yet support ISD::BRCONDTWOWAY

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21163 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd a new node
Chris Lattner [Sat, 9 Apr 2005 03:21:50 +0000 (03:21 +0000)]
Add a new node

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21162 91177308-0d34-0410-b5e6-96231b3b80d8

19 years ago64b: Expand S/UREM
Nate Begeman [Sat, 9 Apr 2005 03:05:51 +0000 (03:05 +0000)]
64b: Expand S/UREM
32b: No longer pattern match fneg(fsub(fmul)) as fnmsub
     Pattern match fsub a, mul(b, c) as fnmsub
     Pattern match fadd a, mul(b, c) as fmadd
Those changes speed up hydro2d by 2.5%, distray by 6%, and scimark by 8%

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21161 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agocanonicalize a bunch of operations involving fneg
Chris Lattner [Sat, 9 Apr 2005 03:02:46 +0000 (03:02 +0000)]
canonicalize a bunch of operations involving fneg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21160 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix 64b shifts
Nate Begeman [Fri, 8 Apr 2005 23:45:01 +0000 (23:45 +0000)]
Fix 64b shifts

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21159 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agofix this method for 64-bit constants
Chris Lattner [Fri, 8 Apr 2005 21:31:29 +0000 (21:31 +0000)]
fix this method for 64-bit constants

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21158 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoMatch Mac OS X 64 bit calling conventions
Nate Begeman [Fri, 8 Apr 2005 21:26:05 +0000 (21:26 +0000)]
Match Mac OS X 64 bit calling conventions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21157 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agocollect a few statistics, factor constants (constant loading and mult), fix logic...
Andrew Lenharth [Fri, 8 Apr 2005 17:28:49 +0000 (17:28 +0000)]
collect a few statistics, factor constants (constant loading and mult), fix logic operation pattern matchs, supress FP div when int dividing by a constant

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21156 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agooops
Andrew Lenharth [Fri, 8 Apr 2005 16:55:15 +0000 (16:55 +0000)]
oops

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21155 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoadded some tests to check stupid pattern matching mistakes
Andrew Lenharth [Fri, 8 Apr 2005 16:46:44 +0000 (16:46 +0000)]
added some tests to check stupid pattern matching mistakes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21154 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agofix bogus division-by-power-of-2 (was wrong for negative input, adds extr insn)
Duraid Madina [Fri, 8 Apr 2005 10:01:48 +0000 (10:01 +0000)]
fix bogus division-by-power-of-2 (was wrong for negative input, adds extr insn)
fix hack in division (clean up frcpa instruction)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21153 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix bug: InstCombine/2005-05-07-UDivSelectCrash.ll
Chris Lattner [Fri, 8 Apr 2005 04:03:26 +0000 (04:03 +0000)]
Fix bug: InstCombine/2005-05-07-UDivSelectCrash.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21152 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase that crashes the instcombiner.
Chris Lattner [Fri, 8 Apr 2005 03:58:21 +0000 (03:58 +0000)]
new testcase that crashes the instcombiner.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21151 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoOptimized code sequences for setcc reg, 0
Nate Begeman [Thu, 7 Apr 2005 20:30:01 +0000 (20:30 +0000)]
Optimized code sequences for setcc reg, 0
Optimized code sequence for (a < 0) ? b : 0

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21150 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAlpha zero extends setcc results
Andrew Lenharth [Thu, 7 Apr 2005 20:11:32 +0000 (20:11 +0000)]
Alpha zero extends setcc results

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21149 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoIf a target zero or sign extends the result of its setcc, allow folding of
Chris Lattner [Thu, 7 Apr 2005 19:43:53 +0000 (19:43 +0000)]
If a target zero or sign extends the result of its setcc, allow folding of
this into sign/zero extension instructions later.

On PPC, for example, this testcase:

%G = external global sbyte
implementation
void %test(int %X, int %Y) {
  %C = setlt int %X, %Y
  %D = cast bool %C to sbyte
  store sbyte %D, sbyte* %G
  ret void
}

Now codegens to:

        cmpw cr0, r3, r4
        li r3, 1
        li r4, 0
        blt .LBB_test_2 ;
.LBB_test_1:    ;
        or r3, r4, r4
.LBB_test_2:    ;
        addis r2, r2, ha16(L_G$non_lazy_ptr-"L00000$pb")
        lwz r2, lo16(L_G$non_lazy_ptr-"L00000$pb")(r2)
        stb r3, 0(r2)

instead of:

        cmpw cr0, r3, r4
        li r3, 1
        li r4, 0
        blt .LBB_test_2 ;
.LBB_test_1:    ;
        or r3, r4, r4
.LBB_test_2:    ;
***     rlwinm r3, r3, 0, 31, 31
        addis r2, r2, ha16(L_G$non_lazy_ptr-"L00000$pb")
        lwz r2, lo16(L_G$non_lazy_ptr-"L00000$pb")(r2)
        stb r3, 0(r2)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21148 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoPowerPC zero extends setcc results
Chris Lattner [Thu, 7 Apr 2005 19:41:49 +0000 (19:41 +0000)]
PowerPC zero extends setcc results

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21147 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoX86 zero extends setcc results
Chris Lattner [Thu, 7 Apr 2005 19:41:46 +0000 (19:41 +0000)]
X86 zero extends setcc results

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21146 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAllow targets which produce setcc results in non-MVT::i1 registers to describe
Chris Lattner [Thu, 7 Apr 2005 19:41:18 +0000 (19:41 +0000)]
Allow targets which produce setcc results in non-MVT::i1 registers to describe
what the contents of the top bits of these registers are, in the common cases
of targets that sign and zero extend the results.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21145 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRemove somethign I had for testing
Chris Lattner [Thu, 7 Apr 2005 18:58:54 +0000 (18:58 +0000)]
Remove somethign I had for testing

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21144 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agofix a small optimization opertunity and make gcc happy
Andrew Lenharth [Thu, 7 Apr 2005 18:15:28 +0000 (18:15 +0000)]
fix a small optimization opertunity and make gcc happy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21143 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoThis patch does two things. First, it canonicalizes 'X >= C' -> 'X > C-1'
Chris Lattner [Thu, 7 Apr 2005 18:14:58 +0000 (18:14 +0000)]
This patch does two things.  First, it canonicalizes 'X >= C' -> 'X > C-1'
(likewise for <= >=u >=u).

Second, it implements a special case hack to turn 'X gtu SINTMAX' -> 'X lt 0'

On powerpc, for example, this changes this:

        lis r2, 32767
        ori r2, r2, 65535
        cmplw cr0, r3, r2
        bgt .LBB_test_2

into:

        cmpwi cr0, r3, 0
        blt .LBB_test_2

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21142 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agomatch case change in codegen
Andrew Lenharth [Thu, 7 Apr 2005 17:47:00 +0000 (17:47 +0000)]
match case change in codegen

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21141 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agofixup magic constant making code. tested by thousands of random divisions.... by...
Andrew Lenharth [Thu, 7 Apr 2005 17:19:16 +0000 (17:19 +0000)]
fixup magic constant making code.  tested by thousands of random divisions.... by 10000.  ok, so random divisors would be good too, but this at least fixes some things

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21140 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agolowercase instructions, makes diff happier
Andrew Lenharth [Thu, 7 Apr 2005 17:17:48 +0000 (17:17 +0000)]
lowercase instructions, makes diff happier

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21139 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement the following xforms:
Chris Lattner [Thu, 7 Apr 2005 17:14:51 +0000 (17:14 +0000)]
Implement the following xforms:
(X-Y)-X --> -Y
A + (B - A) --> B
(B - A) + A --> B

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21138 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew test
Chris Lattner [Thu, 7 Apr 2005 16:41:45 +0000 (16:41 +0000)]
new test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21137 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement InstCombine/add.ll:test28, transforming C1-(X+C2) --> (C1-C2)-X.
Chris Lattner [Thu, 7 Apr 2005 16:28:01 +0000 (16:28 +0000)]
Implement InstCombine/add.ll:test28, transforming C1-(X+C2) --> (C1-C2)-X.
This occurs several dozen times in specint2k, particularly in crafty and gcc
apparently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21136 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase
Chris Lattner [Thu, 7 Apr 2005 16:24:59 +0000 (16:24 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21135 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoTransform X-(X+Y) == -Y and X-(Y+X) == -Y
Chris Lattner [Thu, 7 Apr 2005 16:15:25 +0000 (16:15 +0000)]
Transform X-(X+Y) == -Y and X-(Y+X) == -Y

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21134 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoIt wasn't happy about this either
Andrew Lenharth [Thu, 7 Apr 2005 14:18:13 +0000 (14:18 +0000)]
It wasn't happy about this either

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21133 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoYea, it wasn't happy
Andrew Lenharth [Thu, 7 Apr 2005 13:55:53 +0000 (13:55 +0000)]
Yea, it wasn't happy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21132 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoteach asmprinter to print s8/s14 operands
Duraid Madina [Thu, 7 Apr 2005 12:34:36 +0000 (12:34 +0000)]
teach asmprinter to print s8/s14 operands

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21131 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agocodegen immediate forms of add/sub/shift
Duraid Madina [Thu, 7 Apr 2005 12:33:38 +0000 (12:33 +0000)]
codegen immediate forms of add/sub/shift

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21130 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoadd immediate forms of add, sub, shift
Duraid Madina [Thu, 7 Apr 2005 12:32:24 +0000 (12:32 +0000)]
add immediate forms of add, sub, shift

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21129 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix a really scary bug that Nate found where we weren't deleting the right
Chris Lattner [Thu, 7 Apr 2005 00:30:13 +0000 (00:30 +0000)]
Fix a really scary bug that Nate found where we weren't deleting the right
elements auto of the autoCSE maps.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21128 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoPattern match bitfield insert, which helps shift long by immediate, among
Nate Begeman [Wed, 6 Apr 2005 23:51:40 +0000 (23:51 +0000)]
Pattern match bitfield insert, which helps shift long by immediate, among
other things.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21127 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix some shift bugs
Nate Begeman [Wed, 6 Apr 2005 22:42:08 +0000 (22:42 +0000)]
Fix some shift bugs

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21126 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoMake these 64 bit constants so that this compiles on x86-32 as well.
Alkis Evlogimenos [Wed, 6 Apr 2005 22:09:40 +0000 (22:09 +0000)]
Make these 64 bit constants so that this compiles on x86-32 as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21125 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoadded sdiv by 2^k and works for neg divisors also
Andrew Lenharth [Wed, 6 Apr 2005 22:03:13 +0000 (22:03 +0000)]
added sdiv by 2^k and works for neg divisors also

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21124 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoDon't make this require loopsimplify. It works BETTER with loop simplify
Chris Lattner [Wed, 6 Apr 2005 21:45:00 +0000 (21:45 +0000)]
Don't make this require loopsimplify.  It works BETTER with loop simplify
but should not require it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21123 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoTeach ExpandShift how to handle shifts by a constant. This allows targets
Nate Begeman [Wed, 6 Apr 2005 21:13:14 +0000 (21:13 +0000)]
Teach ExpandShift how to handle shifts by a constant.  This allows targets
like PowerPC to codegen long shifts in many fewer instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21122 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agofix copy/paste errors, and add imm support to SxADDQ and SxSUBQ
Andrew Lenharth [Wed, 6 Apr 2005 20:59:59 +0000 (20:59 +0000)]
fix copy/paste errors, and add imm support to SxADDQ and SxSUBQ

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21121 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix SingleSource/Regression/C/2005-05-06-LongLongSignedShift.c, we were not
Chris Lattner [Wed, 6 Apr 2005 20:59:35 +0000 (20:59 +0000)]
Fix SingleSource/Regression/C/2005-05-06-LongLongSignedShift.c, we were not
properly sign extending the top of the result of a 64-bit shift right by
a constant > 32.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21120 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agosimplified
Andrew Lenharth [Wed, 6 Apr 2005 20:59:03 +0000 (20:59 +0000)]
simplified

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21119 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoadded first alpha codegen regression test
Andrew Lenharth [Wed, 6 Apr 2005 20:39:17 +0000 (20:39 +0000)]
added first alpha codegen regression test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21117 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdded Nate's div by constant stuff, also scaled operations!
Andrew Lenharth [Wed, 6 Apr 2005 20:25:34 +0000 (20:25 +0000)]
Added Nate's div by constant stuff, also scaled operations!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21116 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix a namespace issue, reported by Vladimir Merzliakov!
Chris Lattner [Wed, 6 Apr 2005 19:45:39 +0000 (19:45 +0000)]
Fix a namespace issue, reported by Vladimir Merzliakov!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21115 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agosteal sampo's div-by-constant-power-of-2 stuff
Duraid Madina [Wed, 6 Apr 2005 09:55:17 +0000 (09:55 +0000)]
steal sampo's div-by-constant-power-of-2 stuff
thanks sampo!!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21113 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoadd fms instruction
Duraid Madina [Wed, 6 Apr 2005 09:54:09 +0000 (09:54 +0000)]
add fms instruction

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21112 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFixed version of optimized integer divide is now fixed. Calculate the
Nate Begeman [Wed, 6 Apr 2005 06:44:57 +0000 (06:44 +0000)]
Fixed version of optimized integer divide is now fixed.  Calculate the
quotient, not the remainder.  Also, make sure to remove the old div operand
from the ExprMap and let SelectExpr insert the new one.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21111 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agolie a bit and say that r1/r12 (GP/SP) _aren't_ callee-save, as we take
Duraid Madina [Wed, 6 Apr 2005 06:18:36 +0000 (06:18 +0000)]
lie a bit and say that r1/r12 (GP/SP) _aren't_ callee-save, as we take
care of this ourselves

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21110 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agomake sure 'special' registers don't get allocated
Duraid Madina [Wed, 6 Apr 2005 06:17:54 +0000 (06:17 +0000)]
make sure 'special' registers don't get allocated

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21109 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agodocument these nodes, as they are nonobvious
Chris Lattner [Wed, 6 Apr 2005 04:21:29 +0000 (04:21 +0000)]
document these nodes, as they are nonobvious

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21108 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd (untested) support for MULHS and MULHU.
Chris Lattner [Wed, 6 Apr 2005 04:21:07 +0000 (04:21 +0000)]
Add (untested) support for MULHS and MULHU.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21107 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoadd signed versions of the extra precision multiplies
Chris Lattner [Wed, 6 Apr 2005 04:19:22 +0000 (04:19 +0000)]
add signed versions of the extra precision multiplies

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21106 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoTurn off the div -> mul optimization until it works correctly 100% of the
Nate Begeman [Wed, 6 Apr 2005 03:36:33 +0000 (03:36 +0000)]
Turn off the div -> mul optimization until it works correctly 100% of the
time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21105 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd support for MULHS and MULHU nodes
Nate Begeman [Wed, 6 Apr 2005 00:25:27 +0000 (00:25 +0000)]
Add support for MULHS and MULHU nodes
Have LegalizeDAG handle SREM and UREM for us
Codegen SDIV and UDIV by constant as a multiply by magic constant instead
of integer divide, which is very slow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21104 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoExpand SREM and UREM for targets that claim not to have them, like PowerPC
Nate Begeman [Wed, 6 Apr 2005 00:23:54 +0000 (00:23 +0000)]
Expand SREM and UREM for targets that claim not to have them, like PowerPC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21103 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd MULHU and MULHS nodes for the high part of an (un)signed 32x32=64b
Nate Begeman [Tue, 5 Apr 2005 22:36:56 +0000 (22:36 +0000)]
Add MULHU and MULHS nodes for the high part of an (un)signed 32x32=64b
multiply.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21102 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoadded lowerargs support for varargs
Andrew Lenharth [Tue, 5 Apr 2005 20:51:46 +0000 (20:51 +0000)]
added lowerargs support for varargs

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21101 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoBehold, rlwinm with certain immediate arguments is printed as the much more
Nate Begeman [Tue, 5 Apr 2005 18:19:50 +0000 (18:19 +0000)]
Behold, rlwinm with certain immediate arguments is printed as the much more
readable slwi or srwi (shift left/right word immediate).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21099 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix cut & paste errors (32->64), and codegen float->int more optimally.
Nate Begeman [Tue, 5 Apr 2005 17:32:30 +0000 (17:32 +0000)]
Fix cut & paste errors (32->64), and codegen float->int more optimally.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21098 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoUpdated to use dep analyzer.
Tanya Lattner [Tue, 5 Apr 2005 16:36:44 +0000 (16:36 +0000)]
Updated to use dep analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21097 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRemove 64 bit simple ISel, it never worked correctly
Nate Begeman [Tue, 5 Apr 2005 08:51:15 +0000 (08:51 +0000)]
Remove 64 bit simple ISel, it never worked correctly
Add initial (buggy) implementation of 64 bit pattern ISel

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21096 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoBack out the previous change to SelectBranchCC, since there are cases it
Nate Begeman [Tue, 5 Apr 2005 04:32:16 +0000 (04:32 +0000)]
Back out the previous change to SelectBranchCC, since there are cases it
could miscompile.  A correct solution will be found in the near future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21095 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRename canUseAsImmediateForOpcode to getImmediateForOpcode to better
Nate Begeman [Tue, 5 Apr 2005 04:22:58 +0000 (04:22 +0000)]
Rename canUseAsImmediateForOpcode to getImmediateForOpcode to better
  indicate that it is not a boolean function.
Properly emit the pseudo instruction for conditional branch, so that we
  can fix up conditional branches whose displacements are too large.
Reserve the right amount of opcode space for said pseudo instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21094 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agodo not crash when using -debug
Chris Lattner [Tue, 5 Apr 2005 01:12:03 +0000 (01:12 +0000)]
do not crash when using -debug

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21092 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement SDIV by power of 2 as srawi/addze rather than load imm, divw
Nate Begeman [Tue, 5 Apr 2005 00:15:08 +0000 (00:15 +0000)]
Implement SDIV by power of 2 as srawi/addze rather than load imm, divw

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21091 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoPattern match fp mul-add, mul-sub, neg-mul-add, and neg-mul-sub
Nate Begeman [Mon, 4 Apr 2005 23:40:36 +0000 (23:40 +0000)]
Pattern match fp mul-add, mul-sub, neg-mul-add, and neg-mul-sub

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21090 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd support for multiply-add, multiply-sub, and their negated versions
Nate Begeman [Mon, 4 Apr 2005 23:01:51 +0000 (23:01 +0000)]
Add support for multiply-add, multiply-sub, and their negated versions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21089 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agodo not dereference an extra layer of pointers to determine if an external
Chris Lattner [Mon, 4 Apr 2005 22:23:21 +0000 (22:23 +0000)]
do not dereference an extra layer of pointers to determine if an external
call can modify a memory location.  This fixes
test/Regression/Analysis/Andersens/modreftest.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21088 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase
Chris Lattner [Mon, 4 Apr 2005 22:22:30 +0000 (22:22 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21087 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoMake sure that arg regs used by the call instruction are marked as such, so
Nate Begeman [Mon, 4 Apr 2005 22:17:48 +0000 (22:17 +0000)]
Make sure that arg regs used by the call instruction are marked as such, so
that regalloc doesn't cleverly reuse early arg regs loading later arg regs.
This fixes almost all outstanding failures in the pattern isel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21086 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRemove unnecessary register copy now that regalloc is fixed
Nate Begeman [Mon, 4 Apr 2005 21:48:13 +0000 (21:48 +0000)]
Remove unnecessary register copy now that regalloc is fixed

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21085 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoMake sure to notice that explicit physregs are used in the function
Chris Lattner [Mon, 4 Apr 2005 21:35:34 +0000 (21:35 +0000)]
Make sure to notice that explicit physregs are used in the function

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21084 91177308-0d34-0410-b5e6-96231b3b80d8