Commit Graph

24212 Commits

Author SHA1 Message Date
Chris Lattner 6df094b4ab Move some knowledge about registers out of the code emitter into the register info.
llvm-svn: 27770
2006-04-17 21:07:20 +00:00
Chris Lattner 0f28d48da2 Use a small table instead of macros to do this conversion.
llvm-svn: 27769
2006-04-17 20:59:25 +00:00
Evan Cheng 5022b3426e Implement v8i16, v16i8 splat using unpckl + pshufd.
llvm-svn: 27768
2006-04-17 20:43:08 +00:00
Chris Lattner c070c621ac implement returns of a vector, testcase here: CodeGen/X86/vec_return.ll
llvm-svn: 27767
2006-04-17 20:32:50 +00:00
Chris Lattner e757ae6534 New testcase
llvm-svn: 27766
2006-04-17 20:32:27 +00:00
Chris Lattner 326870b40b 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

llvm-svn: 27765
2006-04-17 19:21:01 +00:00
Chris Lattner e54133cfba Make sure to check splats of every constant we can, handle splat(31) by
being a bit more clever, add support for odd splats from -31 to -17.

llvm-svn: 27764
2006-04-17 18:09:22 +00:00
Evan Cheng bf0d13c54f Incorrect foldMemoryOperand entries
llvm-svn: 27763
2006-04-17 18:06:12 +00:00
Evan Cheng 5112b5c544 Errors in patterns preventing load folding
llvm-svn: 27762
2006-04-17 18:05:01 +00:00
Jeff Cohen e3955a05e4 Add checks for __OpenBSD__.
llvm-svn: 27761
2006-04-17 17:55:41 +00:00
Chris Lattner 264c908e3a Teach the ppc backend to use rol and vsldoi to generate splatted constants.
This implements vec_constants.ll:test_vsldoi and test_rol

llvm-svn: 27760
2006-04-17 17:55:10 +00:00
Chris Lattner 8cdba16d5e Some more cases that can be generated with two instructions
llvm-svn: 27759
2006-04-17 17:54:18 +00:00
Chris Lattner 26fb8d9393 add a note
llvm-svn: 27758
2006-04-17 17:29:41 +00:00
Evan Cheng b3b41c4f3d FP SETOLT, SETOLT, SETUGE, SETUGT conditions were implemented incorrectly
llvm-svn: 27755
2006-04-17 07:24:10 +00:00
Chris Lattner 1b3806ace5 Make some code more general, adding support for constant formation of several
new patterns.

llvm-svn: 27754
2006-04-17 06:58:41 +00:00
Chris Lattner 9a3859b339 New testcases
llvm-svn: 27753
2006-04-17 06:58:16 +00:00
Chris Lattner f8dd76df5b Learn how to make odd splatted constants in range [17,29]. This implements
PowerPC/vec_constants.ll:test_29.

llvm-svn: 27752
2006-04-17 06:07:44 +00:00
Chris Lattner 02440a996b new testcase
llvm-svn: 27751
2006-04-17 06:06:50 +00:00
Chris Lattner 2a099c04c1 Pull some code out into a helper function.
Effeciently codegen even splats in the range [-32,30].

This allows us to codegen <30,30,30,30> as:

        vspltisw v0, 15
        vadduwm v2, v0, v0

instead of as a cp load.

llvm-svn: 27750
2006-04-17 06:00:21 +00:00
Chris Lattner 31b7d89e66 New testcase
llvm-svn: 27749
2006-04-17 05:58:22 +00:00
Chris Lattner 071ad01ceb Implement a TODO: for any shuffle that can be viewed as a v4[if]32 shuffle,
if it can be implemented in 3 or fewer discrete altivec instructions, codegen
it as such.  This implements Regression/CodeGen/PowerPC/vec_perf_shuffle.ll

llvm-svn: 27748
2006-04-17 05:28:54 +00:00
Chris Lattner 6e98b49b54 new testcase, these shuffles can be implemented with discrete instructions,
and shouldn't be lowered to vperm.

llvm-svn: 27747
2006-04-17 05:27:31 +00:00
Chris Lattner 85bfa3c2bc Regenerate with adjusted costs
llvm-svn: 27746
2006-04-17 05:26:20 +00:00
Chris Lattner e2e2cc5b28 Encode a cost of zero as a cost of 1.
llvm-svn: 27745
2006-04-17 05:25:16 +00:00
Chris Lattner aac2a200cd Regenerate with correct offset
llvm-svn: 27744
2006-04-17 05:08:46 +00:00
Chris Lattner 3dcfef6310 Really, I can count!
llvm-svn: 27743
2006-04-17 05:05:52 +00:00
Chris Lattner 311b1a6e23 Increase the opcodes by one each to disambiguate COPY from VMRGHW.
llvm-svn: 27742
2006-04-17 00:47:48 +00:00
Chris Lattner 895dba9714 assign stable opcodes to the various altivec ops.
llvm-svn: 27741
2006-04-17 00:47:18 +00:00
Chris Lattner 77a3ca6357 PPCPerfectShuffle.h is autogenerated, don't include it in the LOC counts.
llvm-svn: 27740
2006-04-17 00:46:09 +00:00
Chris Lattner 07a3d01a91 Check in a table, generated by llvm-PerfectShuffle, of optimal shuffles
of various 4-element vectors.

llvm-svn: 27739
2006-04-17 00:37:02 +00:00
Chris Lattner ac66b4a11d Rename BuildShuffleTable -> PerfectShuffle
llvm-svn: 27738
2006-04-17 00:35:34 +00:00
Chris Lattner 156c85ea42 rename the table
llvm-svn: 27737
2006-04-17 00:33:35 +00:00
Chris Lattner 2951955da9 Initial checking of a perfect shuffle generation program for 4-element
Altivec vectors.

llvm-svn: 27736
2006-04-17 00:30:41 +00:00
Evan Cheng c6f665f5f3 Better way to splat v2f64
llvm-svn: 27735
2006-04-16 18:16:43 +00:00
Evan Cheng 20712deecb movduprm, movshduprm bugs
llvm-svn: 27734
2006-04-16 18:11:28 +00:00
Evan Cheng 3064f9aaa6 Encoding bugs
llvm-svn: 27733
2006-04-16 07:02:22 +00:00
Evan Cheng 685ddd8152 Can't fold loads into alias vector SSE ops used for scalar operation. The load
address has to be 16-byte aligned but the values aren't spilled to 128-bit
locations.

llvm-svn: 27732
2006-04-16 06:58:19 +00:00
Chris Lattner 06a21ba96b Implement a TODO: have the legalizer canonicalize a bunch of operations to
one type (v4i32) so that we don't have to write patterns for each type, and
so that more CSE opportunities are exposed.

llvm-svn: 27731
2006-04-16 01:37:57 +00:00
Chris Lattner 91226e5799 Add support for promoting stores from one legal type to another, allowing us
to write one pattern for vector stores instead of 4.

llvm-svn: 27730
2006-04-16 01:36:45 +00:00
Chris Lattner fa5aa396c2 Make the BUILD_VECTOR lowering code much more aggressive w.r.t constant vectors.
Remove some done items from the todo list.

llvm-svn: 27729
2006-04-16 01:01:29 +00:00
Chris Lattner 9095186deb Fix a bug in the 'shuffle(undef,x,mask) -> shuffle(x, undef,mask')' xform
Make the insert/extract elt -> shuffle code more aggressive.

This fixes CodeGen/PowerPC/vec_shuffle.ll

llvm-svn: 27728
2006-04-16 00:51:47 +00:00
Chris Lattner 34cebe785d Canonicalize shuffle(undef,x,mask) -> shuffle(x, undef,mask').
llvm-svn: 27727
2006-04-16 00:03:56 +00:00
Chris Lattner 24acbe46c0 Fix a crash when faced with a shuffle vector that has an undef in its mask.
llvm-svn: 27726
2006-04-15 23:48:05 +00:00
Chris Lattner 873202fabd Add patterns for matching vnots with bit converted inputs. Most of these will
go away when I start using evan's binop type canonicalizer

llvm-svn: 27725
2006-04-15 23:45:24 +00:00
Chris Lattner 41df12ff4c Add a new vnot_conv predicate for matching vnot's where the allones vector is
bitconverted from some other type.

llvm-svn: 27724
2006-04-15 23:39:14 +00:00
Chris Lattner 7e7ad593cc Make these predicates return true for bit_convert(buildvector)'s as well as
buildvectors.

llvm-svn: 27723
2006-04-15 23:38:00 +00:00
Evan Cheng 8f1d801389 More encoding bugs
llvm-svn: 27722
2006-04-15 06:10:09 +00:00
Evan Cheng 91944e8699 pslldrm, psrawrm, etc. encoding bug
llvm-svn: 27721
2006-04-15 05:59:08 +00:00
Evan Cheng 1220b31a31 hsubp{s|d} encoding bug
llvm-svn: 27720
2006-04-15 05:52:42 +00:00
Evan Cheng 6222cf2a36 Silly bug
llvm-svn: 27719
2006-04-15 05:37:34 +00:00
Evan Cheng 65bb720a8b Do not use movs{h|l}dup for a shuffle with a single non-undef node.
llvm-svn: 27718
2006-04-15 03:13:24 +00:00
Chris Lattner 39fac448d6 significant cleanups to code that uses insert/extractelt heavily. This builds
maximal shuffles out of them where possible.

llvm-svn: 27717
2006-04-15 01:39:45 +00:00
Evan Cheng 0ba896c75b Added SSE (and other) entries to foldMemoryOperand().
llvm-svn: 27716
2006-04-14 23:33:27 +00:00
Evan Cheng 00a5b3d9d3 Some clean up
llvm-svn: 27715
2006-04-14 23:32:40 +00:00
Chris Lattner 559c8ba466 Allow undef in a shuffle mask
llvm-svn: 27714
2006-04-14 23:19:08 +00:00
Chris Lattner 0875d94567 Move these ctors out of line
llvm-svn: 27713
2006-04-14 22:20:32 +00:00
Chris Lattner 5876571afc These instructions always return a packed vector. Improve the class definitions to expose this fact.
llvm-svn: 27712
2006-04-14 22:20:07 +00:00
Evan Cheng 5d247f81c1 Last few SSE3 intrinsics.
llvm-svn: 27711
2006-04-14 21:59:03 +00:00
Chris Lattner 3323ce165d Teach scalarrepl to promote unions of vectors and floats, producing
insert/extractelement operations.  This implements
Transforms/ScalarRepl/vector_promote.ll

llvm-svn: 27710
2006-04-14 21:42:41 +00:00
Chris Lattner 1c0ef4385d New testcase, checking to see we can turn this code:
void test(vector float *F, float f) {
  vector float G = *F + *F;
  *((float*)&G) = f;
  *F = G + G;
}

void test2(vector float *F, float f) {
  vector float G = *F + *F;
  ((float*)&G)[2] = f;
  *F = G + G;
}

void test3(vector float *F, float *f) {
  vector float G = *F + *F;
  *f = ((float*)&G)[2];
}

void test4(vector float *F, float *f) {
  vector float G = *F + *F;
  *f = *((float*)&G);
}

into insert/extract element operations with no memory traffic.

llvm-svn: 27709
2006-04-14 21:41:54 +00:00
Tanya Lattner b138bbe85b Adding back vector instructions to keep in mainline.
llvm-svn: 27704
2006-04-14 19:24:33 +00:00
Tanya Lattner 8333c7d736 Removing unimplemented vector instructions from language referrence.
llvm-svn: 27703
2006-04-14 19:07:42 +00:00
Reid Spencer 83ee73fdb8 Correct the Superclasses list for GlobalVariable and Function to indicate
that they are "Constant" as they derive from GlobalValue. Also, fix some of
the wording where it mentions this.
Patch inspired by Nai Xia.

llvm-svn: 27701
2006-04-14 14:11:48 +00:00
Reid Spencer 9a20587c27 Allow an option, -with-externals, to be specified that provides the location
of the external tests. This turns into --with-externals option to configure.

llvm-svn: 27700
2006-04-14 13:53:56 +00:00
Evan Cheng 3bd605397b Misc. SSE2 intrinsics: clflush, lfench, mfence
llvm-svn: 27699
2006-04-14 07:43:12 +00:00
Evan Cheng e349d01acf We were not adjusting the frame size to ensure proper alignment when alloca /
vla are present in the function. This causes a crash when a leaf function
allocates space on the stack used to store / load with 128-bit SSE
instructions.

llvm-svn: 27698
2006-04-14 07:26:43 +00:00
Evan Cheng 8d76f3922b New entry
llvm-svn: 27697
2006-04-14 07:24:04 +00:00
Reid Spencer ef56d92d6c Don't print out the install command for Intrinsics.gen unless VERBOSE mode.
llvm-svn: 27696
2006-04-14 06:32:31 +00:00
Chris Lattner 086e986e94 Make this assertion better
llvm-svn: 27695
2006-04-14 06:08:35 +00:00
Chris Lattner 174bccb676 Force a specific config, because this test fails in certain configs otherwise.
llvm-svn: 27694
2006-04-14 06:06:51 +00:00
Chris Lattner 4211ca9108 Move the rest of the PPCTargetLowering::LowerOperation cases out into
separate functions, for simplicity and code clarity.

llvm-svn: 27693
2006-04-14 06:01:58 +00:00
Chris Lattner 19e9055eb5 Pull the VECTOR_SHUFFLE and BUILD_VECTOR lowering code out into separate
functions, which makes the code much cleaner :)

llvm-svn: 27692
2006-04-14 05:19:18 +00:00
Chris Lattner 68c650ca45 Implement value #'ing for vector operations, implementing
Regression/Transforms/GCSE/vectorops.ll

llvm-svn: 27691
2006-04-14 05:10:20 +00:00
Chris Lattner 1c4ecc0c73 new testcase, vector operations should be CSE'd
llvm-svn: 27690
2006-04-14 05:09:53 +00:00
Chris Lattner 326ff4eb93 Remove this test, there is no need to test GCC's bugs
llvm-svn: 27689
2006-04-14 04:47:26 +00:00
Reid Spencer 08a154e1a7 Ahem. HEAD -> 1.8cvs not 1.7 (I'm an idiot).
llvm-svn: 27687
2006-04-14 03:01:27 +00:00
Reid Spencer 89702afa0e remove the "cvs" part of the version number for the release branch.
llvm-svn: 27686
2006-04-14 02:55:43 +00:00
Evan Cheng eb0063a34f pcmpeq* and pcmpgt* intrinsics.
llvm-svn: 27685
2006-04-14 01:39:53 +00:00
Evan Cheng 16287444ff psll*, psrl*, and psra* intrinsics.
llvm-svn: 27684
2006-04-14 00:14:05 +00:00
Reid Spencer 64f6c11c59 Remove the .cvsignore file so this directory can be pruned.
llvm-svn: 27683
2006-04-13 22:00:10 +00:00
Reid Spencer 497ecf6840 Remove .cvsignore so that this directory can be pruned.
llvm-svn: 27682
2006-04-13 21:59:03 +00:00
Chris Lattner 548ee45cac My addition of the xfail marker threw off the line #. move it.
llvm-svn: 27678
2006-04-13 21:19:13 +00:00
Reid Spencer fabdf8087e Use quotes properly so that the possibility of a null variable set is
eliminated. This can happen, for example, if LLVM is configured without
llvm-gcc in which case things like LLVMGCC_VERSION will be empty. In
such cases, deja-gnu fails with:
can't read "llvmgcc_version": no such variable
because it sees:
set llvmgcc_version
instead of:
set llvmgcc_version ""

llvm-svn: 27676
2006-04-13 20:33:59 +00:00
Andrew Lenharth d911f0d545 from the linux kernel
llvm-svn: 27674
2006-04-13 19:50:07 +00:00
Chris Lattner 612e84dd8b Fix this regex to match what llvmgcc4 produces also
llvm-svn: 27673
2006-04-13 19:46:16 +00:00
Andrew Lenharth 4aa3001625 Handle some kernel code than ends in [0 x sbyte]. I think this is safe
llvm-svn: 27672
2006-04-13 19:31:49 +00:00
Reid Spencer 709eaacb36 Expand some code with temporary variables to rid ourselves of the warning
about "dereferencing type-punned pointer will break strict-aliasing rules"

llvm-svn: 27671
2006-04-13 18:29:58 +00:00
Chris Lattner ef023cb6e9 Fix an incorrect prototype for this intrinsic, fixing
CFrontend/2003-08-18-SigSetJmp.c  with llvm-gcc3.  This is part of PR733.

llvm-svn: 27670
2006-04-13 18:23:48 +00:00
Chris Lattner ce5ee73be6 Try xfailing this
llvm-svn: 27669
2006-04-13 18:15:24 +00:00
Evan Cheng a84319719c Doh. PANDrm, etc. are not commutable.
llvm-svn: 27668
2006-04-13 18:11:28 +00:00
Andrew Lenharth 4819ab573d fix this for the more restrictive linkage
llvm-svn: 27667
2006-04-13 17:52:32 +00:00
Chris Lattner d76ecc9678 These tests are now xfailed for llvmgcc4. This is PR735, unlikely to be
resolved before 1.7 :(

llvm-svn: 27666
2006-04-13 17:35:36 +00:00
Chris Lattner c8be43885e Only look at .ll files in this directory
llvm-svn: 27665
2006-04-13 17:32:53 +00:00
Chris Lattner ee98069488 This file is an invalid C file, test that it is properly rejected
llvm-svn: 27664
2006-04-13 17:32:03 +00:00
Chris Lattner 49c1dc2466 Another case where a dead cast was causing the test to spuriously
fail with the new front-end.

llvm-svn: 27663
2006-04-13 17:28:28 +00:00
Chris Lattner 2d2f3ef792 Don't get confused by dead casts.
llvm-svn: 27662
2006-04-13 17:26:54 +00:00
Chris Lattner 3b84d9a162 Fix an accidental commit.
llvm-svn: 27661
2006-04-13 17:21:49 +00:00
Chris Lattner 138058166f This test fails and I don't know why, xfail it until andrew gets a chance to
look at it.

llvm-svn: 27660
2006-04-13 17:19:34 +00:00
Chris Lattner 954ea6e2fc Oops, move misplaced test
llvm-svn: 27659
2006-04-13 17:18:42 +00:00
Chris Lattner b8ec695455 These are only XFAILs with llvmgcc3, they pass with llvmgcc4
llvm-svn: 27658
2006-04-13 17:16:21 +00:00