oota-llvm.git
18 years agoAdd AND/OR/XOR
Chris Lattner [Fri, 2 Sep 2005 22:35:53 +0000 (22:35 +0000)]
Add AND/OR/XOR

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

18 years agoNext round of DAG Combiner changes. Just need to support multiple return
Nate Begeman [Fri, 2 Sep 2005 21:18:40 +0000 (21:18 +0000)]
Next round of DAG Combiner changes.  Just need to support multiple return
values, and then we should be able to hook it up.

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

18 years agoAdd some initial patterns to simple binary instructions, though they
Chris Lattner [Fri, 2 Sep 2005 21:18:00 +0000 (21:18 +0000)]
Add some initial patterns to simple binary instructions, though they
currently don't do anything.  This elides patterns for binary operators
that ping on the carry flag, since we don't model it yet.

This patch also removes PPC::SUB, because it is dead.

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

18 years agoClean up some code from the last checkin
Chris Lattner [Fri, 2 Sep 2005 20:32:45 +0000 (20:32 +0000)]
Clean up some code from the last checkin

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

18 years agoFix a bug in legalize where it would emit two calls to libcalls that return
Chris Lattner [Fri, 2 Sep 2005 20:26:58 +0000 (20:26 +0000)]
Fix a bug in legalize where it would emit two calls to libcalls that return
i64 values on targets that need that expanded to 32-bit registers.  This fixes
PowerPC/2005-09-02-LegalizeDuplicatesCalls.ll and speeds up 189.lucas from
taking 122.72s to 81.96s on my desktop.

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

18 years agoTest that converting from double to int64 results in one libcall, not one
Chris Lattner [Fri, 2 Sep 2005 20:24:10 +0000 (20:24 +0000)]
Test that converting from double to int64 results in one libcall, not one
and a dead one.  This is a legalize bug

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

18 years agoturn on dag isel by default
Chris Lattner [Fri, 2 Sep 2005 19:53:54 +0000 (19:53 +0000)]
turn on dag isel by default

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

18 years agoMake sure to auto-cse nullary ops
Chris Lattner [Fri, 2 Sep 2005 19:36:17 +0000 (19:36 +0000)]
Make sure to auto-cse nullary ops

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

18 years agoadd a map for nullary ops
Chris Lattner [Fri, 2 Sep 2005 19:35:42 +0000 (19:35 +0000)]
add a map for nullary ops

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

18 years agoAdd help support for -mcpu and -mattr.
Jim Laskey [Fri, 2 Sep 2005 19:27:43 +0000 (19:27 +0000)]
Add help support for -mcpu and -mattr.

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

18 years agoFix some buggy logic where we would try to remove nodes with two operands
Chris Lattner [Fri, 2 Sep 2005 19:15:44 +0000 (19:15 +0000)]
Fix some buggy logic where we would try to remove nodes with two operands
from the binary ops map, even if they had multiple results.  This latent bug
caused a few failures with the dag isel last night.

To prevent stuff like this from happening in the future, add some really
strict checking to make sure that the CSE maps always match up with reality!

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

18 years agoPull out Lowering in preperation for multiple ISels. Oh, and get rid of some stuff
Andrew Lenharth [Fri, 2 Sep 2005 18:46:02 +0000 (18:46 +0000)]
Pull out Lowering in preperation for multiple ISels.  Oh, and get rid of some stuff

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

18 years agoDon't create zero sized stack objects even for array allocas with a zero
Chris Lattner [Fri, 2 Sep 2005 18:41:28 +0000 (18:41 +0000)]
Don't create zero sized stack objects even for array allocas with a zero
number of elements.

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

18 years agoDecouple fsqrt from gpul optimizations, implementing fsqrt.ll.
Chris Lattner [Fri, 2 Sep 2005 18:33:05 +0000 (18:33 +0000)]
Decouple fsqrt from gpul optimizations, implementing fsqrt.ll.
Remove the -enable-gpopt option which is subsumed by feature flags.

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

18 years agonew testcase to ensure fsqrt is generated for correct subtargets only, and
Chris Lattner [Fri, 2 Sep 2005 18:32:22 +0000 (18:32 +0000)]
new testcase to ensure fsqrt is generated for correct subtargets only, and
that the fsqrt feature works.

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

18 years agoMove a bunch of non-deprecated methods above the "deprecated line"
Chris Lattner [Fri, 2 Sep 2005 18:16:20 +0000 (18:16 +0000)]
Move a bunch of non-deprecated methods above the "deprecated line"

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

18 years agoFix the release build, noticed by Eric van Riet Paap
Chris Lattner [Fri, 2 Sep 2005 07:09:28 +0000 (07:09 +0000)]
Fix the release build, noticed by Eric van Riet Paap

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

18 years agoFix a problem that Dan Berlin noticed, where reassociation would not succeed
Chris Lattner [Fri, 2 Sep 2005 07:07:58 +0000 (07:07 +0000)]
Fix a problem that Dan Berlin noticed, where reassociation would not succeed
in building maximal expressions before simplifying them.  In particular, i
cases like this:

X-(A+B+X)

the code would consider A+B+X to be a maximal expression (not understanding
that the single use '-' would be turned into a + later), simplify it (a noop)
then later get simplified again.

Each of these simplify steps is where the cost of reassociation comes from,
so this patch should speed up the already fast pass a bit.

Thanks to Dan for noticing this!

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

18 years agoAvoid creating garbage instructions, just move the old add instruction
Chris Lattner [Fri, 2 Sep 2005 06:38:04 +0000 (06:38 +0000)]
Avoid creating garbage instructions, just move the old add instruction
to where we need it when converting -(A+B+C) -> -A + -B + -C.

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

18 years agonew testcase for recent bugfix
Chris Lattner [Fri, 2 Sep 2005 06:12:12 +0000 (06:12 +0000)]
new testcase for recent bugfix

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

18 years agoadd some assertions and fix problems where reassociate could access the
Chris Lattner [Fri, 2 Sep 2005 05:23:22 +0000 (05:23 +0000)]
add some assertions and fix problems where reassociate could access the
Ops vector out of range

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

18 years agoFix VC++ build errors
Jeff Cohen [Fri, 2 Sep 2005 02:51:42 +0000 (02:51 +0000)]
Fix VC++ build errors

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

18 years agoRestore this patch now that the latent bug has been fixed
Chris Lattner [Fri, 2 Sep 2005 01:24:55 +0000 (01:24 +0000)]
Restore this patch now that the latent bug has been fixed

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

18 years agoMake sure to legalize assert[zs]ext's operand correctly
Chris Lattner [Fri, 2 Sep 2005 01:15:01 +0000 (01:15 +0000)]
Make sure to legalize assert[zs]ext's operand correctly

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

18 years agoRevert the previous patch which causes a mysterious regression in toast.
Chris Lattner [Fri, 2 Sep 2005 00:47:05 +0000 (00:47 +0000)]
Revert the previous patch which causes a mysterious regression in toast.

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

18 years agoTeach live intervals to not crash on dead livein regs
Chris Lattner [Fri, 2 Sep 2005 00:20:32 +0000 (00:20 +0000)]
Teach live intervals to not crash on dead livein regs

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

18 years agoFor values that are live across basic blocks and need promotion, use ANY_EXTEND
Chris Lattner [Fri, 2 Sep 2005 00:19:37 +0000 (00:19 +0000)]
For values that are live across basic blocks and need promotion, use ANY_EXTEND
instead of ZERO_EXTEND to eliminate extraneous extensions.  This eliminates
dead zero extensions on formal arguments and other cases on PPC, implementing
the newly tightened up test/Regression/CodeGen/PowerPC/small-arguments.ll test.

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

18 years agolegalize ANY_EXTEND appropriately
Chris Lattner [Fri, 2 Sep 2005 00:18:10 +0000 (00:18 +0000)]
legalize ANY_EXTEND appropriately

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

18 years agoAdd support for ANY_EXTEND and add a few minor folds for it
Chris Lattner [Fri, 2 Sep 2005 00:17:32 +0000 (00:17 +0000)]
Add support for ANY_EXTEND and add a few minor folds for it

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

18 years agoHandle any_extend like zext
Chris Lattner [Fri, 2 Sep 2005 00:16:09 +0000 (00:16 +0000)]
Handle any_extend like zext

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

18 years agoHandle ANY_EXTEND like ZERO_EXTEND. Simplify the extend/truncate code on
Chris Lattner [Fri, 2 Sep 2005 00:15:30 +0000 (00:15 +0000)]
Handle ANY_EXTEND like ZERO_EXTEND.  Simplify the extend/truncate code on
the observation that it only has to handle i1 -> i64 and i64 -> i1.

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

18 years agoAdd a new ANY_EXTEND node, which operates like an extension but has undefined
Chris Lattner [Fri, 2 Sep 2005 00:14:40 +0000 (00:14 +0000)]
Add a new ANY_EXTEND node, which operates like an extension but has undefined
top bits.

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

18 years agoThis should permit NOT and's, not even dead ones.
Chris Lattner [Fri, 2 Sep 2005 00:13:56 +0000 (00:13 +0000)]
This should permit NOT and's, not even dead ones.

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

18 years agoImplement small-arguments.ll:test3 by teaching the DAG optimizer that
Chris Lattner [Thu, 1 Sep 2005 23:44:32 +0000 (23:44 +0000)]
Implement small-arguments.ll:test3 by teaching the DAG optimizer that
the results of calls to functions returning small values are properly
sign/zero extended.

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

18 years agoAnother case that shouldn't have sign extends: functions returning short
Chris Lattner [Thu, 1 Sep 2005 23:43:58 +0000 (23:43 +0000)]
Another case that shouldn't have sign extends: functions returning short
are known to return properly sign extended values, no need for an explicit
extension.

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

18 years agoFix some code in the current node combining code, spotted when it was moved
Nate Begeman [Thu, 1 Sep 2005 23:25:49 +0000 (23:25 +0000)]
Fix some code in the current node combining code, spotted when it was moved
over to DAGCombiner.cpp

1. Don't assume that SetCC returns i1 when folding (xor (setcc) constant)
2. Don't duplicate code in folding AND with AssertZext that is handled by
   MaskedValueIsZero

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

18 years agoImplement first round of feedback from chris (there's still a couple things
Nate Begeman [Thu, 1 Sep 2005 23:24:04 +0000 (23:24 +0000)]
Implement first round of feedback from chris (there's still a couple things
left to do).

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

18 years agoAlign functions to 16-byte boundaries, to eliminate noise in performance measurements...
Chris Lattner [Thu, 1 Sep 2005 23:08:50 +0000 (23:08 +0000)]
Align functions to 16-byte boundaries, to eliminate noise in performance measurements.  This improves the performance of 'treeadd' by about 20% with the dag
isel, restoring it to the pattern-isel level (which happens to get the alignment right).

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

18 years agoLocal labels on darwin apparently start with just 'L', not .L like other
Chris Lattner [Thu, 1 Sep 2005 21:48:35 +0000 (21:48 +0000)]
Local labels on darwin apparently start with just 'L', not .L like other
platforms.  This reduces executable size and makes shark realize the actual
bounds of functions instead of showing each MBB as a function :)

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

18 years ago1. Use SubtargetFeatures in llc/lli.
Jim Laskey [Thu, 1 Sep 2005 21:38:21 +0000 (21:38 +0000)]
1. Use SubtargetFeatures in llc/lli.

2. Propagate feature "string" to all targets.

3. Implement use of SubtargetFeatures in PowerPCTargetSubtarget.

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

18 years agoThis new class provides support for platform specific "features". The intent
Jim Laskey [Thu, 1 Sep 2005 21:36:18 +0000 (21:36 +0000)]
This new class provides support for platform specific "features".  The intent
is to manage processor specific attributes from the command line.  See examples
of use in llc/lli and PowerPCTargetSubtarget.

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

18 years agoImplement dynamic allocas correctly. In particular, because we were copying
Chris Lattner [Thu, 1 Sep 2005 21:31:30 +0000 (21:31 +0000)]
Implement dynamic allocas correctly.  In particular, because we were copying
directly out of R1 (without using a CopyFromReg, which uses a chain), multiple
allocas were getting CSE'd together, producing bogus code.  For this:

int %foo(bool %X, int %A, int %B) {
        br bool %X, label %T, label %F
F:
        %G = alloca int
        %H = alloca int
        store int %A, int* %G
        store int %B, int* %H
        %R = load int* %G
        ret int %R
T:
        ret int 0
}

We were generating:

_foo:
        stwu r1, -16(r1)
        stw r31, 4(r1)
        or r31, r1, r1
        stw r1, 12(r31)
        cmpwi cr0, r3, 0
        bne cr0, .LBB_foo_2     ; T
.LBB_foo_1:     ; F
        li r2, 16
        subf r2, r2, r1   ;; One alloca
        or r1, r2, r2
        or r3, r1, r1
        or r1, r2, r2
        or r2, r1, r1
        stw r4, 0(r3)
        stw r5, 0(r2)
        lwz r3, 0(r3)
        lwz r1, 12(r31)
        lwz r31, 4(r31)
        lwz r1, 0(r1)
        blr
.LBB_foo_2:     ; T
        li r3, 0
        lwz r1, 12(r31)
        lwz r31, 4(r31)
        lwz r1, 0(r1)
        blr

Now we generate:

_foo:
        stwu r1, -16(r1)
        stw r31, 4(r1)
        or r31, r1, r1
        stw r1, 12(r31)
        cmpwi cr0, r3, 0
        bne cr0, .LBB_foo_2     ; T
.LBB_foo_1:     ; F
        or r2, r1, r1
        li r3, 16
        subf r2, r3, r2  ;; Alloca 1
        or r1, r2, r2
        or r2, r1, r1
        or r6, r1, r1
        subf r3, r3, r6  ;; Alloca 2
        or r1, r3, r3
        or r3, r1, r1
        stw r4, 0(r2)
        stw r5, 0(r3)
        lwz r3, 0(r2)
        lwz r1, 12(r31)
        lwz r31, 4(r31)
        lwz r1, 0(r1)
        blr
.LBB_foo_2:     ; T
        li r3, 0
        lwz r1, 12(r31)
        lwz r31, 4(r31)
        lwz r1, 0(r1)
        blr

This fixes Povray and SPASS with the dag isel, the last two failing cases.
Tommorow we will hopefully turn it on by default! :)

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

18 years agoFix a bug where we were useing HA to get the high part, which seems like it
Chris Lattner [Thu, 1 Sep 2005 19:38:28 +0000 (19:38 +0000)]
Fix a bug where we were useing HA to get the high part, which seems like it
could cause a miscompile.  Fixing this didn't fix the two programs that fail
though.  :(

This also changes the implementation to follow the pattern selector more
closely, causing us to select 0 to li instead of lis.

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

18 years agoDo not select the operands being passed into SelectCC. IT does this itself
Chris Lattner [Thu, 1 Sep 2005 19:20:44 +0000 (19:20 +0000)]
Do not select the operands being passed into SelectCC.  IT does this itself
and selecting early prevents folding immediates into the cmpw* instructions

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

18 years agoIt is NDEBUG not _NDEBUG
Chris Lattner [Thu, 1 Sep 2005 18:44:10 +0000 (18:44 +0000)]
It is NDEBUG not _NDEBUG

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

18 years agoAdd the rest of the currently implemented visit routines to the switch
Nate Begeman [Thu, 1 Sep 2005 00:33:32 +0000 (00:33 +0000)]
Add the rest of the currently implemented visit routines to the switch
statement in visit().

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

18 years agoFirst pass at the DAG Combiner. It isn't used anywhere yet, but it should
Nate Begeman [Thu, 1 Sep 2005 00:19:25 +0000 (00:19 +0000)]
First pass at the DAG Combiner.  It isn't used anywhere yet, but it should
be mostly functional.  It currently has all folds from SelectionDAG.cpp
that do not involve a condition code.

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

18 years agoAdd regression test for efficient codegen of i32 x i32 -> hi32(i64) as
Nate Begeman [Thu, 1 Sep 2005 00:04:03 +0000 (00:04 +0000)]
Add regression test for efficient codegen of i32 x i32 -> hi32(i64) as
mulhs.

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

18 years agoremove an inappropriate comment
Chris Lattner [Wed, 31 Aug 2005 22:49:51 +0000 (22:49 +0000)]
remove an inappropriate comment

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

18 years agoIf a function has live ins/outs, print them
Chris Lattner [Wed, 31 Aug 2005 22:34:59 +0000 (22:34 +0000)]
If a function has live ins/outs, print them

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

18 years agoMove FCTIWZ handling out of the instruction selectors and into legalization,
Chris Lattner [Wed, 31 Aug 2005 21:09:52 +0000 (21:09 +0000)]
Move FCTIWZ handling out of the instruction selectors and into legalization,
getting them out of the business of making stack slots.

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

18 years agoRemove dead code
Chris Lattner [Wed, 31 Aug 2005 20:25:15 +0000 (20:25 +0000)]
Remove dead code

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

18 years agoMove SHL,SHR i64 -> legalizer
Chris Lattner [Wed, 31 Aug 2005 20:23:54 +0000 (20:23 +0000)]
Move SHL,SHR i64 -> legalizer

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

18 years agoRemove code that is now dead from the pattern isel.
Chris Lattner [Wed, 31 Aug 2005 19:11:36 +0000 (19:11 +0000)]
Remove code that is now dead from the pattern isel.

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

18 years agolower sra_parts on the dag, implementing it for the dag isel, and exposing
Chris Lattner [Wed, 31 Aug 2005 19:09:57 +0000 (19:09 +0000)]
lower sra_parts on the dag, implementing it for the dag isel, and exposing
the ops to dag optimization.

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

18 years agoAllow targets to custom expand shifts that are too large for their registers
Chris Lattner [Wed, 31 Aug 2005 19:01:53 +0000 (19:01 +0000)]
Allow targets to custom expand shifts that are too large for their registers

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

18 years agoAdd a testcase for nate's patch
Chris Lattner [Wed, 31 Aug 2005 18:19:50 +0000 (18:19 +0000)]
Add a testcase for nate's patch

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

18 years agoadd assert zext/sext to the dag isel
Chris Lattner [Wed, 31 Aug 2005 18:08:46 +0000 (18:08 +0000)]
add assert zext/sext to the dag isel

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

18 years agoHandle AssertSext/AssertZext nodes, fixing the regressions last night.
Chris Lattner [Wed, 31 Aug 2005 17:48:04 +0000 (17:48 +0000)]
Handle AssertSext/AssertZext nodes, fixing the regressions last night.

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

18 years agoFix VC++ precedence warnings
Jeff Cohen [Wed, 31 Aug 2005 02:47:06 +0000 (02:47 +0000)]
Fix VC++ precedence warnings

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

18 years agoEnable generation of AssertSext and AssertZext in the PPC backend.
Nate Begeman [Wed, 31 Aug 2005 01:58:39 +0000 (01:58 +0000)]
Enable generation of AssertSext and AssertZext in the PPC backend.

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

18 years agoFix 'ret long' to return the high and lo parts in the right registers. This
Chris Lattner [Wed, 31 Aug 2005 01:34:29 +0000 (01:34 +0000)]
Fix 'ret long' to return the high and lo parts in the right registers.  This
fixes crafty and probably others.

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

18 years agoSigh, not my day. Fix typo.
Nate Begeman [Wed, 31 Aug 2005 00:43:49 +0000 (00:43 +0000)]
Sigh, not my day.  Fix typo.

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

18 years agoFix a mistake in my previous patch pointed out by sabre; the AssertZext
Nate Begeman [Wed, 31 Aug 2005 00:43:08 +0000 (00:43 +0000)]
Fix a mistake in my previous patch pointed out by sabre; the AssertZext
case in MaskedValueIsZero was wrong.

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

18 years agoRemove some unnecessary casts, and add the AssertZext case to
Nate Begeman [Wed, 31 Aug 2005 00:27:53 +0000 (00:27 +0000)]
Remove some unnecessary casts, and add the AssertZext case to
MaskedValueIsZero.

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

18 years agoAdd support for count trailing zeroes, and population count. These are
Nate Begeman [Wed, 31 Aug 2005 00:25:01 +0000 (00:25 +0000)]
Add support for count trailing zeroes, and population count.  These are
needed for folding constants in the upcoming dag combiner.

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

18 years agonow that physregs can exist in the same dag with multiple types, remove some
Chris Lattner [Tue, 30 Aug 2005 22:59:48 +0000 (22:59 +0000)]
now that physregs can exist in the same dag with multiple types, remove some
ugly hacks

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

18 years agoAllow physregs to occur in the dag with multiple types. Though I don't likethis...
Chris Lattner [Tue, 30 Aug 2005 22:38:38 +0000 (22:38 +0000)]
Allow physregs to occur in the dag with multiple types.  Though I don't likethis, it is a requirement on PPC, which can have an f32 value in r3 at onepoint in a function and a f64 value in r3 at another point.  :(

This fixes compilation of mesa

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

18 years agoAllow physregs to occur in the dag with multiple types. Though I don't like
Chris Lattner [Tue, 30 Aug 2005 22:38:05 +0000 (22:38 +0000)]
Allow physregs to occur in the dag with multiple types.  Though I don't like
this, it is a requirement on PPC, which can have an f32 value in r3 at one
point in a function and a f64 value in r3 at another point.  :(

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

18 years agoFix type mismatches when passing f32 values to calls
Chris Lattner [Tue, 30 Aug 2005 21:28:19 +0000 (21:28 +0000)]
Fix type mismatches when passing f32 values to calls

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

18 years agoWhen checking the fixed intervals, don't forget to check for register aliases.
Chris Lattner [Tue, 30 Aug 2005 21:03:36 +0000 (21:03 +0000)]
When checking the fixed intervals, don't forget to check for register aliases.
This fixes PR621 and Regression/CodeGen/X86/2005-08-30-RegAllocAliasProblem.ll

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

18 years agonew testcase corresponding to PR621
Chris Lattner [Tue, 30 Aug 2005 21:02:51 +0000 (21:02 +0000)]
new testcase corresponding to PR621

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

18 years agoThe dag isel misses both of these, the pattern isel just misses the second
Chris Lattner [Tue, 30 Aug 2005 18:44:09 +0000 (18:44 +0000)]
The dag isel misses both of these, the pattern isel just misses the second
one.  TODO :)

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

18 years agoFix some indentation (first hunks).
Chris Lattner [Tue, 30 Aug 2005 18:37:48 +0000 (18:37 +0000)]
Fix some indentation (first hunks).

Remove code (last hunk) that miscompiled immediate and's, such as
  and uint %tmp.30, 4294958079

into

 andi. r8, r8, 56319
 andis. r8, r8, 65535

instead of:

 li r9, -9217
 and r8, r8, r9

The first always generates zero.

This fixes espresso.

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

18 years agoFix a problem Nate found where we swapped the operands of SHL/SHR_PARTS. This
Chris Lattner [Tue, 30 Aug 2005 17:42:59 +0000 (17:42 +0000)]
Fix a problem Nate found where we swapped the operands of SHL/SHR_PARTS.  This
fixes fourinarow

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

18 years agocodegen ADD_PARTS correctly: put the results in the right registers! This
Chris Lattner [Tue, 30 Aug 2005 17:40:13 +0000 (17:40 +0000)]
codegen ADD_PARTS correctly: put the results in the right registers!  This
fixes fhourstones

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

18 years agoFix FreeBench/fourinarow with the dag isel, by not adding a bogus result
Chris Lattner [Tue, 30 Aug 2005 17:21:17 +0000 (17:21 +0000)]
Fix FreeBench/fourinarow with the dag isel, by not adding a bogus result
to SHIFT_PARTS nodes

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

18 years agoadd operands in the right order, fixing McCat/18-imp with the dag isel
Chris Lattner [Tue, 30 Aug 2005 17:13:58 +0000 (17:13 +0000)]
add operands in the right order, fixing McCat/18-imp with the dag isel

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

18 years agoFix a miscompile of PtrDist/bc. Sign extending bools is not the right thing,
Chris Lattner [Tue, 30 Aug 2005 16:56:19 +0000 (16:56 +0000)]
Fix a miscompile of PtrDist/bc.  Sign extending bools is not the right thing,
at least tends to expose problems elsewhere.

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

18 years agoRemove a bogus piece of my AssertSext/AssertZext patch. oops.
Nate Begeman [Tue, 30 Aug 2005 02:54:28 +0000 (02:54 +0000)]
Remove a bogus piece of my AssertSext/AssertZext patch.  oops.

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

18 years agoAdd support for AssertSext and AssertZext, folding other extensions with
Nate Begeman [Tue, 30 Aug 2005 02:44:00 +0000 (02:44 +0000)]
Add support for AssertSext and AssertZext, folding other extensions with
them.  This allows for elminination of redundant extends in the entry
blocks of functions on PowerPC.

Add support for i32 x i32 -> i64 multiplies, by recognizing when the inputs
to ISD::MUL in ExpandOp are actually just extended i32 values and not real
i64 values.  this allows us to codegen

int mulhs(int a, int b) { return ((long long)a * b) >> 32; }
as:
_mulhs:
        mulhw r3, r4, r3
        blr

instead of:
_mulhs:
        mulhwu r2, r4, r3
        srawi r5, r3, 31
        mullw r5, r4, r5
        add r2, r2, r5
        srawi r4, r4, 31
        mullw r3, r4, r3
        add r3, r2, r3
        blr

with a similar improvement on x86.

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

18 years agoAdd AssertSext, AssertZext nodes for targets that pass arguments in
Nate Begeman [Tue, 30 Aug 2005 02:39:32 +0000 (02:39 +0000)]
Add AssertSext, AssertZext nodes for targets that pass arguments in
registers, and the incoming values have already been zero or sign extended
from the appopriate type to the register width.

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

18 years agoName this variable to be what it really is!
Chris Lattner [Tue, 30 Aug 2005 01:58:51 +0000 (01:58 +0000)]
Name this variable to be what it really is!

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

18 years agoHandle CopyToReg nodes with flag operands correctly
Chris Lattner [Tue, 30 Aug 2005 01:57:23 +0000 (01:57 +0000)]
Handle CopyToReg nodes with flag operands correctly

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

18 years agoMake sure the selector emits register register copies with flag operands
Chris Lattner [Tue, 30 Aug 2005 01:57:02 +0000 (01:57 +0000)]
Make sure the selector emits register register copies with flag operands
linking them to calls when appropriate, this prevents the scheduler from
pulling these copies away from the call.

This fixes Ptrdist/yacr2

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

18 years agoadd some method variants
Chris Lattner [Tue, 30 Aug 2005 01:56:13 +0000 (01:56 +0000)]
add some method variants

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

18 years agoThe first operand to AND does not always have more than two operands. This
Chris Lattner [Tue, 30 Aug 2005 00:59:16 +0000 (00:59 +0000)]
The first operand to AND does not always have more than two operands. This
fixes MediaBench/toast with the dag selector

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

18 years agoFix a bug in my patch for legalizing to fsel. It cannot handle seteq/setne,
Chris Lattner [Tue, 30 Aug 2005 00:45:18 +0000 (00:45 +0000)]
Fix a bug in my patch for legalizing to fsel.  It cannot handle seteq/setne,
which I failed to include when I moved the code over.  This fixes
MallocBench/gs.

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

18 years agoemit FMR instructions to convert f64<->f32 instructions, so things like
Chris Lattner [Tue, 30 Aug 2005 00:30:43 +0000 (00:30 +0000)]
emit FMR instructions to convert f64<->f32 instructions, so things like
STOREs, know the right type to store.

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

18 years agoFix some really strange indentation that xcode likes to use.
Chris Lattner [Tue, 30 Aug 2005 00:19:00 +0000 (00:19 +0000)]
Fix some really strange indentation that xcode likes to use.

no xcode, this is not right:

   if (!foo) break;
     X;

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

18 years agofix a crash in cfrac
Chris Lattner [Mon, 29 Aug 2005 23:49:25 +0000 (23:49 +0000)]
fix a crash in cfrac

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

18 years agoImplement DYNAMIC_STACKALLOC, wrap some long lines
Chris Lattner [Mon, 29 Aug 2005 23:30:11 +0000 (23:30 +0000)]
Implement DYNAMIC_STACKALLOC, wrap some long lines

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

18 years agoAdd a hack to avoid some horrible code in some cases by always emitting
Chris Lattner [Mon, 29 Aug 2005 23:21:29 +0000 (23:21 +0000)]
Add a hack to avoid some horrible code in some cases by always emitting
token chains first.  For this C function:

int test() {
  int i;
  for (i = 0; i < 100000; ++i)
    foo();
}

Instead of emitting this (condition before call)

.LBB_test_1:    ; no_exit
        addi r30, r30, 1
        lis r2, 1
        ori r2, r2, 34464
        cmpw cr2, r30, r2
        bl L_foo$stub
        bne cr2, .LBB_test_1    ; no_exit

Emit this:

.LBB_test_1:    ; no_exit
        bl L_foo$stub
        addi r30, r30, 1
        lis r2, 1
        ori r2, r2, 34464
        cmpw cr0, r30, r2
        bne cr0, .LBB_test_1    ; no_exit

Which makes it so we don't have to save/restore cr2 in the prolog/epilog of
the function.

This also makes the code much more similar to what the pattern isel produces.

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

18 years agoimprove comment
Chris Lattner [Mon, 29 Aug 2005 22:48:32 +0000 (22:48 +0000)]
improve comment

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

18 years agoFix a dumb bug of mine where we were mishandling the PPC ABI (undef handling).
Chris Lattner [Mon, 29 Aug 2005 22:22:57 +0000 (22:22 +0000)]
Fix a dumb bug of mine where we were mishandling the PPC ABI (undef handling).
This fixes voronoi and bh in Olden, allowing all of olden to pass!

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

18 years agoAdd a new API for nate
Chris Lattner [Mon, 29 Aug 2005 22:00:00 +0000 (22:00 +0000)]
Add a new API for nate

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

18 years agoAdd a new API for Nate
Chris Lattner [Mon, 29 Aug 2005 21:59:31 +0000 (21:59 +0000)]
Add a new API for Nate

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

18 years agoSome of us cared about the the promote path
Andrew Lenharth [Mon, 29 Aug 2005 20:46:51 +0000 (20:46 +0000)]
Some of us cared about the the promote path

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

18 years agoFix an infinite loop on x86
Chris Lattner [Mon, 29 Aug 2005 17:30:00 +0000 (17:30 +0000)]
Fix an infinite loop on x86

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

18 years agoAllow bugpoint+PPC codegen to use fsqrt
Chris Lattner [Mon, 29 Aug 2005 13:14:24 +0000 (13:14 +0000)]
Allow bugpoint+PPC codegen to use fsqrt

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