Commit Graph

376 Commits

Author SHA1 Message Date
Chris Lattner
b248e16afd Add an assertion, avoid some unneeded work for each call. No functionality
change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28347 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-17 17:55:45 +00:00
Chris Lattner
f4ec817299 Add a new ISD::CALL node, make the default impl of TargetLowering::LowerCallTo
produce it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28338 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-16 22:53:20 +00:00
Chris Lattner
e2e41730cc Legalize FORMAL_ARGUMENTS nodes correctly, we don't want to legalize them once
for each argument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28313 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-16 05:49:56 +00:00
Chris Lattner
a2d079a776 Merge identical code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28274 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-13 02:11:14 +00:00
Nate Begeman
ec57fd91af Fix PR773
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28207 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 18:20:51 +00:00
Owen Anderson
a69571c799 Refactor TargetMachine, pushing handling of TargetData into the target-specific subclasses. This has one caller-visible change: getTargetData() now returns a pointer instead of a reference.
This fixes PR 759.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28074 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-03 01:29:57 +00:00
Nate Begeman
37efe67645 JumpTable support! What this represents is working asm and jit support for
x86 and ppc for 100% dense switch statements when relocations are non-PIC.
This support will be extended and enhanced in the coming days to support
PIC, and less dense forms of jump tables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27947 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-22 18:53:45 +00:00
Chris Lattner
89a1b380a4 Simplify some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27846 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-19 23:17:50 +00:00
Chris Lattner
80edfb3af5 Fix handling of calls in functions that use vectors. This fixes a crash on
the code in GCC PR26546.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27780 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-17 22:10:08 +00:00
Chris Lattner
8d5a894501 Codegen insertelement with constant insertion points as scalar_to_vector
and a shuffle.  For this:

void %test2(<4 x float>* %F, float %f) {
        %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
        %tmp3 = add <4 x float> %tmp, %tmp              ; <<4 x float>> [#uses=1]
        %tmp2 = insertelement <4 x float> %tmp3, float %f, uint 2               ; <<4 x float>> [#uses=2]
        %tmp6 = add <4 x float> %tmp2, %tmp2            ; <<4 x float>> [#uses=1]
        store <4 x float> %tmp6, <4 x float>* %F
        ret void
}

we now get this on X86 (which will get better):

_test2:
        movl 4(%esp), %eax
        movaps (%eax), %xmm0
        addps %xmm0, %xmm0
        movaps %xmm0, %xmm1
        shufps $3, %xmm1, %xmm1
        movaps %xmm0, %xmm2
        shufps $1, %xmm2, %xmm2
        unpcklps %xmm1, %xmm2
        movss 8(%esp), %xmm1
        unpcklps %xmm1, %xmm0
        unpcklps %xmm2, %xmm0
        addps %xmm0, %xmm0
        movaps %xmm0, (%eax)
        ret

instead of:

_test2:
        subl $28, %esp
        movl 32(%esp), %eax
        movaps (%eax), %xmm0
        addps %xmm0, %xmm0
        movaps %xmm0, (%esp)
        movss 36(%esp), %xmm0
        movss %xmm0, 8(%esp)
        movaps (%esp), %xmm0
        addps %xmm0, %xmm0
        movaps %xmm0, (%eax)
        addl $28, %esp
        ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27765 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-17 19:21:01 +00:00
Chris Lattner
2efce0a589 Add support for promoting stores from one legal type to another, allowing us
to write one pattern for vector stores instead of 4.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27730 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-16 01:36:45 +00:00
Chris Lattner
3824e50b1e Make this assertion better
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27695 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-14 06:08:35 +00:00
Evan Cheng
cc9876124e Promote vector AND, OR, and XOR
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27632 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-12 21:20:24 +00:00
Evan Cheng
41f6cbbeb2 Vector type promotion for ISD::LOAD and ISD::SELECT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27606 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-12 16:33:18 +00:00
Chris Lattner
fdfded5588 Implement support for the formal_arguments node. To get this, targets shouldcustom legalize it and remove their XXXTargetLowering::LowerArguments overload
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27604 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-12 16:20:43 +00:00
Evan Cheng
98f8aeb45f Only get Tmp2 for cases where number of operands is > 1. Fixed return void.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27586 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-11 06:33:39 +00:00
Chris Lattner
b49e52c7e2 add some todos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27580 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-11 02:00:08 +00:00
Chris Lattner
f87324e44d Add basic support for legalizing returns of vectors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27578 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-11 01:31:51 +00:00
Evan Cheng
db3c626eb9 Missing break
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27559 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-10 18:54:36 +00:00
Chris Lattner
b22e35a3c3 Add code generator support for VSELECT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27542 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-08 22:22:57 +00:00
Chris Lattner
17614ea63d Canonicalize vvector_shuffle(x,x) -> vvector_shuffle(x,undef) to enable patterns
to match again :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27533 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-08 05:34:25 +00:00
Chris Lattner
4ddd283f69 add a sanity check: LegalizeOp should return a value that is the same type
as its input.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27528 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-08 04:13:17 +00:00
Evan Cheng
f6bf87f2cc INSERT_VECTOR_ELT lowering bug:
store vector to $esp
  store element to $esp + sizeof(VT) * index
  load  vector from $esp
The bug is VT is the type of the vector element, not the type of the vector!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27517 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-08 01:46:37 +00:00
Evan Cheng
18dd6d0a2a Exapnd a VECTOR_SHUFFLE to a BUILD_VECTOR if target asks for it to be expanded
or custom lowering fails.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27432 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-05 06:07:11 +00:00
Chris Lattner
4352cc9e21 * Add supprot for SCALAR_TO_VECTOR operations where the input needs to be
promoted/expanded (e.g. SCALAR_TO_VECTOR from i8/i16 on PPC).
* Add support for targets to request that VECTOR_SHUFFLE nodes be promoted
  to a canonical type, for example, we only want v16i8 shuffles on PPC.
* Move isShuffleLegal out of TLI into Legalize.
* Teach isShuffleLegal to allow shuffles that need to be promoted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27399 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-04 17:23:26 +00:00
Chris Lattner
4aab2f4ab5 Implement promotion for EXTRACT_VECTOR_ELT, allowing v16i8 multiplies to work with PowerPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27349 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-02 05:06:04 +00:00
Chris Lattner
bc70cf8be9 Implement the Expand action for binary vector operations to break the binop
into elements and operate on each piece.  This allows generic vector integer
multiplies to work on PPC, though the generated code is horrible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27347 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-02 03:57:31 +00:00
Chris Lattner
5e46a19ec8 Add a new -view-legalize-dags command line option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27342 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-02 03:07:27 +00:00
Chris Lattner
c741ea424a Do not endian swap split vector loads. This fixes UnitTests/Vector/sumarray-dbl on PPC.
Now all UnitTests/Vector/* tests pass on PPC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27299 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-31 18:22:37 +00:00
Chris Lattner
d9731af75b Do not endian swap the operands to a store if the operands came from a vector.
This fixes UnitTests/Vector/simple.c with altivec.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27298 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-31 18:20:46 +00:00
Chris Lattner
1597221eac Implement PromoteOp for VEXTRACT_VECTOR_ELT. Thsi fixes
Generic/vector.ll:test_extract_elt on non-sse X86 systems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27294 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-31 17:55:51 +00:00
Chris Lattner
2ae2e98d4f Scalarized vector stores need not be legal, e.g. if the vector element type
needs to be promoted or expanded.  Relegalize the scalar store once created.
This fixes CodeGen/Generic/vector.ll:test1 on non-SSE x86 targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27293 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-31 17:37:22 +00:00
Chris Lattner
70c2a61e0a Significantly improve handling of vectors that are live across basic blocks,
handling cases where the vector elements need promotion, expansion, and when
the vector type itself needs to be decimated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27278 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-31 02:06:56 +00:00
Evan Cheng
eb0b461cf4 Expand INSERT_VECTOR_ELT to store vec, sp; store elt, sp+k; vec = load sp;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27274 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-31 01:27:51 +00:00
Chris Lattner
5b2316e2b0 Teach Legalize how to pack VVECTOR_SHUFFLE nodes into VECTOR_SHUFFLE nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27232 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-28 20:24:43 +00:00
Chris Lattner
48b61a729d Tblgen doesn't like multiple SDNode<> definitions that map to the sameenum value. Split them into separate enums.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27201 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-28 00:40:33 +00:00
Chris Lattner
13fc2f1d27 Fix legalization of intrinsics with chain and result values
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27181 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-27 20:28:29 +00:00
Chris Lattner
10d7fa62ff Allow targets to custom lower their own intrinsics if desired.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27146 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-26 09:12:51 +00:00
Evan Cheng
73d7b6029a Only to vector shuffle for {x,x,y,y} cases when SCALAR_TO_VECTOR is free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27071 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-24 18:45:20 +00:00
Chris Lattner
2eb8653157 prefer to generate constant pool loads over splats. This prevents us from
using a splat for {1.0,1.0,1.0,1.0}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27055 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-24 07:29:17 +00:00
Chris Lattner
d1f04d40a0 legalize vbit_convert nodes whose result is a legal type.
Legalize intrinsic nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27036 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-24 02:26:29 +00:00
Evan Cheng
033e681666 Lower BUILD_VECTOR to VECTOR_SHUFFLE if there are two distinct nodes (and if
the target can handle it). Issue two SCALAR_TO_VECTOR ops followed by a
VECTOR_SHUFFLE to select from the two vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27023 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-24 01:17:21 +00:00
Chris Lattner
7692eb4201 add support for splitting casts. This implements
CodeGen/Generic/vector.ll:test_cast_2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26999 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-23 21:16:34 +00:00
Chris Lattner
408c428096 simplify some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26972 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-23 05:29:04 +00:00
Chris Lattner
e25ca692c0 Implement simple support for vector casting. This can currently only handle
casts between legal vector types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26961 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-22 20:09:35 +00:00
Chris Lattner
841c882f5d Endianness does not affect the order of vector fields. This fixes
SingleSource/UnitTests/Vector/build.c


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26936 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-22 01:46:54 +00:00
Chris Lattner
3b9fa89fca Enclose some variables in a scope to avoid error with some gcc versions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26934 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-22 00:12:37 +00:00
Chris Lattner
e35c218f3e add expand support for extractelement
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26931 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-21 21:02:03 +00:00
Chris Lattner
384504cea6 add some trivial support for extractelement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26928 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-21 20:44:12 +00:00
Chris Lattner
1c6191ffe7 Add a hacky workaround for crashes due to vectors live across blocks.
Note that this code won't work for vectors that aren't legal on the
target.  Improvements coming.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26925 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-21 19:20:37 +00:00