Commit Graph

75 Commits

Author SHA1 Message Date
Nate Begeman b067492535 Teach ExpandShift how to handle shifts by a constant. This allows targets
like PowerPC to codegen long shifts in many fewer instructions.

llvm-svn: 21122
2005-04-06 21:13:14 +00:00
Nate Begeman 20b7d2a36f Expand SREM and UREM for targets that claim not to have them, like PowerPC
llvm-svn: 21103
2005-04-06 00:23:54 +00:00
Nate Begeman cc00a7c42d Handle expanding arguments to ISD::TRUNCATE. This happens on PowerPC when
you have something like i16 = truncate i64.  This fixes Regression/C/casts

llvm-svn: 21073
2005-04-04 00:57:08 +00:00
Chris Lattner 4784489de2 Fix sign_extend and zero_extend of promoted value types to expanded value
types.  This occurs when casting short to long on PPC for example.

llvm-svn: 21072
2005-04-03 23:41:52 +00:00
Chris Lattner a0c72cf289 Expand fabs into fneg
llvm-svn: 21013
2005-04-02 05:26:37 +00:00
Chris Lattner 13fe99c807 Several changes mixed up here. First when legalizing a DAG with pcmarker,
dont' regen the whole dag if unneccesary.  Second, fix and ugly bug with
the _PARTS nodes that caused legalize to produce multiples of them.
Finally, implement initial support for FABS and FNEG.  Currently FNEG is
the only one to be trusted though.

llvm-svn: 21009
2005-04-02 05:00:07 +00:00
Chris Lattner 4157c417a1 fix some bugs in the implementation of SHL_PARTS and friends.
llvm-svn: 21004
2005-04-02 04:00:59 +00:00
Chris Lattner 2e5872c671 Turn expanded shift operations into (e.g.) SHL_PARTS if the target supports it.
llvm-svn: 21002
2005-04-02 03:38:53 +00:00
Chris Lattner 07f97d5f55 Fix a bug when inserting a libcall into a function with no other calls.
llvm-svn: 20999
2005-04-02 03:22:40 +00:00
Nate Begeman 69d39433c4 Fix a warning about an unhandled switch case
llvm-svn: 20994
2005-04-02 00:41:14 +00:00
Nate Begeman cda9aa7fa9 Add ISD::UNDEF node
Teach the SelectionDAG code how to expand and promote it
Have PPC32 LowerCallTo generate ISD::UNDEF for int arg regs used up by fp
  arguments, but not shadowing their value.  This allows us to do the right
  thing with both fixed and vararg floating point arguments.

llvm-svn: 20988
2005-04-01 22:34:39 +00:00
Andrew Lenharth dec53920b4 PCMarker support for DAG and Alpha
llvm-svn: 20965
2005-03-31 21:24:06 +00:00
Chris Lattner 32e08b7c06 implement legalization of build_pair for nate
llvm-svn: 20901
2005-03-28 22:03:13 +00:00
Nate Begeman f656525cb6 Change interface to LowerCallTo to take a boolean isVarArg argument.
llvm-svn: 20842
2005-03-26 01:29:23 +00:00
Chris Lattner a474313902 Fix a bug in the 'store fpimm, ptr' -> 'store intimm, ptr' handling code.
Changing 'op' here caused us to not enter the store into a map, causing
reemission of the code!!  In practice, a simple loop like this:

no_exit:                ; preds = %no_exit, %entry
        %indvar = phi uint [ %indvar.next, %no_exit ], [ 0, %entry ]            ; <uint> [#uses=3]
        %tmp.4 = getelementptr "complex long double"* %P, uint %indvar, uint 0          ; <double*> [#uses=1]
        store double 0.000000e+00, double* %tmp.4
        %indvar.next = add uint %indvar, 1              ; <uint> [#uses=2]
        %exitcond = seteq uint %indvar.next, %N         ; <bool> [#uses=1]
        br bool %exitcond, label %return, label %no_exit

was being code gen'd to:

.LBBtest_1:     # no_exit
        movl %edx, %esi
        shll $4, %esi
        movl $0, 4(%eax,%esi)
        movl $0, (%eax,%esi)
        incl %edx
        movl $0, (%eax,%esi)
        movl $0, 4(%eax,%esi)
        cmpl %ecx, %edx
        jne .LBBtest_1  # no_exit

Note that we are doing 4 32-bit stores instead of 2.  Now we generate:

.LBBtest_1:     # no_exit
        movl %edx, %esi
        incl %esi
        shll $4, %edx
        movl $0, (%eax,%edx)
        movl $0, 4(%eax,%edx)
        cmpl %ecx, %esi
        movl %esi, %edx
        jne .LBBtest_1  # no_exit

This is much happier, though it would be even better if the increment of ESI
was scheduled after the compare :-/

llvm-svn: 20265
2005-02-22 07:23:39 +00:00
Chris Lattner 0559691163 Fix a case where were incorrectly compiled cast from short to int on 64-bit
targets.

llvm-svn: 20030
2005-02-04 18:39:19 +00:00
Chris Lattner 5aa75e4ce5 Fix yet another memset issue.
llvm-svn: 19986
2005-02-02 03:44:41 +00:00
Chris Lattner 4487b2e5a6 Fix some bugs andrew noticed legalizing memset for alpha
llvm-svn: 19969
2005-02-01 18:38:28 +00:00
Chris Lattner bc7497d5f5 Alpha doesn't have a native f32 extload instruction.
llvm-svn: 19880
2005-01-28 22:58:25 +00:00
Chris Lattner bf8c1ad313 implement legalization of truncates whose results and sources need to be
truncated, e.g. (truncate:i8 something:i16) on a 32 or 64-bit RISC.

llvm-svn: 19879
2005-01-28 22:52:50 +00:00
Chris Lattner a4cfafe31a Get alpha working with memset/memcpy/memmove
llvm-svn: 19878
2005-01-28 22:29:18 +00:00
Chris Lattner eb6614d719 CopyFromReg produces two values. Make sure that we remember that both are
legalized, and actually return the correct result when we legalize the chain first.

llvm-svn: 19866
2005-01-28 06:27:38 +00:00
Chris Lattner 0dfd7d3a0d Silence optimized warnings.
llvm-svn: 19797
2005-01-23 23:19:44 +00:00
Chris Lattner 4add7e356f Adjust to changes in SelectionDAG interfaces
The first half of correct chain insertion for libcalls. This is not enough
to fix Fhourstones yet though.

llvm-svn: 19781
2005-01-23 04:42:50 +00:00
Chris Lattner ec2183713c Fix problems with non-x86 targets.
llvm-svn: 19738
2005-01-22 00:31:52 +00:00
Chris Lattner aac464e6c0 Refactor libcall code a bit. Initial implementation of expanding int -> FP
operations for 64-bit integers.

llvm-svn: 19724
2005-01-21 06:05:23 +00:00
Chris Lattner 4d25c04f94 Simplify the shift-expansion code.
llvm-svn: 19721
2005-01-20 20:29:23 +00:00
Chris Lattner b3f83b28a5 Expand add/sub into ADD_PARTS/SUB_PARTS instead of a non-existant libcall.
llvm-svn: 19715
2005-01-20 18:52:28 +00:00
Chris Lattner 3d95c14d94 Add support for targets that pass args in registers to calls.
llvm-svn: 19703
2005-01-19 20:24:35 +00:00
Chris Lattner 55562fa99a Fold single use token factor nodes into other token factor nodes.
llvm-svn: 19701
2005-01-19 19:10:54 +00:00
Chris Lattner 0d03eb45a8 Realize the individual pieces of an expanded copytoreg/store/load are
independent of each other.

llvm-svn: 19700
2005-01-19 18:02:17 +00:00
Chris Lattner 2a7f8a94f4 Implement a way of expanding shifts. This applies to targets that offer
select operations or to shifts that are by a constant.  This automatically
implements (with no special code) all of the special cases for shift by 32,
shift by < 32 and shift by > 32.

llvm-svn: 19679
2005-01-19 04:19:40 +00:00
Chris Lattner 42993e45b6 Zero is cheaper than sign extend.
llvm-svn: 19675
2005-01-18 21:57:59 +00:00
Chris Lattner d65c3f3118 Fix some fixmes (promoting bools for select and brcond), fix promotion
of zero and sign extends.

llvm-svn: 19671
2005-01-18 19:27:06 +00:00
Chris Lattner 9f2c4a5200 Teach legalize to promote copy(from|to)reg, instead of making the isel pass
do it.  This results in better code on X86 for floats (because if strict
precision is not required, we can elide some more expensive double -> float
conversions like the old isel did), and allows other targets to emit
CopyFromRegs that are not legal for arguments.

llvm-svn: 19668
2005-01-18 17:54:55 +00:00
Chris Lattner 2cb338d7b5 Teach legalize to promote SetCC results.
llvm-svn: 19657
2005-01-18 02:59:52 +00:00
Chris Lattner b07e2d2084 Allow setcc operations to have nonbool types.
llvm-svn: 19656
2005-01-18 02:52:03 +00:00
Chris Lattner 5c8a85e2d8 Implement legalize of call nodes.
llvm-svn: 19617
2005-01-16 19:46:48 +00:00
Chris Lattner 3c0dd46a3b Revamp supported ops. Instead of just being supported or not, we now keep
track of how to deal with it, and provide the target with a hook that they
can use to legalize arbitrary operations in arbitrary ways.

Implement custom lowering for a couple of ops, implement promotion for select
operations (which x86 needs).

llvm-svn: 19613
2005-01-16 07:29:19 +00:00
Chris Lattner 3ba56b3fe7 Implement some more missing promotions.
llvm-svn: 19606
2005-01-16 05:06:12 +00:00
Chris Lattner 73b6977700 Clarify assertion.
llvm-svn: 19597
2005-01-16 02:23:34 +00:00
Chris Lattner 87a769cbd4 Move some information into the TargetLowering object.
llvm-svn: 19583
2005-01-16 01:11:45 +00:00
Chris Lattner 71d7f6e86f legalize a bunch of operations that I missed.
llvm-svn: 19580
2005-01-16 00:38:00 +00:00
Chris Lattner 207a962c2c Fix some serious bugs in promotion.
llvm-svn: 19578
2005-01-16 00:17:42 +00:00
Chris Lattner 4d97864e92 Implement promotion of a whole bunch more operators. I think that this is
basically everything.

llvm-svn: 19576
2005-01-15 22:16:26 +00:00
Chris Lattner 99222f706c Add support for legalizing FP_ROUND_INREG, SIGN_EXTEND_INREG, and
ZERO_EXTEND_INREG for targets that don't support them.

llvm-svn: 19573
2005-01-15 07:15:18 +00:00
Chris Lattner c6c9a5b07d Add support for promoting ADD/MUL.
Add support for new SIGN_EXTEND_INREG, ZERO_EXTEND_INREG, and FP_ROUND_INREG operators.
Realize that if we do any promotions, we need to iterate SelectionDAG
construction.

llvm-svn: 19569
2005-01-15 06:18:18 +00:00
Chris Lattner 1f2c9d82fa Add intitial support for promoting some operators.
llvm-svn: 19565
2005-01-15 05:21:40 +00:00
Chris Lattner 3b8e719d1d Adjust to CopyFromReg changes, implement deletion of truncating/extending
stores/loads.

llvm-svn: 19562
2005-01-14 22:38:01 +00:00
Chris Lattner 39c6744c9f Start implementing truncating stores and extending loads.
llvm-svn: 19559
2005-01-14 22:08:15 +00:00