Commit Graph

9925 Commits

Author SHA1 Message Date
Nate Begeman
709c806a1e Fix another fixme: factor out the constant fp generation code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21207 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-10 06:06:10 +00:00
Nate Begeman
c5b1cd22b5 Fix 64 bit argument loading that straddles the args in regs / args on stack
boundary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21206 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-10 05:53:14 +00:00
Chris Lattner
232ee95a09 Until we have a dag combiner, promote using zextload's instead of extloads.
This gives the optimizer a bit of information about the top-part of the
value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21205 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-10 04:33:47 +00:00
Chris Lattner
45278e37eb Fold zext_inreg(zextload), likewise for sext's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21204 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-10 04:33:08 +00:00
Chris Lattner
edeecfcbd5 add a simple xform
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21203 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-10 04:04:49 +00:00
Nate Begeman
340f290783 Remove unnecessary Implicit Defs. Since r0 is not in allocation, we do not
have to inform the register allocator it might be stepped on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21202 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-10 03:59:42 +00:00
Nate Begeman
27499e3f1b Make sure that BRCOND branches can be converted into long branches too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21198 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-10 01:48:29 +00:00
Nate Begeman
a0e3e9474f Don't hand ISD::CALL nodes off to SelectExprFP. This fixes siod.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21197 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-10 01:14:13 +00:00
Chris Lattner
dea29e25c3 Fix a thinko. If the operand is promoted, pass the promoted value into
the new zero extend, not the original operand.  This fixes cast bool -> long
on ppc.

Add an unrelated fixme


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21196 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-10 01:13:15 +00:00
Chris Lattner
51d2ed976f rename getPPCOpcodeForSetCCNumber -> getPPCOpcodeForSetCCOpode to be more
correct.  Remove the EmitComparison retvalue, as it is always the first arg.

Fix a place where we incorrectly passed in the setcc opcode instead of the
setcc number, causing us to miscompile crafty.  Crafty now works!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21195 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-10 01:03:31 +00:00
Nate Begeman
706471e291 fix ISD::BRCONDTWOWAY codegen to not deference the end() iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21193 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-09 23:35:05 +00:00
Chris Lattner
9184bfbbf4 Fix CodeGen/Generic/2005-05-09-GlobalInPHI.ll, which was reduced from 254.gap.
This caused the "use before a def" assertion on some programs.

With this patch, 254.gap now passes with the PPC backend.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21191 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-09 22:05:17 +00:00
Chris Lattner
a2daa8c78d 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
2005-04-09 21:43:54 +00:00
Chris Lattner
91277ea45c 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
2005-04-09 21:23:24 +00:00
Nate Begeman
cd08e4cb7e 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
2005-04-09 20:09:12 +00:00
Chris Lattner
27ee3a332d 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
2005-04-09 19:47:21 +00:00
Chris Lattner
f429a3e0f6 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
2005-04-09 16:32:30 +00:00
Chris Lattner
8e7d87b228 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
2005-04-09 16:24:20 +00:00
Chris Lattner
799a919dbc 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
2005-04-09 16:17:50 +00:00
Chris Lattner
4c52f0ec8c 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
2005-04-09 15:23:56 +00:00
Chris Lattner
d493b34d31 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
2005-04-09 15:23:25 +00:00
Duraid Madina
e00e5ded51 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
2005-04-09 11:53:00 +00:00
Nate Begeman
af4ab1b103 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
2005-04-09 09:33:07 +00:00
Chris Lattner
67ac5f459e 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
2005-04-09 06:27:14 +00:00
Chris Lattner
59723e9698 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
2005-04-09 05:15:53 +00:00
Chris Lattner
e7ccd4acd2 Emit BRCONDTWOWAY when possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21167 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-09 03:30:29 +00:00
Chris Lattner
411e888c1b 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
2005-04-09 03:30:19 +00:00
Chris Lattner
ef847df087 print and fold BRCONDTWOWAY correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21165 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-09 03:27:28 +00:00
Chris Lattner
da4d4694a8 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
2005-04-09 03:22:37 +00:00
Chris Lattner
644db4ec5f 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
2005-04-09 03:22:30 +00:00
Nate Begeman
e88aa5b4d1 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
2005-04-09 03:05:51 +00:00
Chris Lattner
485df9b84b canonicalize a bunch of operations involving fneg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21160 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-09 03:02:46 +00:00
Nate Begeman
a9532d5dde Fix 64b shifts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21159 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-08 23:45:01 +00:00
Nate Begeman
f3f2d6d378 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
2005-04-08 21:26:05 +00:00
Andrew Lenharth
a32b9e31c6 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
2005-04-08 17:28:49 +00:00
Duraid Madina
6dcceb5ecb 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
2005-04-08 10:01:48 +00:00
Chris Lattner
bf70b838e7 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
2005-04-08 04:03:26 +00:00
Nate Begeman
7e7fadd2ea 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
2005-04-07 20:30:01 +00:00
Andrew Lenharth
d3355e22a7 Alpha zero extends setcc results
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21149 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-07 20:11:32 +00:00
Chris Lattner
5a6bace3ab 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
2005-04-07 19:43:53 +00:00
Chris Lattner
cbd06fc3d7 PowerPC zero extends setcc results
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21147 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-07 19:41:49 +00:00
Chris Lattner
6659bd7592 X86 zero extends setcc results
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21146 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-07 19:41:46 +00:00
Chris Lattner
2467392c59 Remove somethign I had for testing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21144 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-07 18:58:54 +00:00
Andrew Lenharth
2966e84a8d 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
2005-04-07 18:15:28 +00:00
Chris Lattner
67255a1d17 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
2005-04-07 18:14:58 +00:00
Andrew Lenharth
320174f009 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
2005-04-07 17:19:16 +00:00
Andrew Lenharth
9bf59d7ed2 lowercase instructions, makes diff happier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21139 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-07 17:17:48 +00:00
Chris Lattner
7edc8c223e 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
2005-04-07 17:14:51 +00:00
Chris Lattner
08954a26e4 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
2005-04-07 16:28:01 +00:00
Chris Lattner
43d84d6b71 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
2005-04-07 16:15:25 +00:00
Andrew Lenharth
273a1f956f It wasn't happy about this either
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21133 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-07 14:18:13 +00:00
Andrew Lenharth
706be918ca Yea, it wasn't happy
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21132 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-07 13:55:53 +00:00
Duraid Madina
e6a0b6cbda teach asmprinter to print s8/s14 operands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21131 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-07 12:34:36 +00:00
Duraid Madina
f55e403ef9 codegen immediate forms of add/sub/shift
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21130 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-07 12:33:38 +00:00
Duraid Madina
18c0c6bcc4 add immediate forms of add, sub, shift
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21129 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-07 12:32:24 +00:00
Chris Lattner
8e8bd656b3 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
2005-04-07 00:30:13 +00:00
Nate Begeman
7ddecb4186 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
2005-04-06 23:51:40 +00:00
Nate Begeman
020ef42c19 Fix some shift bugs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21126 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-06 22:42:08 +00:00
Alkis Evlogimenos
aeca558788 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
2005-04-06 22:09:40 +00:00
Andrew Lenharth
a565c275b5 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
2005-04-06 22:03:13 +00:00
Chris Lattner
6128690c62 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
2005-04-06 21:45:00 +00:00
Nate Begeman
f1fe32e337 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
2005-04-06 21:13:14 +00:00
Andrew Lenharth
f77f395043 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
2005-04-06 20:59:59 +00:00
Chris Lattner
6d027f2e6f 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
2005-04-06 20:59:35 +00:00
Andrew Lenharth
4b8ac1559a 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
2005-04-06 20:25:34 +00:00
Chris Lattner
ce91ec9ae6 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
2005-04-06 19:45:39 +00:00
Duraid Madina
4826a0786d 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
2005-04-06 09:55:17 +00:00
Duraid Madina
b366a02ff2 add fms instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21112 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-06 09:54:09 +00:00
Nate Begeman
27b4c23b80 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
2005-04-06 06:44:57 +00:00
Duraid Madina
b70c2f3ef7 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
2005-04-06 06:18:36 +00:00
Duraid Madina
4ee131ffa8 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
2005-04-06 06:17:54 +00:00
Chris Lattner
8db0af1c8d Add (untested) support for MULHS and MULHU.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21107 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-06 04:21:07 +00:00
Chris Lattner
1e6a71524e 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
2005-04-06 04:19:22 +00:00
Nate Begeman
8f52980f03 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
2005-04-06 03:36:33 +00:00
Nate Begeman
815d6dac1e 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
2005-04-06 00:25:27 +00:00
Nate Begeman
c105e19864 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
2005-04-06 00:23:54 +00:00
Nate Begeman
1867054643 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
2005-04-05 22:36:56 +00:00
Andrew Lenharth
2513ddc239 added lowerargs support for varargs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21101 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-05 20:51:46 +00:00
Nate Begeman
ad5f65c74b 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
2005-04-05 18:19:50 +00:00
Nate Begeman
a3829d5580 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
2005-04-05 17:32:30 +00:00
Tanya Lattner
ac6e2dbf52 Updated to use dep analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21097 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-05 16:36:44 +00:00
Nate Begeman
d3e6b94020 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
2005-04-05 08:51:15 +00:00
Nate Begeman
c8c5c8f0fa 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
2005-04-05 04:32:16 +00:00
Nate Begeman
439b444cad 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
2005-04-05 04:22:58 +00:00
Chris Lattner
bd135c7706 do not crash when using -debug
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21092 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-05 01:12:03 +00:00
Nate Begeman
80196b1331 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
2005-04-05 00:15:08 +00:00
Nate Begeman
93075ec0a5 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
2005-04-04 23:40:36 +00:00
Nate Begeman
178bb34ee5 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
2005-04-04 23:01:51 +00:00
Chris Lattner
8a9763c3cd 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
2005-04-04 22:23:21 +00:00
Nate Begeman
d860aa62ac 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
2005-04-04 22:17:48 +00:00
Nate Begeman
04ec80173b 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
2005-04-04 21:48:13 +00:00
Chris Lattner
886dd9136f 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
2005-04-04 21:35:34 +00:00
Nate Begeman
c3e2db407e i1 loads should also be from the low byte of the argument word.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21077 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-04 09:09:00 +00:00
Nate Begeman
e584668f04 Fix i64 return, fix CopyFromReg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21076 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-04 06:52:38 +00:00
Duraid Madina
6e02e6842a fix SREM/UREM, which gave incorrect results for x%y if x was zero. This is
an ugly hack, but it seems to work. I should fix this properly and add a test
as well.

fixes multisource/obsequi (maybe others)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21075 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-04 05:05:52 +00:00
Duraid Madina
09c61b9c19 add implicit use op
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21074 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-04 04:50:57 +00:00
Nate Begeman
79e46acd35 Handle expanding arguments to ISD::TRUNCATE. This happens on PowerPC when
you have something like i16 = truncate i64.  This fixes Regression/C/casts


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21073 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-04 00:57:08 +00:00
Chris Lattner
06098e0e9b Fix sign_extend and zero_extend of promoted value types to expanded value
types.  This occurs when casting short to long on PPC for example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21072 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-03 23:41:52 +00:00
Nate Begeman
6644d4c933 Full varargs support. All of UnitTests now passes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21070 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-03 23:11:17 +00:00
Nate Begeman
4ec0cbdf15 Pass the correct value for the chain to the store
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21066 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-03 22:22:56 +00:00
Nate Begeman
fa55470e39 Fix SHL_PARTS
Start implementation of integer varargs


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21065 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-03 22:13:27 +00:00
Andrew Lenharth
63b720ac7c is this simpler? I think it is simpler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21064 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-03 20:35:21 +00:00
Andrew Lenharth
500d025bd9 fix 101 regressions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21063 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-03 18:24:50 +00:00
Duraid Madina
162a837f63 .bss is no problem here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21061 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-03 14:52:01 +00:00
Nate Begeman
aa73a9f16f Keeping up with the Joneses.
Implement not, nor, nand, and eqv


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21060 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-03 11:20:20 +00:00
Andrew Lenharth
10c085b525 Select optimization
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21051 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 22:32:39 +00:00
Andrew Lenharth
0eaf6ce2ef Try several things. 1) drop /i from FP ops 2) factor out FP to Int moves and provide 21264 support for those 3) match not 4) match ornot andnot xornot
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21046 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 21:06:51 +00:00
Chris Lattner
1231aa3fa6 fix some VC compilation problems, thanks to Jeff C for pointing this out!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21044 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 20:17:09 +00:00
Chris Lattner
0700123431 EquivClassGraphs is now in DataStructure.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21042 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 20:08:17 +00:00
Chris Lattner
2ccc5f1081 use a callee_iterator typedef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21038 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 20:02:41 +00:00
Chris Lattner
021decc82d Change the ActualCallees callgraph from hash_multimap<Instruction,Function>
to std::set<std::pair<Inst,Func>> to avoid duplicate entries.

This speeds up the CompleteBU pass from 1.99s to .15s on povray and the
eqgraph passes from 1.5s to .16s on the same.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21031 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 19:17:18 +00:00
Andrew Lenharth
7332f3e05d FNEG/FABS/UNDEF
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21029 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 19:11:07 +00:00
Andrew Lenharth
30b46d41bc FNEG/FABS
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21028 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 19:04:58 +00:00
Duraid Madina
32c46f33b7 ia64 asmprinter fixes:
- turn off assembler's autoalignment
  - set FunctionAddrPrefix/Suffix so that .data8 entries pointing to
    functions have their value wrapped in @fptr(), so that a function
    descriptor will be materialized for that function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21025 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 12:30:47 +00:00
Duraid Madina
855a519741 add support for prefix/suffix strings to go around GlobalValue(s)
(which may or be function pointers) in the asmprinter. For the moment,
this changes nothing, except the IA64 backend which can use this to write:

  data8.ua  @fptr(blah__blah__mangled_function_name)

  (by setting FunctionAddrPrefix/Suffix to "@fptr(" / ")")


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21024 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 12:21:51 +00:00
Duraid Madina
75c9fcbdcc support IDEF, fnegabs (thanks sampo)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21023 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 10:33:53 +00:00
Duraid Madina
5c156b7473 add fnegabs op
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21022 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 10:06:27 +00:00
Nate Begeman
27eeb00a1a Set shift amount to Extend
Implement ISD::FABS and ISD::FNEG nodes
Implement SHL_PARTS, SRL_PARTS, and SRA_PARTS
Generate PowerPC 'fneg', 'fabs', and 'fnabs' instructions


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21018 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 05:59:34 +00:00
Chris Lattner
b7edaa1d08 add support for FABS and FNEG
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21015 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 05:30:17 +00:00
Chris Lattner
c0f18152d9 transform fabs/fabsf calls into FABS nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21014 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 05:26:53 +00:00
Chris Lattner
4af6e0d783 Expand fabs into fneg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21013 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 05:26:37 +00:00
Duraid Madina
a7ee8b8f04 add support FNEG and FABS
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21012 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 05:18:38 +00:00
Chris Lattner
b9fccc4193 Turn -0.0 - X -> fneg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21011 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 05:04:50 +00:00
Chris Lattner
43fdea070c This target doesn't support fabs/fneg yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21010 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 05:03:24 +00:00
Chris Lattner
2c8086f4b9 Several changes mixed up here. First when legalizing a DAG with pcmarker,
dont' regen the whole dag if unneccesary.  Second, fix and ugly bug with
the _PARTS nodes that caused legalize to produce multiples of them.
Finally, implement initial support for FABS and FNEG.  Currently FNEG is
the only one to be trusted though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21009 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 05:00:07 +00:00
Chris Lattner
ff9fd0a99c print fneg/fabs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21008 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 04:58:41 +00:00
Chris Lattner
b1f26fb921 add an fabs instr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21006 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 04:31:56 +00:00
Chris Lattner
b38a7495da Add support for 64-bit shifts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21005 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 04:01:14 +00:00
Chris Lattner
5b359c6c4f fix some bugs in the implementation of SHL_PARTS and friends.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21004 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 04:00:59 +00:00
Chris Lattner
4759982a2d Turn expanded shift operations into (e.g.) SHL_PARTS if the target supports it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21002 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 03:38:53 +00:00
Chris Lattner
41be951a47 Print some new nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21001 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 03:30:42 +00:00
Chris Lattner
f4b457987f Fix a bug when inserting a libcall into a function with no other calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20999 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 03:22:40 +00:00
Nate Begeman
27523a1c92 Fix i64 returns
Generate PowerPC 'subfic' instruction when appropriate


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20995 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 00:42:16 +00:00
Nate Begeman
ea19cd51aa Fix a warning about an unhandled switch case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20994 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 00:41:14 +00:00
Chris Lattner
7ce7eff54c Add support for ISD::UNDEF to the X86 be
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20990 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-01 22:46:45 +00:00
Nate Begeman
fc1b1dad88 Add ISD::UNDEF node
Teach the SelectionDAG code how to expand and promote it
Have PPC32 LowerCallTo generate ISD::UNDEF for int arg regs used up by fp
  arguments, but not shadowing their value.  This allows us to do the right
  thing with both fixed and vararg floating point arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20988 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-01 22:34:39 +00:00
Chris Lattner
e6fea166c3 Fix another PATypeHolder error, contributed by Bill Wendling!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20983 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-01 15:41:30 +00:00
Duraid Madina
69c8e20aa1 repair mindless SELECT waste.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20982 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-01 10:35:00 +00:00
Nate Begeman
6cb2e1b124 Fix Olden/bh, CR0 was being set in the wrong order
LowerCallTo and ISD::CALL are going to need to be modified, regs are being
set in the wrong order.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20981 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-01 08:57:43 +00:00
Nate Begeman
31318e4b6c Also apply Chris's fix to FP select and SETCC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20979 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-01 07:21:30 +00:00
Chris Lattner
3071019026 Move the selection of the arms of the select operation up to the conditional
part to make sure we get the side effects and to avoid confusing the CFG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20977 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-01 07:10:02 +00:00
Chris Lattner
380ae49599 print the machine CFG in the -print-machineinstrs dump
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20976 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-01 06:48:38 +00:00
Nate Begeman
a7e11a4bb5 Fix stores to global addresses
Fix calls with no arguments


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20975 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-01 05:57:17 +00:00
Nate Begeman
04730361b5 Support indexed loads and stores. This drops Shootout/matrix time from
18.8 to 14.8 seconds.  The Pattern ISel is now often faster than the
Simple ISel, esp. on memory intensive code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20973 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-01 04:45:11 +00:00
Nate Begeman
6b55997df5 Implement FP_TO_SINT and FP_TO_UINT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20972 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-01 02:59:27 +00:00
Nate Begeman
6d369ccae0 Add support for adding 0.0 and -0.0 to the constant pool, since we lie and
say that we support them, for the purposes of generating fsel instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20970 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-01 01:08:07 +00:00
Nate Begeman
dffcfccc13 Factor out common code, support FP comparison in folded SetCC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20969 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-01 00:32:34 +00:00
Nate Begeman
3e89716ad7 fsel generation for f32 and f64 select
generate compare immediate for integer compare with constant
fold setcc into branch
fold setcc into select

Code generation quality for Shootout is now on par with the Simple ISel


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20968 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-31 23:55:40 +00:00
Andrew Lenharth
5e99dd9c2b make fp div trick dependend on flag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20967 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-31 22:02:25 +00:00
Andrew Lenharth
95762124a1 PCMarker support for DAG and Alpha
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20965 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-31 21:24:06 +00:00