oota-llvm.git
18 years agoAdd a testcase for load short -> uint, which is currently emitted as a
Nate Begeman [Thu, 18 Aug 2005 03:11:44 +0000 (03:11 +0000)]
Add a testcase for load short -> uint, which is currently emitted as a
zextload + sign_extend_inreg rather than a sextload.

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

18 years agoAdd a bunch more simple nodes.
Nate Begeman [Thu, 18 Aug 2005 03:04:18 +0000 (03:04 +0000)]
Add a bunch more simple nodes.

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

18 years agoAdd a couple more nodes that are easy to handle
Nate Begeman [Thu, 18 Aug 2005 00:53:47 +0000 (00:53 +0000)]
Add a couple more nodes that are easy to handle

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

18 years agoBe fruitful and multiply!
Nate Begeman [Thu, 18 Aug 2005 00:21:41 +0000 (00:21 +0000)]
Be fruitful and multiply!

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

18 years agoBetter version of isIntImmediate.
Jim Laskey [Thu, 18 Aug 2005 00:15:15 +0000 (00:15 +0000)]
Better version of isIntImmediate.

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

18 years agomessed up
Jim Laskey [Wed, 17 Aug 2005 23:57:24 +0000 (23:57 +0000)]
messed up

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

18 years agoinclude/llvm/Support/MathExtras.h
Jim Laskey [Wed, 17 Aug 2005 23:54:12 +0000 (23:54 +0000)]
include/llvm/Support/MathExtras.h

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

18 years agoTeach the DAG->DAG ISel about FNEG, and how it can be used to invert
Nate Begeman [Wed, 17 Aug 2005 23:46:35 +0000 (23:46 +0000)]
Teach the DAG->DAG ISel about FNEG, and how it can be used to invert
several of the PowerPC opcodes that come in both negated and non-negated
forms.

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

18 years agoAdd two new methods isTargetOpcode() which returns true if the node type
Nate Begeman [Wed, 17 Aug 2005 23:44:54 +0000 (23:44 +0000)]
Add two new methods isTargetOpcode() which returns true if the node type
is greater than the range of building selection dag node types, and
getTargetOpcode(), which returns the node opcode less the value of
isd::builtin_op_end, which specifies the end of the builtin types.

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

18 years agoFix Transforms/LoopStrengthReduce/2005-08-17-OutOfLoopVariant.ll, a crash
Chris Lattner [Wed, 17 Aug 2005 21:22:41 +0000 (21:22 +0000)]
Fix Transforms/LoopStrengthReduce/2005-08-17-OutOfLoopVariant.ll, a crash
on 177.mesa

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

18 years agonew testcase distilled from mesa
Chris Lattner [Wed, 17 Aug 2005 21:21:47 +0000 (21:21 +0000)]
new testcase distilled from mesa

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

18 years agoMove the code dependency for MathExtras.h from SelectionDAGNodes.h.
Jim Laskey [Wed, 17 Aug 2005 20:08:02 +0000 (20:08 +0000)]
Move the code dependency for MathExtras.h from SelectionDAGNodes.h.

Added some class dividers in SelectionDAG.cpp.

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

18 years agoMove code dependency for MathExtras.h out of Constants.h.
Jim Laskey [Wed, 17 Aug 2005 20:06:22 +0000 (20:06 +0000)]
Move code dependency for MathExtras.h out of Constants.h.

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

18 years agoPromote dependency for MathExtras.h out of Constants.h.
Jim Laskey [Wed, 17 Aug 2005 20:04:34 +0000 (20:04 +0000)]
Promote dependency for MathExtras.h out of Constants.h.

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

18 years agoCulling out use of unions for converting FP to bits and vice versa.
Jim Laskey [Wed, 17 Aug 2005 19:34:49 +0000 (19:34 +0000)]
Culling out use of unions for converting FP to bits and vice versa.

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

18 years agoadd a beta option for turning on dag->dag isel
Chris Lattner [Wed, 17 Aug 2005 19:33:30 +0000 (19:33 +0000)]
add a beta option for turning on dag->dag isel

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

18 years agoinitial hack at a dag->dag instruction selector. This is obviously woefully
Chris Lattner [Wed, 17 Aug 2005 19:33:03 +0000 (19:33 +0000)]
initial hack at a dag->dag instruction selector.  This is obviously woefully
incomplete, but it is a start.  It handles basic argument/retval stuff, immediates,
add and sub.

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

18 years agoadd prototype, remove dead proto
Chris Lattner [Wed, 17 Aug 2005 19:32:03 +0000 (19:32 +0000)]
add prototype, remove dead proto

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

18 years agoFix a bug in RemoveDeadNodes where it would crash when its "optional"
Chris Lattner [Wed, 17 Aug 2005 19:00:20 +0000 (19:00 +0000)]
Fix a bug in RemoveDeadNodes where it would crash when its "optional"
argument is not specified.

Implement ReplaceAllUsesWith.

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

18 years agoadd ReplaceAllUsesWith, and a helper to implemented it
Chris Lattner [Wed, 17 Aug 2005 18:59:17 +0000 (18:59 +0000)]
add ReplaceAllUsesWith, and a helper to implemented it

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

18 years agoMake removeUser more efficient, add a matching addUser.
Chris Lattner [Wed, 17 Aug 2005 18:58:38 +0000 (18:58 +0000)]
Make removeUser more efficient, add a matching addUser.
Fix the setOperands methods I added to update use/def information correctly.

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

18 years agoSwitched to using BitsToDouble for int_to_float to avoid aliasing problem.
Jim Laskey [Wed, 17 Aug 2005 17:42:52 +0000 (17:42 +0000)]
Switched to using BitsToDouble for int_to_float to avoid aliasing problem.

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

18 years agoAdded support for converting raw bits to FP, and FP to raw bits. The intent
Jim Laskey [Wed, 17 Aug 2005 17:27:47 +0000 (17:27 +0000)]
Added support for converting raw bits to FP, and FP to raw bits.  The intent
is to avoid the distraction of the union declarations.

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

18 years agoFix some bugs in the alpha backend, some of which I introduced yesterday,
Chris Lattner [Wed, 17 Aug 2005 17:08:24 +0000 (17:08 +0000)]
Fix some bugs in the alpha backend, some of which I introduced yesterday,
and some that were preexisting.  All alpha regtests pass now.

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

18 years agoChange hex float constants for the sake of VC++.
Jim Laskey [Wed, 17 Aug 2005 09:44:59 +0000 (09:44 +0000)]
Change hex float constants for the sake of VC++.

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

18 years agoThis was moved to the .cpp file
Chris Lattner [Wed, 17 Aug 2005 06:46:50 +0000 (06:46 +0000)]
This was moved to the .cpp file

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

18 years agoAdd a new beta option for critical edge splitting, to avoid a problem that
Chris Lattner [Wed, 17 Aug 2005 06:37:43 +0000 (06:37 +0000)]
Add a new beta option for critical edge splitting, to avoid a problem that
Nate noticed in yacr2 (and I know occurs in other places as well).

This is still rough, as the critical edge blocks are not intelligently placed
but is added to get some idea to see if this improves performance.

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

18 years agoUse a new helper to split critical edges, making the code simpler.
Chris Lattner [Wed, 17 Aug 2005 06:35:16 +0000 (06:35 +0000)]
Use a new helper to split critical edges, making the code simpler.

Do not claim to not change the CFG.  We do change the cfg to split critical
edges.  This isn't causing us a problem now, but could likely do so in the
future.

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

18 years agoadd a helper
Chris Lattner [Wed, 17 Aug 2005 06:34:37 +0000 (06:34 +0000)]
add a helper

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

18 years agoFix a regression on X86, where FP values can be promoted too.
Chris Lattner [Wed, 17 Aug 2005 06:06:25 +0000 (06:06 +0000)]
Fix a regression on X86, where FP values can be promoted too.

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

18 years agoFix grammar
Misha Brukman [Wed, 17 Aug 2005 02:38:56 +0000 (02:38 +0000)]
Fix grammar

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

18 years agomake sure to remove a node from the use list of its operands when we replace
Chris Lattner [Wed, 17 Aug 2005 01:54:00 +0000 (01:54 +0000)]
make sure to remove a node from the use list of its operands when we replace
it.

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

18 years agoFix a few small typos I noticed when converting this over to the DAG->DAG
Chris Lattner [Wed, 17 Aug 2005 01:25:14 +0000 (01:25 +0000)]
Fix a few small typos I noticed when converting this over to the DAG->DAG
selector.  Also, there is no difference between addSImm and addImm, so just
use addImm, folding some branches.

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

18 years agoRemoved UINT_TO_FP and SINT_TO_FP from ISel outright.
Jim Laskey [Wed, 17 Aug 2005 01:14:38 +0000 (01:14 +0000)]
Removed UINT_TO_FP and SINT_TO_FP from ISel outright.

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

18 years agothinko. Should fix s4addl.ll regression
Andrew Lenharth [Wed, 17 Aug 2005 00:47:24 +0000 (00:47 +0000)]
thinko.  Should fix s4addl.ll regression

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

18 years agoRemove ISel code generation for UINT_TO_FP and SINT_TO_FP. Now asserts if
Jim Laskey [Wed, 17 Aug 2005 00:41:40 +0000 (00:41 +0000)]
Remove ISel code generation for UINT_TO_FP and SINT_TO_FP.  Now asserts if
marked as legal.

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

18 years agoMake UINT_TO_FP and SINT_TO_FP use generic expansion.
Jim Laskey [Wed, 17 Aug 2005 00:40:22 +0000 (00:40 +0000)]
Make UINT_TO_FP and SINT_TO_FP use generic expansion.

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

18 years agoAdded generic code expansion for [signed|unsigned] i32 to [f32|f64] casts in the
Jim Laskey [Wed, 17 Aug 2005 00:39:29 +0000 (00:39 +0000)]
Added generic code expansion for [signed|unsigned] i32 to [f32|f64] casts in the
legalizer.  PowerPC now uses this expansion instead of ISel version.

Example:

// signed integer to double conversion
double f1(signed x) {
  return (double)x;
}

// unsigned integer to double conversion
double f2(unsigned x) {
  return (double)x;
}

// signed integer to float conversion
float f3(signed x) {
  return (float)x;
}

// unsigned integer to float conversion
float f4(unsigned x) {
  return (float)x;
}

Byte Code:

internal fastcc double %_Z2f1i(int %x) {
entry:
        %tmp.1 = cast int %x to double          ; <double> [#uses=1]
        ret double %tmp.1
}

internal fastcc double %_Z2f2j(uint %x) {
entry:
        %tmp.1 = cast uint %x to double         ; <double> [#uses=1]
        ret double %tmp.1
}

internal fastcc float %_Z2f3i(int %x) {
entry:
        %tmp.1 = cast int %x to float           ; <float> [#uses=1]
        ret float %tmp.1
}

internal fastcc float %_Z2f4j(uint %x) {
entry:
        %tmp.1 = cast uint %x to float          ; <float> [#uses=1]
        ret float %tmp.1
}

internal fastcc double %_Z2g1i(int %x) {
entry:
        %buffer = alloca [2 x uint]             ; <[2 x uint]*> [#uses=3]
        %tmp.0 = getelementptr [2 x uint]* %buffer, int 0, int 0                ; <uint*> [#uses=1]
        store uint 1127219200, uint* %tmp.0
        %tmp.2 = cast int %x to uint            ; <uint> [#uses=1]
        %tmp.3 = xor uint %tmp.2, 2147483648            ; <uint> [#uses=1]
        %tmp.5 = getelementptr [2 x uint]* %buffer, int 0, int 1                ; <uint*> [#uses=1]
        store uint %tmp.3, uint* %tmp.5
        %tmp.9 = cast [2 x uint]* %buffer to double*            ; <double*> [#uses=1]
        %tmp.10 = load double* %tmp.9           ; <double> [#uses=1]
        %tmp.13 = load double* cast (long* %signed_bias to double*)             ; <double> [#uses=1]
        %tmp.14 = sub double %tmp.10, %tmp.13           ; <double> [#uses=1]
        ret double %tmp.14
}

internal fastcc double %_Z2g2j(uint %x) {
entry:
        %buffer = alloca [2 x uint]             ; <[2 x uint]*> [#uses=3]
        %tmp.0 = getelementptr [2 x uint]* %buffer, int 0, int 0                ; <uint*> [#uses=1]
        store uint 1127219200, uint* %tmp.0
        %tmp.1 = getelementptr [2 x uint]* %buffer, int 0, int 1                ; <uint*> [#uses=1]
        store uint %x, uint* %tmp.1
        %tmp.4 = cast [2 x uint]* %buffer to double*            ; <double*> [#uses=1]
        %tmp.5 = load double* %tmp.4            ; <double> [#uses=1]
        %tmp.8 = load double* cast (long* %unsigned_bias to double*)            ; <double> [#uses=1]
        %tmp.9 = sub double %tmp.5, %tmp.8              ; <double> [#uses=1]
        ret double %tmp.9
}

internal fastcc float %_Z2g3i(int %x) {
entry:
        %buffer = alloca [2 x uint]             ; <[2 x uint]*> [#uses=3]
        %tmp.0 = getelementptr [2 x uint]* %buffer, int 0, int 0                ; <uint*> [#uses=1]
        store uint 1127219200, uint* %tmp.0
        %tmp.2 = cast int %x to uint            ; <uint> [#uses=1]
        %tmp.3 = xor uint %tmp.2, 2147483648            ; <uint> [#uses=1]
        %tmp.5 = getelementptr [2 x uint]* %buffer, int 0, int 1                ; <uint*> [#uses=1]
        store uint %tmp.3, uint* %tmp.5
        %tmp.9 = cast [2 x uint]* %buffer to double*            ; <double*> [#uses=1]
        %tmp.10 = load double* %tmp.9           ; <double> [#uses=1]
        %tmp.13 = load double* cast (long* %signed_bias to double*)             ; <double> [#uses=1]
        %tmp.14 = sub double %tmp.10, %tmp.13           ; <double> [#uses=1]
        %tmp.16 = cast double %tmp.14 to float          ; <float> [#uses=1]
        ret float %tmp.16
}

internal fastcc float %_Z2g4j(uint %x) {
entry:
        %buffer = alloca [2 x uint]             ; <[2 x uint]*> [#uses=3]
        %tmp.0 = getelementptr [2 x uint]* %buffer, int 0, int 0                ; <uint*> [#uses=1]
        store uint 1127219200, uint* %tmp.0
        %tmp.1 = getelementptr [2 x uint]* %buffer, int 0, int 1                ; <uint*> [#uses=1]
        store uint %x, uint* %tmp.1
        %tmp.4 = cast [2 x uint]* %buffer to double*            ; <double*> [#uses=1]
        %tmp.5 = load double* %tmp.4            ; <double> [#uses=1]
        %tmp.8 = load double* cast (long* %unsigned_bias to double*)            ; <double> [#uses=1]
        %tmp.9 = sub double %tmp.5, %tmp.8              ; <double> [#uses=1]
        %tmp.11 = cast double %tmp.9 to float           ; <float> [#uses=1]
        ret float %tmp.11
}

PowerPC Code:

        .machine ppc970

        .const
        .align  2
.CPIl1__Z2f1i_0:                                        ; float 0x4330000080000000
        .long   1501560836      ; float 4.5036e+15
        .text
        .align  2
        .globl  l1__Z2f1i
l1__Z2f1i:
.LBBl1__Z2f1i_0:        ; entry
        xoris r2, r3, 32768
        stw r2, -4(r1)
        lis r2, 17200
        stw r2, -8(r1)
        lfd f0, -8(r1)
        lis r2, ha16(.CPIl1__Z2f1i_0)
        lfs f1, lo16(.CPIl1__Z2f1i_0)(r2)
        fsub f1, f0, f1
        blr

        .const
        .align  2
.CPIl2__Z2f2j_0:                                        ; float 0x4330000000000000
        .long   1501560832      ; float 4.5036e+15
        .text
        .align  2
        .globl  l2__Z2f2j
l2__Z2f2j:
.LBBl2__Z2f2j_0:        ; entry
        stw r3, -4(r1)
        lis r2, 17200
        stw r2, -8(r1)
        lfd f0, -8(r1)
        lis r2, ha16(.CPIl2__Z2f2j_0)
        lfs f1, lo16(.CPIl2__Z2f2j_0)(r2)
        fsub f1, f0, f1
        blr

        .const
        .align  2
.CPIl3__Z2f3i_0:                                        ; float 0x4330000080000000
        .long   1501560836      ; float 4.5036e+15
        .text
        .align  2
        .globl  l3__Z2f3i
l3__Z2f3i:
.LBBl3__Z2f3i_0:        ; entry
        xoris r2, r3, 32768
        stw r2, -4(r1)
        lis r2, 17200
        stw r2, -8(r1)
        lfd f0, -8(r1)
        lis r2, ha16(.CPIl3__Z2f3i_0)
        lfs f1, lo16(.CPIl3__Z2f3i_0)(r2)
        fsub f0, f0, f1
        frsp f1, f0
        blr

        .const
        .align  2
.CPIl4__Z2f4j_0:                                        ; float 0x4330000000000000
        .long   1501560832      ; float 4.5036e+15
        .text
        .align  2
        .globl  l4__Z2f4j
l4__Z2f4j:
.LBBl4__Z2f4j_0:        ; entry
        stw r3, -4(r1)
        lis r2, 17200
        stw r2, -8(r1)
        lfd f0, -8(r1)
        lis r2, ha16(.CPIl4__Z2f4j_0)
        lfs f1, lo16(.CPIl4__Z2f4j_0)(r2)
        fsub f0, f0, f1
        frsp f1, f0
        blr

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

18 years agoadd a new TargetConstant node
Chris Lattner [Wed, 17 Aug 2005 00:34:06 +0000 (00:34 +0000)]
add a new TargetConstant node

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

18 years agoadd some helper methods, and a new TargetConstant node, which is not
Chris Lattner [Wed, 17 Aug 2005 00:33:30 +0000 (00:33 +0000)]
add some helper methods, and a new TargetConstant node, which is not
subjected to folding.

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

18 years agoImplement a couple improvements:
Nate Begeman [Wed, 17 Aug 2005 00:20:08 +0000 (00:20 +0000)]
Implement a couple improvements:
Remove dead code in ISD::Constant handling
Add support for add long, imm16

We now codegen 'long long foo(long long a) { return ++a; }'
as:
addic r4, r4, 1
addze r3, r3
blr

instead of:
li r2, 1
li r5, 0
addc r2, r4, r2
adde r3, r3, r5
blr

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

18 years agoremove a dead enum value, making a comment above correct again
Chris Lattner [Tue, 16 Aug 2005 22:04:58 +0000 (22:04 +0000)]
remove a dead enum value, making a comment above correct again

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

18 years agoThis is a dummy, it doesn't matter what the ValueType is
Chris Lattner [Tue, 16 Aug 2005 21:59:52 +0000 (21:59 +0000)]
This is a dummy, it doesn't matter what the ValueType is

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

18 years agoupdates for changes in nodes
Chris Lattner [Tue, 16 Aug 2005 21:58:15 +0000 (21:58 +0000)]
updates for changes in nodes

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

18 years agoupdate the backends to work with the new CopyFromReg/CopyToReg/ImplicitDef nodes
Chris Lattner [Tue, 16 Aug 2005 21:56:37 +0000 (21:56 +0000)]
update the backends to work with the new CopyFromReg/CopyToReg/ImplicitDef nodes

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

18 years agoEliminate the RegSDNode class, which 3 nodes (CopyFromReg/CopyToReg/ImplicitDef)
Chris Lattner [Tue, 16 Aug 2005 21:55:35 +0000 (21:55 +0000)]
Eliminate the RegSDNode class, which 3 nodes (CopyFromReg/CopyToReg/ImplicitDef)
used to tack a register number onto the node.

Instead of doing this, make a new node, RegisterSDNode, which is a leaf
containing a register number.  These three operations just become normal
DAG nodes now, instead of requiring special handling.

Note that with this change, it is no longer correct to make illegal
CopyFromReg/CopyToReg nodes.  The legalizer will not touch them, and this
is bad, so don't do it. :)

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

18 years agoImplement BR_CC and BRTWOWAY_CC. This allows the removal of a rather nasty
Nate Begeman [Tue, 16 Aug 2005 19:49:35 +0000 (19:49 +0000)]
Implement BR_CC and BRTWOWAY_CC.  This allows the removal of a rather nasty
fixme from the PowerPC backend.  Emit slightly better code for legalizing
select_cc.

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

18 years agoAllow passing a dag into dump and getOperationName. If one is available
Chris Lattner [Tue, 16 Aug 2005 18:33:07 +0000 (18:33 +0000)]
Allow passing a dag into dump and getOperationName.  If one is available
when printing a node, use it to render target operations with their
target instruction name instead of "<<unknown>>".

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

18 years agoallow passing a dag into getOperationName and dump
Chris Lattner [Tue, 16 Aug 2005 18:32:18 +0000 (18:32 +0000)]
allow passing a dag into getOperationName and dump

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

18 years agoUse a extant helper to do this.
Chris Lattner [Tue, 16 Aug 2005 18:31:23 +0000 (18:31 +0000)]
Use a extant helper to do this.

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

18 years agoAdd some methods for dag->dag isel.
Chris Lattner [Tue, 16 Aug 2005 18:17:10 +0000 (18:17 +0000)]
Add some methods for dag->dag isel.
Split RemoveNodeFromCSEMaps out of DeleteNodesIfDead to do it.

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

18 years agoadd some methods for dag->dag isel
Chris Lattner [Tue, 16 Aug 2005 18:16:24 +0000 (18:16 +0000)]
add some methods for dag->dag isel

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

18 years agoPull the LLVM -> DAG lowering code out of the pattern selector so that it
Chris Lattner [Tue, 16 Aug 2005 17:14:42 +0000 (17:14 +0000)]
Pull the LLVM -> DAG lowering code out of the pattern selector so that it
can be shared with the DAG->DAG selector.

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

18 years agoFix a bad case in gzip where we put lots of things in registers across the
Chris Lattner [Tue, 16 Aug 2005 00:38:11 +0000 (00:38 +0000)]
Fix a bad case in gzip where we put lots of things in registers across the
loop, because a IV-dependent value was used outside of the loop and didn't
have immediate-folding capability

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

18 years agoFix Transforms/LoopStrengthReduce/2005-08-15-AddRecIV.ll
Chris Lattner [Tue, 16 Aug 2005 00:37:01 +0000 (00:37 +0000)]
Fix Transforms/LoopStrengthReduce/2005-08-15-AddRecIV.ll

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

18 years agotestcase that crashes lsr, distilled from 175.vpr
Chris Lattner [Tue, 16 Aug 2005 00:36:12 +0000 (00:36 +0000)]
testcase that crashes lsr, distilled from 175.vpr

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

18 years agoTurn loop strength reduction on by default.
Chris Lattner [Mon, 15 Aug 2005 23:47:04 +0000 (23:47 +0000)]
Turn loop strength reduction on by default.
Only run createLowerConstantExpressionsPass for the simple isel.  The DAG
isel has no need for it.

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

18 years agoTeach LLVM to know how many times a loop executes when constructed with
Chris Lattner [Mon, 15 Aug 2005 23:33:51 +0000 (23:33 +0000)]
Teach LLVM to know how many times a loop executes when constructed with
a < expression, e.g.: for (i = m; i < n; ++i)

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

18 years agoBroke 80 column rule.
Jim Laskey [Mon, 15 Aug 2005 17:35:26 +0000 (17:35 +0000)]
Broke 80 column rule.

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

18 years agoChanged code gen for int to f32 to use rounding. This makes FP results
Jim Laskey [Mon, 15 Aug 2005 17:14:19 +0000 (17:14 +0000)]
Changed code gen for int to f32 to use rounding.  This makes FP results
consistent with gcc.

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

18 years agoisIntImmediate is a good Idea. Add a flavor that checks bounds while it is at it
Andrew Lenharth [Mon, 15 Aug 2005 14:31:37 +0000 (14:31 +0000)]
isIntImmediate is a good Idea.  Add a flavor that checks bounds while it is at it

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

18 years agoFix last night's PPC32 regressions by
Nate Begeman [Sun, 14 Aug 2005 18:38:32 +0000 (18:38 +0000)]
Fix last night's PPC32 regressions by
1. Not selecting the false value of a select_cc in the false arm, which
   isn't legal for nested selects.
2. Actually returning the node we created and Legalized in the FP_TO_UINT
   Expander.

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

18 years agoFix last night's X86 regressions by putting code for SSE in the if(SSE)
Nate Begeman [Sun, 14 Aug 2005 18:37:02 +0000 (18:37 +0000)]
Fix last night's X86 regressions by putting code for SSE in the if(SSE)
block.  nur.

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

18 years agoonly build .a on alpha
Andrew Lenharth [Sun, 14 Aug 2005 15:14:34 +0000 (15:14 +0000)]
only build .a on alpha

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

18 years agoFix FP_TO_UINT with Scalar SSE2 now that the legalizer can handle it. We
Nate Begeman [Sun, 14 Aug 2005 04:36:51 +0000 (04:36 +0000)]
Fix FP_TO_UINT with Scalar SSE2 now that the legalizer can handle it.  We
now generate the relatively good code sequences:
unsigned short foo(float a) { return a; }
_foo:
        movss 4(%esp), %xmm0
        cvttss2si %xmm0, %eax
        movzwl %ax, %eax
        ret

and
unsigned bar(float a) { return a; }
_bar:
        movss .CPI_bar_0, %xmm0
        movss 4(%esp), %xmm1
        movapd %xmm1, %xmm2
        subss %xmm0, %xmm2
        cvttss2si %xmm2, %eax
        xorl $-2147483648, %eax
        cvttss2si %xmm1, %ecx
        ucomiss %xmm0, %xmm1
        cmovb %ecx, %eax
        ret

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

18 years agoTeach the legalizer how to legalize FP_TO_UINT.
Nate Begeman [Sun, 14 Aug 2005 01:20:53 +0000 (01:20 +0000)]
Teach the legalizer how to legalize FP_TO_UINT.
Teach the legalizer to promote FP_TO_UINT to FP_TO_SINT if the wider
  FP_TO_UINT is also illegal.  This allows us on PPC to codegen
  unsigned short foo(float a) { return a; }

as:
_foo:
.LBB_foo_0:     ; entry
        fctiwz f0, f1
        stfd f0, -8(r1)
        lwz r2, -4(r1)
        rlwinm r3, r2, 0, 16, 31
        blr

instead of:
_foo:
.LBB_foo_0:     ; entry
        fctiwz f0, f1
        stfd f0, -8(r1)
        lwz r2, -4(r1)
        lis r3, ha16(.CPI_foo_0)
        lfs f0, lo16(.CPI_foo_0)(r3)
        fcmpu cr0, f1, f0
        blt .LBB_foo_2  ; entry
.LBB_foo_1:     ; entry
        fsubs f0, f1, f0
        fctiwz f0, f0
        stfd f0, -16(r1)
        lwz r2, -12(r1)
        xoris r2, r2, 32768
.LBB_foo_2:     ; entry
        rlwinm r3, r2, 0, 16, 31
        blr

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

18 years agoMake FP_TO_UINT Illegal. This allows us to generate significantly better
Nate Begeman [Sun, 14 Aug 2005 01:17:16 +0000 (01:17 +0000)]
Make FP_TO_UINT Illegal.  This allows us to generate significantly better
codegen for FP_TO_UINT by using the legalizer's SELECT variant.

Implement a codegen improvement for SELECT_CC, selecting the false node in
the MBB that feeds the phi node.  This allows us to codegen:
void foo(int *a, int b, int c) { int d = (a < b) ? 5 : 9; *a = d; }
as:
_foo:
        li r2, 5
        cmpw cr0, r4, r3
        bgt .LBB_foo_2  ; entry
.LBB_foo_1:     ; entry
        li r2, 9
.LBB_foo_2:     ; entry
        stw r2, 0(r3)
        blr

insted of:
_foo:
        li r2, 5
        li r5, 9
        cmpw cr0, r4, r3
        bgt .LBB_foo_2  ; entry
.LBB_foo_1:     ; entry
        or r2, r5, r5
.LBB_foo_2:     ; entry
        stw r2, 0(r3)
        blr

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

18 years agoTesting a variable before it is defined doesn't work so well. It is a fairly small...
Andrew Lenharth [Sat, 13 Aug 2005 14:58:23 +0000 (14:58 +0000)]
Testing a variable before it is defined doesn't work so well.  It is a fairly small thing, so just let everyone build the .a file

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

18 years agoOoops, don't forget to clear this. The real inner loop is now:
Chris Lattner [Sat, 13 Aug 2005 07:42:01 +0000 (07:42 +0000)]
Ooops, don't forget to clear this.  The real inner loop is now:

.LBB_foo_3:     ; no_exit.1
        lfd f2, 0(r9)
        lfd f3, 8(r9)
        fmul f4, f1, f2
        fmadd f4, f0, f3, f4
        stfd f4, 8(r9)
        fmul f3, f1, f3
        fmsub f2, f0, f2, f3
        stfd f2, 0(r9)
        addi r9, r9, 16
        addi r8, r8, 1
        cmpw cr0, r8, r4
        ble .LBB_foo_3  ; no_exit.1

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

18 years agoRecursively scan scev expressions for common subexpressions. This allows us
Chris Lattner [Sat, 13 Aug 2005 07:27:18 +0000 (07:27 +0000)]
Recursively scan scev expressions for common subexpressions.  This allows us
to handle nested loops much better, for example, by being able to tell that
these two expressions:

{( 8 + ( 16 * ( 1 +  %Tmp11 +  %Tmp12)) +  %c_),+,( 16 *  %Tmp 12)}<loopentry.1>

{(( 16 * ( 1 +  %Tmp11 +  %Tmp12)) +  %c_),+,( 16 *  %Tmp12)}<loopentry.1>

Have the following common part that can be shared:
{(( 16 * ( 1 +  %Tmp11 +  %Tmp12)) +  %c_),+,( 16 *  %Tmp12)}<loopentry.1>

This allows us to codegen an important inner loop in 168.wupwise as:

.LBB_foo_4:     ; no_exit.1
        lfd f2, 16(r9)
        fmul f3, f0, f2
        fmul f2, f1, f2
        fadd f4, f3, f2
        stfd f4, 8(r9)
        fsub f2, f3, f2
        stfd f2, 16(r9)
        addi r8, r8, 1
        addi r9, r9, 16
        cmpw cr0, r8, r4
        ble .LBB_foo_4  ; no_exit.1

instead of:

.LBB_foo_3:     ; no_exit.1
        lfdx f2, r6, r9
        add r10, r6, r9
        lfd f3, 8(r10)
        fmul f4, f1, f2
        fmadd f4, f0, f3, f4
        stfd f4, 8(r10)
        fmul f3, f1, f3
        fmsub f2, f0, f2, f3
        stfdx f2, r6, r9
        addi r9, r9, 16
        addi r8, r8, 1
        cmpw cr0, r8, r4
        ble .LBB_foo_3  ; no_exit.1

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

18 years agoRemove an unncessary argument to SimplifySelectCC and add an additional
Nate Begeman [Sat, 13 Aug 2005 06:14:17 +0000 (06:14 +0000)]
Remove an unncessary argument to SimplifySelectCC and add an additional
assert when creating a select_cc node.

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

18 years agoFix the fabs regression on x86 by abstracting the select_cc optimization
Nate Begeman [Sat, 13 Aug 2005 06:00:21 +0000 (06:00 +0000)]
Fix the fabs regression on x86 by abstracting the select_cc optimization
out into SimplifySelectCC.  This allows both ISD::SELECT and ISD::SELECT_CC
to use the same set of simplifying folds.

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

18 years agoRemove support for 64b PPC, it's been broken for a long time. It'll be
Nate Begeman [Sat, 13 Aug 2005 05:59:16 +0000 (05:59 +0000)]
Remove support for 64b PPC, it's been broken for a long time.  It'll be
back once a DAG->DAG ISel exists.

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

18 years agoFix oversized GOT problem with gcc-4 on alpha
Andrew Lenharth [Sat, 13 Aug 2005 05:09:50 +0000 (05:09 +0000)]
Fix oversized GOT problem with gcc-4 on alpha

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

18 years agoTeach SplitCriticalEdge to update LoopInfo if it is alive. This fixes
Chris Lattner [Sat, 13 Aug 2005 01:38:43 +0000 (01:38 +0000)]
Teach SplitCriticalEdge to update LoopInfo if it is alive.  This fixes
a problem in LoopStrengthReduction, where it would split critical edges
then confused itself with outdated loop information.

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

18 years agoremove dead code. The exit block list is computed on demand, thus does not
Chris Lattner [Sat, 13 Aug 2005 01:30:36 +0000 (01:30 +0000)]
remove dead code.  The exit block list is computed on demand, thus does not
need to be updated.  This code is a relic from when it did.

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

18 years agoimplement a couple of simple shift foldings.
Chris Lattner [Fri, 12 Aug 2005 23:54:58 +0000 (23:54 +0000)]
implement a couple of simple shift foldings.

e.g.  (X & 7) >> 3   -> 0

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

18 years agoFix for 2005-08-12-rlwimi-crash.ll. Make allowance for masks being shifted to
Jim Laskey [Fri, 12 Aug 2005 23:52:46 +0000 (23:52 +0000)]
Fix for 2005-08-12-rlwimi-crash.ll.  Make allowance for masks being shifted to
zero.

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

18 years agoAdded test cases to guarantee use of ORC and ANDC.
Jim Laskey [Fri, 12 Aug 2005 23:40:14 +0000 (23:40 +0000)]
Added test cases to guarantee use of ORC and ANDC.

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

18 years ago1. This changes handles the cases of (~x)&y and x&(~y) yielding ANDC, and
Jim Laskey [Fri, 12 Aug 2005 23:38:02 +0000 (23:38 +0000)]
1. This changes handles the cases of (~x)&y and x&(~y) yielding ANDC, and
   (~x)|y and x|(~y) yielding ORC.

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

18 years agotestcase that crashed the ppc backend, distilled from crafty
Chris Lattner [Fri, 12 Aug 2005 23:34:03 +0000 (23:34 +0000)]
testcase that crashed the ppc backend, distilled from crafty

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

18 years agoWhen splitting critical edges, make sure not to leave the new block in the
Chris Lattner [Fri, 12 Aug 2005 22:22:17 +0000 (22:22 +0000)]
When splitting critical edges, make sure not to leave the new block in the
middle of the loop.  This turns a critical loop in gzip into this:

.LBB_test_1:    ; loopentry
        or r27, r28, r28
        add r28, r3, r27
        lhz r28, 3(r28)
        add r26, r4, r27
        lhz r26, 3(r26)
        cmpw cr0, r28, r26
        bne .LBB_test_8 ; loopentry.loopexit_crit_edge
.LBB_test_2:    ; shortcirc_next.0
        add r28, r3, r27
        lhz r28, 5(r28)
        add r26, r4, r27
        lhz r26, 5(r26)
        cmpw cr0, r28, r26
        bne .LBB_test_7 ; shortcirc_next.0.loopexit_crit_edge
.LBB_test_3:    ; shortcirc_next.1
        add r28, r3, r27
        lhz r28, 7(r28)
        add r26, r4, r27
        lhz r26, 7(r26)
        cmpw cr0, r28, r26
        bne .LBB_test_6 ; shortcirc_next.1.loopexit_crit_edge
.LBB_test_4:    ; shortcirc_next.2
        add r28, r3, r27
        lhz r26, 9(r28)
        add r28, r4, r27
        lhz r25, 9(r28)
        addi r28, r27, 8
        cmpw cr7, r26, r25
        mfcr r26, 1
        rlwinm r26, r26, 31, 31, 31
        add r25, r8, r27
        cmpw cr7, r25, r7
        mfcr r25, 1
        rlwinm r25, r25, 29, 31, 31
        and. r26, r26, r25
        bne .LBB_test_1 ; loopentry

instead of this:

.LBB_test_1:    ; loopentry
        or r27, r28, r28
        add r28, r3, r27
        lhz r28, 3(r28)
        add r26, r4, r27
        lhz r26, 3(r26)
        cmpw cr0, r28, r26
        beq .LBB_test_3 ; shortcirc_next.0
.LBB_test_2:    ; loopentry.loopexit_crit_edge
        add r2, r30, r27
        add r8, r29, r27
        b .LBB_test_9   ; loopexit
.LBB_test_3:    ; shortcirc_next.0
        add r28, r3, r27
        lhz r28, 5(r28)
        add r26, r4, r27
        lhz r26, 5(r26)
        cmpw cr0, r28, r26
        beq .LBB_test_5 ; shortcirc_next.1
.LBB_test_4:    ; shortcirc_next.0.loopexit_crit_edge
        add r2, r11, r27
        add r8, r12, r27
        b .LBB_test_9   ; loopexit
.LBB_test_5:    ; shortcirc_next.1
        add r28, r3, r27
        lhz r28, 7(r28)
        add r26, r4, r27
        lhz r26, 7(r26)
        cmpw cr0, r28, r26
        beq .LBB_test_7 ; shortcirc_next.2
.LBB_test_6:    ; shortcirc_next.1.loopexit_crit_edge
        add r2, r9, r27
        add r8, r10, r27
        b .LBB_test_9   ; loopexit
.LBB_test_7:    ; shortcirc_next.2
        add r28, r3, r27
        lhz r26, 9(r28)
        add r28, r4, r27
        lhz r25, 9(r28)
        addi r28, r27, 8
        cmpw cr7, r26, r25
        mfcr r26, 1
        rlwinm r26, r26, 31, 31, 31
        add r25, r8, r27
        cmpw cr7, r25, r7
        mfcr r25, 1
        rlwinm r25, r25, 29, 31, 31
        and. r26, r26, r25
        bne .LBB_test_1 ; loopentry

Next up, improve the code for the loop.

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

18 years agoAdd a helper method
Chris Lattner [Fri, 12 Aug 2005 22:14:06 +0000 (22:14 +0000)]
Add a helper method

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

18 years agoadd a helper method
Chris Lattner [Fri, 12 Aug 2005 22:13:27 +0000 (22:13 +0000)]
add a helper method

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

18 years agoFix a FIXME: if we are inserting code for a PHI argument, split the critical
Chris Lattner [Fri, 12 Aug 2005 22:06:11 +0000 (22:06 +0000)]
Fix a FIXME: if we are inserting code for a PHI argument, split the critical
edge so that the code is not always executed for both operands.  This
prevents LSR from inserting code into loops whose exit blocks contain
PHI uses of IV expressions (which are outside of loops).  On gzip, for
example, we turn this ugly code:

.LBB_test_1:    ; loopentry
        add r27, r3, r28
        lhz r27, 3(r27)
        add r26, r4, r28
        lhz r26, 3(r26)
        add r25, r30, r28    ;; Only live if exiting the loop
        add r24, r29, r28    ;; Only live if exiting the loop
        cmpw cr0, r27, r26
        bne .LBB_test_5 ; loopexit

into this:

.LBB_test_1:    ; loopentry
        or r27, r28, r28
        add r28, r3, r27
        lhz r28, 3(r28)
        add r26, r4, r27
        lhz r26, 3(r26)
        cmpw cr0, r28, r26
        beq .LBB_test_3 ; shortcirc_next.0
.LBB_test_2:    ; loopentry.loopexit_crit_edge
        add r2, r30, r27
        add r8, r29, r27
        b .LBB_test_9   ; loopexit
.LBB_test_2:    ; shortcirc_next.0
        ...
        blt .LBB_test_1

into this:

.LBB_test_1:    ; loopentry
        or r27, r28, r28
        add r28, r3, r27
        lhz r28, 3(r28)
        add r26, r4, r27
        lhz r26, 3(r26)
        cmpw cr0, r28, r26
        beq .LBB_test_3 ; shortcirc_next.0
.LBB_test_2:    ; loopentry.loopexit_crit_edge
        add r2, r30, r27
        add r8, r29, r27
        b .LBB_t_3:    ; shortcirc_next.0
.LBB_test_3:    ; shortcirc_next.0
        ...
        blt .LBB_test_1

Next step: get the block out of the loop so that the loop is all
fall-throughs again.

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

18 years agoChange break critical edges to not remove, then insert, PHI node entries.
Chris Lattner [Fri, 12 Aug 2005 21:58:07 +0000 (21:58 +0000)]
Change break critical edges to not remove, then insert, PHI node entries.
Instead, just update the BB in-place.  This is both faster, and it prevents
split-critical-edges from shuffling the PHI argument list unneccesarily.

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

18 years agomatch gcc's use of tabs, makes diffs easier
Andrew Lenharth [Fri, 12 Aug 2005 16:14:08 +0000 (16:14 +0000)]
match gcc's use of tabs, makes diffs easier

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

18 years ago.section cleanup, patch from Nicholas Riley
Andrew Lenharth [Fri, 12 Aug 2005 16:13:43 +0000 (16:13 +0000)]
.section cleanup, patch from Nicholas Riley

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

18 years agoFirst rev of Xcode 2.1 project
Chris Lattner [Thu, 11 Aug 2005 22:19:26 +0000 (22:19 +0000)]
First rev of Xcode 2.1 project

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

18 years ago1. Added the function isOpcWithIntImmediate to simplify testing of operand with
Jim Laskey [Thu, 11 Aug 2005 21:59:23 +0000 (21:59 +0000)]
1. Added the function isOpcWithIntImmediate to simplify testing of operand with
specified opcode and an integer constant right operand.

2. Modified ISD::SHL, ISD::SRL, ISD::SRA to use rlwinm when applied after a mask.

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

18 years agoTidied up the use of dyn_cast<ConstantSDNode> by using isIntImmediate more.
Chris Lattner [Thu, 11 Aug 2005 17:56:50 +0000 (17:56 +0000)]
Tidied up the use of dyn_cast<ConstantSDNode> by using isIntImmediate more.
Patch by Jim Laskey.

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

18 years agoUse a more efficient method of creating integer and float virtual registers
Chris Lattner [Thu, 11 Aug 2005 17:15:31 +0000 (17:15 +0000)]
Use a more efficient method of creating integer and float virtual registers
(avoids an extra level of indirection in MakeReg).

  defined MakeIntReg using RegMap->createVirtualRegister(PPC32::GPRCRegisterClass)
  defined MakeFPReg using RegMap->createVirtualRegister(PPC32::FPRCRegisterClass)

  s/MakeReg(MVT::i32)/MakeIntReg/
  s/MakeReg(MVT::f64)/MakeFPReg/

Patch by Jim Laskey!

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

18 years agoAdd a select_cc optimization for recognizing abs(int). This speeds up an
Nate Begeman [Thu, 11 Aug 2005 02:18:13 +0000 (02:18 +0000)]
Add a select_cc optimization for recognizing abs(int).  This speeds up an
integer MPEG encoding loop by a factor of two.

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

18 years agoSome SELECT_CC cleanups:
Nate Begeman [Thu, 11 Aug 2005 01:12:20 +0000 (01:12 +0000)]
Some SELECT_CC cleanups:
1. move assertions for node creation to getNode()
2. legalize the values returned in ExpandOp immediately
3. Move select_cc optimizations from SELECT's getNode() to SELECT_CC's,
   allowing them to be cleaned up significantly.

This paves the way to pick up additional optimizations on SELECT_CC, such
as sum-of-absolute-differences.

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

18 years agoMake SELECT illegal on PPC32, switch to using SELECT_CC, which more closely
Nate Begeman [Wed, 10 Aug 2005 20:52:09 +0000 (20:52 +0000)]
Make SELECT illegal on PPC32, switch to using SELECT_CC, which more closely
reflects what the hardware is capable of.  This significantly simplifies
the CC handling logic throughout the ISel.

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

18 years agoAdd new node, SELECT_CC. This node is for targets that don't natively
Nate Begeman [Wed, 10 Aug 2005 20:51:12 +0000 (20:51 +0000)]
Add new node, SELECT_CC.  This node is for targets that don't natively
implement SELECT.

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

18 years agoChanges for PPC32ISelPattern.cpp
Chris Lattner [Wed, 10 Aug 2005 18:11:33 +0000 (18:11 +0000)]
Changes for PPC32ISelPattern.cpp
1. Clean up how SelectIntImmediateExpr handles use counts.
2. "Subtract from" was not clearing hi 16 bits.

Patch by Jim Laskey

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

18 years agoFix an oversight that may be causing PR617.
Chris Lattner [Wed, 10 Aug 2005 17:37:53 +0000 (17:37 +0000)]
Fix an oversight that may be causing PR617.

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

18 years agonow that we handle non-constant strides, this testcase passes
Chris Lattner [Wed, 10 Aug 2005 17:17:45 +0000 (17:17 +0000)]
now that we handle non-constant strides, this testcase passes

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

18 years agoremove some trickiness that broke yacr2 and some other programs last night
Chris Lattner [Wed, 10 Aug 2005 17:15:20 +0000 (17:15 +0000)]
remove some trickiness that broke yacr2 and some other programs last night

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