Commit Graph

885 Commits

Author SHA1 Message Date
Chris Lattner
13794f5d01 implement the fold for:
bool %test(int %X, int %Y) {
        %C = setne int %X, 0
        ret bool %C
}

to:

_test:
        addic r2, r3, -1
        subfe r3, r2, r3
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23089 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 18:46:49 +00:00
Chris Lattner
52987f4f65 Changes to adjust to new ReplaceAllUsesWith syntax. Change FP_EXTEND to
just return its input, instead of emitting an explicit copy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23088 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 18:37:23 +00:00
Nate Begeman
60675f7562 Remove some code made dead by the fsel patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23085 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 17:45:06 +00:00
Chris Lattner
28b9be300c now that fsel is formed during legalization, this code is dead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23084 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 17:40:39 +00:00
Chris Lattner
0b1e4e508b implement the other half of the select_cc -> fsel lowering, which handles
when the RHS of the comparison is 0.0.  Turn this on by default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23083 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 17:36:52 +00:00
Chris Lattner
5839bf2b3b Change ConstantPoolSDNode to actually hold the Constant itself instead of
putting it into the constant pool.  This allows the isel machinery to
create constants that it will end up deciding are not needed, without them
ending up in the resultant function constant pool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23081 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 17:15:30 +00:00
Chris Lattner
95e0682a42 Fix some warnings in an optimized build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23080 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 16:38:51 +00:00
Chris Lattner
2bb06cdf27 Fix a huge annoyance: SelectNodeTo took types before the opcode unlike
every other SD API.  Fix it to take the opcode before the types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23079 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 16:36:26 +00:00
Nate Begeman
6718f11feb Fix JIT encoding of conditional branches
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23076 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 04:11:42 +00:00
Chris Lattner
e4bc9ea0a5 add initial support for converting select_cc -> fsel in the legalizer
instead of in the backend.  This currently handles fsel cases with registers,
but doesn't have the 0.0 and -0.0 optimization enabled yet.

Once this is finished, special hack for fp immediates can go away.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23075 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 00:52:45 +00:00
Nate Begeman
bb22df31d9 SUBFIC produces two results, not one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23073 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 00:34:06 +00:00
Nate Begeman
6660cd65cf Implement SHL_PARTS and SRL_PARTS
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23072 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 00:28:00 +00:00
Chris Lattner
b20c318df0 Emit the lo/hi parts in the right order :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23068 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 23:36:49 +00:00
Chris Lattner
a9317ed361 implement support for 64-bit add/sub, fix a broken assertion for 64-bit
return.  Allow the udiv breaker-upper to work with any non-zero constant
operand.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23066 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 23:21:06 +00:00
Chris Lattner
801d5f56bb simplify the add/sub_parts code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23065 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 23:19:58 +00:00
Chris Lattner
047b952e29 Finish implementing SDIV/UDIV by copying over the majik constant code from
ISelPattern


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23062 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 22:04:30 +00:00
Chris Lattner
c70b4afce2 Simplify some code. It's not clear why the UDIV expanded sequence
doesn't work for large uint constants, but we'll keep the current behavior


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23061 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 22:03:50 +00:00
Chris Lattner
957fcfbd89 Implement setcc correctly for G5 and non-G5 systems
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23060 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 21:39:42 +00:00
Chris Lattner
64906a06b3 implement setcc on the G5. We're still missing the non-g5 specific bits, but
they will come later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23059 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 20:08:18 +00:00
Nate Begeman
c8e27db5c5 Remove option to make SetCC illegal on PowerPC after long discussion with
Chris.  This will be accomplished through correctly modeling CR's and
subregs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23056 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 20:01:10 +00:00
Chris Lattner
8784a23075 Add support for sdiv by 2^k and -2^k. Producing code like:
_test:
        srawi r2, r3, 2
        addze r3, r2
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23052 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 17:50:06 +00:00
Chris Lattner
ee84f11577 fit in 80 cols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23051 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 17:49:31 +00:00
Chris Lattner
34e17052a7 Implement support for taking the address of constant pool indices, which
is used by the int -> FP code among other things.  This gets
2005-05-12-Int64ToFP past that failure, to dying on lack of support for add_parts


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23042 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 05:04:11 +00:00
Chris Lattner
2fe76e58eb Add support for FP constants, fixing UnitTests/2004-02-02-NegativeZero
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23038 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 04:47:18 +00:00
Chris Lattner
e28e40a273 Fully implement frame index, so that we can pass the address of alloca's
around to functions and stuff


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23036 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 00:45:43 +00:00
Chris Lattner
89532c7db0 implement unconditional branches, fixing UnitTests/2003-05-02-DependentPHI.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23034 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 00:29:58 +00:00
Chris Lattner
fdf8366ecc LFS/STFS load and store FP values, not integer ones. This change allows us
to codegen this: float foo() { return 1.245; }

into this:

_foo:
        lis r2, ha16(.CPI_foo_0)
        lfs f1, lo16(.CPI_foo_0)(r2)
        blr

instead of this:

_foo:
        lis r2, ha16(.CPI_foo_0)
        lfs r2, lo16(.CPI_foo_0)(r2)   <-- ouch
        or f1, r2, r2                  <-- ouch
        blr

with the dag isel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23033 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 00:26:22 +00:00
Chris Lattner
ed7956bfe4 Fix a broken assertion
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23032 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 00:19:12 +00:00
Chris Lattner
2b54400f08 Split IMPLICIT_DEF into IMPLICIT_DEF_GPR and IMPLICIT_DEF_FP, so that the
instructions take a consistent reg class.  Implement ISD::UNDEF in the dag->dag
selector to generate this, fixing UnitTests/2003-07-06-IntOverflow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23028 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 23:08:16 +00:00
Chris Lattner
fb0c964364 implement support for calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23026 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 22:45:17 +00:00
Chris Lattner
86fac6b00a Remove some dead cases.
Emit the indcall sequence as:

mtctr inreg
mr R12, inreg
btctr

If inreg and R12 aren't coallesced, this reduces the odds of having the mtctr
and btctr in the same dispatch group.  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23023 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 22:21:47 +00:00
Chris Lattner
a3c4454c5f add an idea
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23020 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 18:15:24 +00:00
Nate Begeman
6ef4949a0b Whoops, fix a thinko. All cases except SETNE are now handled by the
target independent code in SelectionDAG.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23002 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 05:06:48 +00:00
Nate Begeman
c6b0717a6c Remove unused statistic
Prefer 'neg X' to 'subfic 0, X' since neg does not set XER[CA]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23001 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 05:03:20 +00:00
Nate Begeman
4b46fc094d Add the "ppc specific" setcc-equivalent select_cc cases
Prefer 'neg X' to 'subfic 0, X' since it does not set XER[CA]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23000 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 04:59:21 +00:00
Chris Lattner
a2590c5b3e Add callseq_begin/end support
Call stil not supported yet


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22998 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 00:47:15 +00:00
Chris Lattner
424dcbdb3b add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22982 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 06:27:59 +00:00
Nate Begeman
8ca5693c51 Ack, typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22981 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 05:45:10 +00:00
Nate Begeman
a50d53e5ef Add an option to make SetCC illegal as a beta option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22979 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 05:42:36 +00:00
Nate Begeman
354df0ae6d Remove some instructions we no longer generate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22976 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 01:16:46 +00:00
Chris Lattner
1f24df6324 Remove some regs that are not used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22975 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 22:32:13 +00:00
Chris Lattner
9dc4d3cbac Nate noticed that 30% of the malloc/frees in llc come from calls to LowercaseString
in the asmprinter.  This changes the .td files to use lower case register names,
avoiding the need to do this call.  This speeds up the asmprinter from 1.52s
to 1.06s on kc++ in a release build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22974 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 22:00:02 +00:00
Chris Lattner
f7f2255505 Implement stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22963 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 01:27:59 +00:00
Chris Lattner
ddf3e7dfd7 Fix compilation of:
float %test2(float* %P) {
        %Q = load float* %P
        %R = add float %Q, %Q
        ret float %R
}

By returning the right result.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22961 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 00:59:14 +00:00
Chris Lattner
b30ee6a41a Make sure expressions only have one use before emitting them into a place that is conditionally executed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22960 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 00:47:28 +00:00
Chris Lattner
9944b76cfe Implement most of load support. There is still a bug though.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22959 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 22:31:09 +00:00
Chris Lattner
1db1adbdee Don't print out the MBB label for the entry mbb
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22953 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 19:09:33 +00:00
Chris Lattner
f913d3f91c Simplify the logic for BRTWOWAY_CC handling. The isel code already
simplifies BRTWOWAY into BR if one of the results is a fall-through.
Unless I'm missing something, there is no reason to duplicate this
in the target-specific code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22952 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 19:03:28 +00:00
Chris Lattner
2fbb4579d6 Implement selection for branches.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22951 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 18:50:37 +00:00
Chris Lattner
4dd4a2d278 If the false value for a select_cc is really simple (has no inputs), evaluate
it in the block.  This codegens:

int %test(bool %c) {
        %retval = select bool %c, int 17, int 1
        ret int %retval
}

as:

_test:
        rlwinm r2, r3, 0, 31, 31
        li r2, 17
        cmpwi cr0, r3, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        li r2, 1
.LBB_test_2:    ;
        or r3, r2, r2
        blr

instead of:

_test:
        rlwinm r2, r3, 0, 31, 31
        li r2, 17
        li r4, 1
        cmpwi cr0, r3, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        or r2, r4, r4
.LBB_test_2:    ;
        or r3, r2, r2
        blr

... which is one fewer instruction.  The savings are more significant for
global address and constantfp nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22946 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 17:41:11 +00:00
Chris Lattner
4416f1a0a5 add support for global address, including PIC support.
This REALLY should be lowered by the legalizer!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22941 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 22:38:53 +00:00
Chris Lattner
7e65997c43 Fix a typeo, no wonder all tokenfactor edges were the same!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22935 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 21:33:02 +00:00
Chris Lattner
ecbce617ca Split RegisterClass 'Methods' into MethodProtos and MethodBodies
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22929 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 19:13:20 +00:00
Chris Lattner
fabc8ffacb Put reg classes into namespaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22926 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 18:52:55 +00:00
Chris Lattner
0b1e641b82 Now that the simple isels are dead, so is this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22913 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 18:30:39 +00:00
Nate Begeman
27d53ba6dd Fix a bug where we were passing the wrong number of arguments to an
instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22901 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 03:42:28 +00:00
Nate Begeman
02b88a4586 ISD::OR, and it's accompanying SelectBitfieldInsert
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22889 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 00:38:14 +00:00
Nate Begeman
73bfa71524 Remove the X86 and PowerPC Simple instruction selectors; their time has
passed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22886 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 23:53:15 +00:00
Nate Begeman
c15ed447f4 Add shifts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22884 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 23:38:00 +00:00
Chris Lattner
45fcb8f410 Fix operand numbers by marking variable arity nodes as such and by fixing
the operand lists of a few other nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22883 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 23:25:33 +00:00
Chris Lattner
3f852b45fc MFLR doesn't take an operand, the LR register is implicit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22882 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 23:24:50 +00:00
Chris Lattner
0bc04231c0 Move this to the emitter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22877 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 20:08:53 +00:00
Jim Laskey
5b5f0b7fd5 More optimal solution for loading constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22870 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 18:58:23 +00:00
Chris Lattner
d607c12e8e After selecting the instructions for a basic block, emit the instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22869 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 18:46:06 +00:00
Chris Lattner
f5fac3b4a6 remove some unused stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22866 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 18:34:00 +00:00
Nate Begeman
58dfb08319 Fix int foo() { return 65535; } by using the top 16 bits of the constant
as the argument to LIS rather than the result of HA16(constant).

The DAG->DAG ISel was already doing the right thing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22865 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 18:14:49 +00:00
Nate Begeman
a694047813 Improve ISD::Constant codegen.
Now for int foo() { return -1; } we generate:
_foo:
        li r3, -1
        blr

instead of
_foo:
        lis r2, -1
        ori r3, r2, 65535
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22864 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 18:01:39 +00:00
Chris Lattner
0c09a411e0 replace switch stmt with an assert, generate li 0 instead of lis 0 for 0,
to make the code follow people's expectations better.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22861 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 17:16:52 +00:00
Jim Laskey
3285aadce9 Handle loading of 0x????0000 constants with a single instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22858 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 15:52:30 +00:00
Nate Begeman
cffc32b6e2 Add support for ISD::AND, and its various optimized forms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22857 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 07:30:46 +00:00
Nate Begeman
131a880520 Maintain consistency in negating things
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22855 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 05:44:50 +00:00
Nate Begeman
0f3257a330 Implement XOR, remove a broken sign_extend_inreg case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22854 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 05:00:13 +00:00
Nate Begeman
305a1c75cf Add a bunch more simple nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22851 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 03:04:18 +00:00
Nate Begeman
6a7d61179c 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
2005-08-18 00:53:47 +00:00
Nate Begeman
b5a0668d43 Be fruitful and multiply!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22849 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 00:21:41 +00:00
Jim Laskey
b454cfd453 Better version of isIntImmediate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22848 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 00:15:15 +00:00
Nate Begeman
26653500bb 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
2005-08-17 23:46:35 +00:00
Chris Lattner
8482dd894d 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
2005-08-17 19:33:30 +00:00
Chris Lattner
a5a91b1026 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
2005-08-17 19:33:03 +00:00
Chris Lattner
d1c4626e14 add prototype, remove dead proto
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22835 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-17 19:32:03 +00:00
Chris Lattner
6d9aed4f8f 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
2005-08-17 01:25:14 +00:00
Jim Laskey
a033b4d8eb 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
2005-08-17 01:14:38 +00:00
Jim Laskey
361ca5c927 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
2005-08-17 00:41:40 +00:00
Jim Laskey
ad23c9d4f2 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
2005-08-17 00:40:22 +00:00
Nate Begeman
456f1e890c 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
2005-08-17 00:20:08 +00:00
Chris Lattner
a8cd01524f updates for changes in nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22808 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-16 21:58:15 +00:00
Nate Begeman
7cbd525ba8 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
2005-08-16 19:49:35 +00:00
Chris Lattner
7c5a3d390a 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
2005-08-16 17:14:42 +00:00
Chris Lattner
b0096bd19d 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
2005-08-15 23:47:04 +00:00
Jim Laskey
ea0617a023 Broke 80 column rule.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22792 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-15 17:35:26 +00:00
Jim Laskey
30679e691d 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
2005-08-15 17:14:19 +00:00
Nate Begeman
2d56e72f09 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
2005-08-14 18:38:32 +00:00
Nate Begeman
5a01481585 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
2005-08-14 01:17:16 +00:00
Nate Begeman
8f331325a2 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
2005-08-13 05:59:16 +00:00
Jim Laskey
cf083e312c 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
2005-08-12 23:52:46 +00:00
Jim Laskey
847c3a976b 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
2005-08-12 23:38:02 +00:00
Jim Laskey
191cf943e6 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
2005-08-11 21:59:23 +00:00
Chris Lattner
2b48bc6f95 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
2005-08-11 17:56:50 +00:00
Chris Lattner
54abfc5ee4 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
2005-08-11 17:15:31 +00:00
Nate Begeman
c24d484b78 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
2005-08-10 20:52:09 +00:00
Chris Lattner
b4138c475e 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
2005-08-10 18:11:33 +00:00
Chris Lattner
df706e3f0c Changed the XOR case to use the isOprNot predicate.
Patch by Jim Laskey!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22750 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 16:35:46 +00:00
Chris Lattner
0d7d99fd44 1. Refactored handling of integer immediate values for add, or, xor and sub.
New routine: ISel::SelectIntImmediateExpr
  2. Now checking use counts of large constants.  If use count is > 2 then drop
  thru so that the constant gets loaded into a register.
  Source:

int %test1(int %a) {
entry:
       %tmp.1 = add int %a,      123456789      ; <int> [#uses=1]
       %tmp.2 = or  int %tmp.1,  123456789      ; <int> [#uses=1]
       %tmp.3 = xor int %tmp.2,  123456789      ; <int> [#uses=1]
       %tmp.4 = sub int %tmp.3, -123456789      ; <int> [#uses=1]
       ret int %tmp.4
}

Did Emit:

       .machine ppc970


       .text
       .align  2
       .globl  _test1
_test1:
.LBB_test1_0:   ; entry
       addi r2, r3, -13035
       addis r2, r2, 1884
       ori r2, r2, 52501
       oris r2, r2, 1883
       xori r2, r2, 52501
       xoris r2, r2, 1883
       addi r2, r2, 52501
       addis r3, r2, 1883
       blr


Now Emits:

       .machine ppc970


       .text
       .align  2
       .globl  _test1
_test1:
.LBB_test1_0:   ; entry
       lis r2, 1883
       ori r2, r2, 52501
       add r3, r3, r2
       or r3, r3, r2
       xor r3, r3, r2
       add r3, r3, r2
       blr

Patch by Jim Laskey!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22749 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 16:34:52 +00:00
Chris Lattner
979a21e766 Fix a bug compiling: select (i32 < i32), f32, f32
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22747 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 03:40:09 +00:00
Chris Lattner
c7e18a10d4 add a optimization note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22732 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 22:30:57 +00:00
Chris Lattner
88ac32ca26 Update the targets to the new SETCC/CondCodeSDNode interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22729 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 20:21:10 +00:00
Chris Lattner
59b21c25d4 Minor cleanup patch, no functionality changes. Written by Jim Laskey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22727 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 18:29:55 +00:00
Chris Lattner
2f46055cc2 Fix CodeGen/Generic/div-neg-power-2.ll, a regression from last night.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22726 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 18:08:41 +00:00
Nate Begeman
d3ded2d8a7 Factor out some common code, and be smarter about when to emit load hi/lo
code sequences.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22719 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 22:22:56 +00:00
Chris Lattner
0045776d33 Remove getImmediateForOpcode, which is now dead.
Patch by Jim Laskey.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22716 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:34:13 +00:00
Chris Lattner
fd78454477 Add new immediate handling support for mul/div.
Patch by Jim Laskey!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22715 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:33:23 +00:00
Chris Lattner
5b90917400 Add support for OR/XOR/SUB immediates that are handled with the new immediate
way.  This allows ORI/ORIS pairs, for example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22714 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:30:29 +00:00
Chris Lattner
2f57c4da21 Modify the ISD::AND opcode case to use new immediate constant predicates.
Includes wider support for rotate and mask cases.

Patch by Jim Laskey.

I've requested that Jim add new regression tests the newly handled cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22712 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:24:57 +00:00
Chris Lattner
39c6896d22 Modify the ISD::ADD opcode case to use new immediate constant predicates.
Includes support for 32-bit constants using addi/addis.

Patch by Jim Laskey.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22711 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:21:03 +00:00
Chris Lattner
8fd1980ce6 Modify existing support functions to use new immediate constant predicates.
Patch by Jim Laskey


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22710 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:12:35 +00:00
Chris Lattner
cf1cf1886e Add support predicates for future immediate constant changes.
Patch by Jim Laskey


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22709 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:10:27 +00:00
Chris Lattner
02efa6c140 Move IsRunOfOnes to a more logical place and rename to a proper predicate form
(lowercase isXXX).

Patch by Jim Laskey.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22708 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 21:08:09 +00:00
Nate Begeman
394cd13ba3 Fix JIT encoding of ppc mfocrf instruction; the operands were reversed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22707 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 20:04:52 +00:00
Chris Lattner
3c304a3ba1 Consolidate the GPOpt stuff to all use the Subtarget, instead of still
depending on the command line option.  Now the command line option just
sets the subtarget as appropriate.  G5 opts will now default to on on
G5-enabled nightly testers among other machines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22688 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 22:05:03 +00:00
Chris Lattner
ba25365140 Enable gp optimizations by default when available, even when a target triple
is available, since the target triple doesn't specify whether to use gpopts
or not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22685 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 21:25:13 +00:00
Chris Lattner
6281ae4bf0 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22681 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 19:18:32 +00:00
Chris Lattner
4e624ecd07 don't crash when running the PPC backend on non-ppc hosts without specifying
a subtarget.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22677 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 16:17:22 +00:00
Nate Begeman
99558806f8 Hack to naturally align doubles in the constant pool. Remove this once we
know what The Right Thing To Do is.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22660 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 21:04:09 +00:00
Nate Begeman
3d72d14887 Use the new subtarget support to automatically choose the correct ABI
and asm printer for PowerPC if one is not specified.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22659 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 20:49:48 +00:00
Nate Begeman
8c00f8cdc7 Add Subtarget support to PowerPC. Next up, using it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22644 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 07:12:09 +00:00
Misha Brukman
0a3f677f09 Fix grammar: apostrophe-s ('s) is possessive, not plural; also iff vs. if.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22619 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 17:29:52 +00:00
Chris Lattner
a34cbcc50a minor capitalization thing, patch by Jim Laskey
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22617 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 16:52:22 +00:00
Chris Lattner
c0d590b6f2 This hunk accidentally got dropped. Patch by Jim Laskey
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22595 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 19:30:55 +00:00
Chris Lattner
0561b3ff9f Update to use the new MathExtras.h support for log2 computation.
Patch contributed by Jim Laskey!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22594 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 19:26:06 +00:00
Chris Lattner
3f270130b5 add a pass name to make debugging dumps nicer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22588 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 19:07:49 +00:00
Jeff Cohen
d29b6aa608 Keep tabs and trailing spaces out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22565 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-30 18:33:25 +00:00
Andrew Lenharth
422f3d58a8 turn off GOT on archs that didn't use it (not that it appeard to harm them much with it on)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22553 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-29 23:32:02 +00:00
Chris Lattner
988b1dd608 Eliminate an extra copy from R1 that Nate noticed on function calls that
have to write arguments to the stack


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22536 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-28 05:23:43 +00:00
Chris Lattner
4015ea8711 Specify the correct number of operands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22535 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-28 04:42:11 +00:00
Nate Begeman
2a05c8e260 Fold constant adds into loads and stores to frame indices.
For the following code:
double %ext(int %A.0__, long %A.1__) {
        %A_addr = alloca %typedef.DComplex              ; <%typedef.DComplex*> [#uses=2]
        %tmp.1 = cast %typedef.DComplex* %A_addr to int*                ; <int*> [#uses=1]
        store int %A.0__, int* %tmp.1
        %tmp.2 = getelementptr %typedef.DComplex* %A_addr, int 0, uint 1                ; <double*> [#uses=2]
        %tmp.3 = cast double* %tmp.2 to long*           ; <long*> [#uses=1]
        store long %A.1__, long* %tmp.3
        %tmp.5 = load double* %tmp.2            ; <double> [#uses=1]
        ret double %tmp.5
}

We now generate:
_ext:
.LBB_ext_0:     ;
        stw r3, -12(r1)
        stw r4, -8(r1)
        stw r5, -4(r1)
        lfd f1, -8(r1)
        blr

Instead of:
_ext:
.LBB_ext_0:     ;
        stw r3, -12(r1)
        addi r2, r1, -12
        stw r4, 4(r2)
        stw r5, 8(r2)
        lfd f1, 4(r2)
        blr

This also fires hundreds of times on MultiSource.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22533 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-28 03:02:05 +00:00
Nate Begeman
3dee17581c Fix some comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22530 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 23:11:27 +00:00
Jeff Cohen
00b16889ab Eliminate all remaining tabs and trailing spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22523 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 06:12:32 +00:00
Nate Begeman
54eed36da5 Implement the optimization for the Red Zone on Darwin. This removes the
unnecessary SP manipulation in leaf routines that don't need it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22522 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 06:06:29 +00:00
Jeff Cohen
9eb59ec548 Eliminate tabs and trailing spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22520 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 05:53:44 +00:00
Chris Lattner
b65975a6ed add a note about the red zone
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22518 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-26 19:07:51 +00:00
Chris Lattner
2e00d7d0ae Wrap some long lines, fix emission of weak global variables
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22517 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-26 19:03:27 +00:00
Nate Begeman
4ad870ddcc Update the PPC readme
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22516 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-26 18:59:06 +00:00
Nate Begeman
7b4f0a81ff Fix an optimization put in for accessing static globals. This obviates
the need to build PIC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22512 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-25 21:15:28 +00:00
Chris Lattner
aa68f7fa09 PowerPC no-pic code is not quite ready for prime-time
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22507 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-22 22:58:34 +00:00
Andrew Lenharth
908bc862d5 update interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22498 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-22 20:49:37 +00:00
Nate Begeman
2497e6391f Support building non-PIC
Remove the LoadHiAddr pseudo-instruction.
Optimization of stores to and loads from statics.
Force JIT to use new non-PIC codepaths.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22494 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-21 20:44:43 +00:00
Chris Lattner
2130c08930 revert to using 4-byte alignment for doubles, as specified by the ABI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22493 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-21 19:17:18 +00:00
Nate Begeman
18ed029a7b Support assembling fsqrt on darwin. This will be implemented better when
PowerPC gets subtarget support up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22489 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-21 01:25:49 +00:00
Nate Begeman
adeb43ddf4 Generate mfocrf when targeting g5. Generate fsqrt/fsqrts when targetin g5.
8-byte align doubles.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22486 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-20 22:42:00 +00:00
Nate Begeman
a3fd400fa8 Integrate SelectFPExpr into SelectExpr. This gets PPC32 closer to being
automatically generated from a target description.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22470 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-19 16:51:05 +00:00
Nate Begeman
63b3f9acae Remove some code that moved to the generic asm printer a long time ago.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22407 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 18:34:15 +00:00
Chris Lattner
bce81ae51e Change *EXTLOAD to use an VTSDNode operand instead of being an MVTSDNode.
This is the last MVTSDNode.

This allows us to eliminate a bunch of special case code for handling
MVTSDNodes.

Also, remove some uses of dyn_cast that should really be cast (which is
cheaper in a release build).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22368 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-10 01:56:13 +00:00
Chris Lattner
9fadb4c1c0 Change TRUNCSTORE to use a VTSDNode operand instead of being an MVTSTDNode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22366 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-10 00:29:18 +00:00
Nate Begeman
72b286b0a0 Add support for assembling .s files on mac os x for intel
Add support for running bugpoint on mac os x for intel


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22351 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 00:23:26 +00:00
Chris Lattner
e0fe225e89 Make several cleanups to Andrews varargs change:
1. Pass Value*'s into lowering methods so that the proper pointers can be
   added to load/stores from the valist
2. Intrinsics that return void should only return a token chain, not a token
   chain/retval pair.
3. Rename LowerVAArgNext -> LowerVAArg, because VANext is long gone.
4. Now that we have Value*'s available in the lowering methods, pass them
   into any load/stores from the valist that are emitted


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22339 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-05 19:58:54 +00:00
Chris Lattner
f84a2ace5e Fix PowerPC varargs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22335 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-05 17:48:31 +00:00
Chris Lattner
c1671e2d7d Varargs is apparently currently broken on PPC. This hacks it so that it
is at least overloading the right virtual methods.  The implementations
are currently wrong though.  This fixes Ptrdist/bc, but not other programs
(e.g. siod).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22326 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-01 23:11:56 +00:00
Chris Lattner
0431c96cec Refactor the addPassesToEmitAssembly interface into a addPassesToEmitFile
interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22282 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-25 02:48:37 +00:00
Andrew Lenharth
213e557cef If we support structs as va_list, we must pass pointers to them to va_copy
See last commit for LangRef, this implements it on all targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22273 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-22 21:04:42 +00:00
Andrew Lenharth
558bc88a00 core changes for varargs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22254 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-18 18:34:52 +00:00
Reid Spencer
4b828e6384 Clean up some uninitialized variables and missing return statements that
GCC 4.0.0 compiler (sometimes incorrectly) warns about under release build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22249 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-18 17:37:34 +00:00
Chris Lattner
b157f858a2 silence incredibly braindead GCC 4 warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22246 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-17 13:44:07 +00:00
Nate Begeman
439009c81e Commit fix for generating conditional branch pseudo instructions that
avoids dereferencing the end() iterator when selecting the fallthrough
block.  This requires an ilist change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22212 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-15 18:22:43 +00:00
Nate Begeman
a43b176f51 Commit a small improvement that is already in the x86 and ia64 backends to
not generate unnecessary register copies.  This improves compile time by
2-5% depending on the test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22210 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-14 03:55:23 +00:00
Nate Begeman
ac609ddf82 Fix a memory smasher caught by Mac OS X's debug malloc library. We were
incorrectly using an iterator after it was invalid.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22207 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-12 23:50:33 +00:00
Reid Spencer
eae435de83 For PR572:
Undefine the PPC symbol which is defined by Linux/PPC (erroneously) so it
doesn't pollute the user namespace and clash with our namespace declarations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22202 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-08 17:44:48 +00:00
Nate Begeman
b2c4bf3ff6 Handle some more real world cases of rlwimi. These don't come up that
regularly in "normal" code, but for things like software graphics, they
make a big difference.

For the following code:
unsigned short Trans16Bit(unsigned srcA,unsigned srcB,unsigned alpha)
{
	unsigned tmpA,tmpB,mixed;
	tmpA = ((srcA & 0x03E0) << 15) | (srcA & 0x7C1F);
	tmpB = ((srcB & 0x03E0) << 15) | (srcB & 0x7C1F);
	mixed = (tmpA * alpha) + (tmpB * (32 - alpha));
	return ((mixed >> 5) & 0x7C1F) | ((mixed >> 20) & 0x03E0);
}

We now generate:
_Trans16Bit:
.LBB_Trans16Bit_0:      ; entry
        andi. r2, r4, 31775
        rlwimi r2, r4, 15, 7, 11
        subfic r4, r5, 32
        mullw r2, r2, r4
        andi. r4, r3, 31775
        rlwimi r4, r3, 15, 7, 11
        mullw r3, r4, r5
        add r2, r2, r3
        srwi r3, r2, 5
        andi. r3, r3, 31775
        rlwimi r3, r2, 12, 22, 26
        blr

Instead of:
_Trans16Bit:
.LBB_Trans16Bit_0:      ; entry
        slwi r2, r4, 15
        rlwinm r2, r2, 0, 7, 11
        andi. r4, r4, 31775
        or r2, r2, r4
        subfic r4, r5, 32
        mullw r2, r2, r4
        slwi r4, r3, 15
        rlwinm r4, r4, 0, 7, 11
        andi. r3, r3, 31775
        or r3, r4, r3
        mullw r3, r3, r5
        add r2, r2, r3
        srwi r3, r2, 5
        andi. r3, r3, 31775
        srwi r2, r2, 20
        rlwimi r3, r2, 0, 22, 26
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22201 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-08 04:14:27 +00:00
Chris Lattner
fc87928ebb PPC "branch and link" instructions are branches in the PPC sense, but not
in the LLVM code generator sense (they are calls).  Don't mark them as such,
which fixes the regressions on the ppc tester last night


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22065 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-15 20:11:44 +00:00
Chris Lattner
022ed327bd Fix andrews changes to fit in 80 columns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22064 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-15 19:54:37 +00:00
Chris Lattner
b5d8e6ece6 treat TAILCALL nodes identically to CALL nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21977 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 20:29:26 +00:00
Chris Lattner
adf6a965a3 Add an isTailCall flag to LowerCallTo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21958 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 18:50:42 +00:00
Chris Lattner
32f3cf612e Realize that we don't support fmod directly, fixing CodeGen/Generic/print-arith-fp.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21939 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 16:20:22 +00:00
Chris Lattner
16cd04d26c rename the ADJCALLSTACKDOWN/ADJCALLSTACKUP nodes to be CALLSEQ_START/BEGIN.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21915 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-12 23:24:06 +00:00
Chris Lattner
c57f682113 Pass in Calling Convention to use into LowerCallTo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21899 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-12 19:56:45 +00:00
Chris Lattner
9bce0f92c3 These targets don't like setcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21884 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-12 02:06:00 +00:00
Nate Begeman
d7c4a4a6c0 Necessary changes to codegen cttz efficiently on PowerPC
1. Teach LegalizeDAG how to better legalize CTTZ if the target doesn't have
   CTPOP, but does have CTLZ
2. Teach PPC32 how to do sub x, const -> add x, -const for valid consts
3. Teach PPC32 how to do and (xor a, -1) b -> andc b, a
4. Teach PPC32 that ISD::CTLZ -> PPC::CNTLZW


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21880 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-11 23:43:56 +00:00
Chris Lattner
cafb67b250 fold and (shl X, C1), C2 -> rlwinm when possible. Many other cases are possible,
include and (srl)    and the inverses (shl and) etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21820 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 17:39:48 +00:00
Andrew Lenharth
b5884d3116 fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21693 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-04 19:25:37 +00:00
Andrew Lenharth
691ef2ba06 Implement count leading zeros (ctlz), count trailing zeros (cttz), and count
population (ctpop).  Generic lowering is implemented, however only promotion
is implemented for SelectionDAG at the moment.

More coming soon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21676 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-03 17:19:30 +00:00
Chris Lattner
08cae7f519 Doesn't support these nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21634 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-30 04:26:56 +00:00
Chris Lattner
17234b7d78 This target doesn't support the FSIN/FCOS/FSQRT nodes yet
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21633 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-30 04:26:06 +00:00
Andrew Lenharth
2d86ea21dd Implement Value* tracking for loads and stores in the selection DAG. This enables one to use alias analysis in the backends.
(TRUNK)Stores and (EXT|ZEXT|SEXT)Loads have an extra SDOperand which is a SrcValueSDNode which contains the Value*.  Note that if the operation is introduced by the backend, it will still have the operand, but the value* will be null.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21599 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-27 20:10:01 +00:00
Misha Brukman
7847fcac17 Convert tabs to spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21452 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 17:54:37 +00:00
Misha Brukman
b5f662fa03 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21425 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 23:30:14 +00:00
Chris Lattner
837a521c48 Match another form of eqv
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21413 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 21:09:11 +00:00
Chris Lattner
f577c6122f Add completely untested support for mtcrf/mfcrf encoding
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21353 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 05:41:52 +00:00
Chris Lattner
14522e31d9 switch over the rest of the formats that use RC to use isDOT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21352 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 05:21:30 +00:00
Chris Lattner
883059fb58 Convert the XForm instrs and XSForm instruction over to use isDOT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21351 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 05:15:18 +00:00
Chris Lattner
97a2d42999 Now that the ppc64 and vmx operands of I are always 0, forward substitute
them away.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21350 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 05:05:22 +00:00
Chris Lattner
a611ab72ca convert over bform and iform instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21349 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 05:00:59 +00:00
Chris Lattner
57226fbc7b Convert over DForm and DSForm instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21348 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 04:59:28 +00:00
Chris Lattner
e19d0b1130 Convert XLForm and XForm instructions over to use PPC64 when appropriate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21347 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 04:51:30 +00:00
Chris Lattner
5035cef732 Convert XO XS and XFX forms to use isPPC64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21346 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 04:40:07 +00:00
Chris Lattner
0bdc6f1fd4 Turn PPC64 and VMX into classes that can be added to instructions instead of
bits that must be passed up the inheritance hierarchy.  Convert MForm and AForm
instructions over


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21345 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 04:32:54 +00:00
Nate Begeman
1cbf3abbb8 Next round of PPC CR optimizations. For the following code:
int %bar(float %a, float %b, float %c, float %d) {
entry:
    %tmp.1 = setlt float %a, %d
    %tmp.2 = setlt float %b, %d
    %or = or bool %tmp.1, %tmp.2
    %tmp.3 = setgt float %c, %d
    %tmp.4 = or bool %or, %tmp.3
    %tmp.5 = and bool %tmp.4, true
    %retval = cast bool %tmp.5 to int
    ret int %retval
}

We now emit:

_bar:
.LBB_bar_0:     ; entry
        fcmpu cr0, f1, f4
        fcmpu cr1, f2, f4
        cror 0, 0, 4
        fcmpu cr1, f3, f4
        cror 28, 0, 5
        mfcr r2
        rlwinm r3, r2, 29, 31, 31
        blr

Instead of:

_bar:
.LBB_bar_0:     ; entry
        fcmpu cr7, f1, f4
        mfcr r2
        rlwinm r2, r2, 29, 31, 31
        fcmpu cr7, f2, f4
        mfcr r3
        rlwinm r3, r3, 29, 31, 31
        or r2, r2, r3
        fcmpu cr7, f3, f4
        mfcr r3
        rlwinm r3, r3, 30, 31, 31
        or r3, r2, r3
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21321 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 07:48:09 +00:00
Nate Begeman
16ac709c63 Change codegen for setcc to read the bit directly out of the condition
register.  Added support in the .td file for the g5-specific variant
  of cr -> gpr moves that executes faster, but we currently don't
  generate it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21314 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 02:43:24 +00:00
Chris Lattner
477d1de9b2 Handle ExternalSymbol operands in the PPC JIT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21312 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 00:46:10 +00:00
Nate Begeman
f8b02949e3 Make pattern isel default for ppc
Add new ppc beta option related to using condition registers
Make pattern isel control flag (-enable-pattern-isel) global and tristate
  0 == off
  1 == on
  2 == target default


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21309 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-15 22:12:16 +00:00
Nate Begeman
7bfba7d5e3 Implement multi-way branches through logical ops on condition registers.
This can generate considerably shorter code, reducing the size of crafty
by almost 1%.  Also fix the printing of mcrf.  The code is currently
disabled until it gets a bit more testing, but should work as-is.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21298 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-14 09:45:08 +00:00
Nate Begeman
ef7288c824 Add the necessary support to codegen condition register logical ops with
register allocated condition registers.  Make sure that the printed
  output is gas compatible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21295 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-14 03:20:38 +00:00