Commit Graph

4674 Commits

Author SHA1 Message Date
Evan Cheng
2cbdd27305 SSE varargs arguments are passed in memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46262 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-22 23:26:53 +00:00
Chris Lattner
3b8ea6e0a8 update this test to pass with duncan's change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46246 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-22 05:31:58 +00:00
Nick Lewycky
e6b0c0036a Multiply can be evaluated in a different type, so long as the target type has
a smaller bitwidth.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46244 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-22 05:08:48 +00:00
Devang Patel
5768c9658e New test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46220 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-21 22:15:58 +00:00
Devang Patel
e5d53f5fe8 New test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46209 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-21 19:28:13 +00:00
Dale Johannesen
5c5eb80255 Implement flt_rounds for PowerPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46174 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-18 19:55:37 +00:00
Chris Lattner
994d6cfb3d remove extraneous &&'s from tests, as Scott is apparently not going to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46173 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-18 19:53:43 +00:00
Dale Johannesen
9929207fde Test is correct again for the moment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46172 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-18 19:53:31 +00:00
Chris Lattner
a7a02fb828 Fix a latent bug exposed by my truncstore patch. We compiled stfiwx-2.ll to:
_test:
	fctiwz f0, f1
	stfiwx f0, 0, r4
	blr 

instead of:

_test:
	fctiwz f0, f1
	stfd f0, -8(r1)
	nop
	nop
	lwz r2, -4(r1)
	stb r2, 0(r4)
	blr 

The former is not correct (stores 4 bytes, not 1).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46161 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-18 16:54:56 +00:00
Scott Michel
58c5818c01 Forward progress: crtbegin.c now compiles successfully!
Fixed CellSPU's A-form (local store) address mode, so that all globals,
externals, constant pool and jump table symbols are now wrapped within
a SPUISD::AFormAddr pseudo-instruction. This now identifies all local
store memory addresses, although it requires a bit of legerdemain during
instruction selection to properly select loads to and stores from local
store, properly generating "LQA" instructions.

Also added mul_ops.ll test harness for exercising integer multiplication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46142 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17 20:38:41 +00:00
Chris Lattner
ddf89566a9 This commit changes:
1. Legalize now always promotes truncstore of i1 to i8. 
2. Remove patterns and gunk related to truncstore i1 from targets.
3. Rename the StoreXAction stuff to TruncStoreAction in TLI.
4. Make the TLI TruncStoreAction table a 2d table to handle from/to conversions.
5. Mark a wide variety of invalid truncstores as such in various targets, e.g.
   X86 currently doesn't support truncstore of any of its integer types.
6. Add legalize support for truncstores with invalid value input types.
7. Add a dag combine transform to turn store(truncate) into truncstore when
   safe.

The later allows us to compile CodeGen/X86/storetrunc-fp.ll to:

_foo:
	fldt	20(%esp)
	fldt	4(%esp)
	faddp	%st(1)
	movl	36(%esp), %eax
	fstps	(%eax)
	ret

instead of:

_foo:
	subl	$4, %esp
	fldt	24(%esp)
	fldt	8(%esp)
	faddp	%st(1)
	fstps	(%esp)
	movl	40(%esp), %eax
	movss	(%esp), %xmm0
	movss	%xmm0, (%eax)
	addl	$4, %esp
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46140 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17 19:59:44 +00:00
Chris Lattner
41c5a3918f new testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46139 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17 19:47:23 +00:00
Evan Cheng
e6d5c77d5d Test case for varargs parameter attribute issue I just fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46127 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17 07:26:31 +00:00
Chris Lattner
f51a9d4b3c add testcase that has been sitting in my tree for awhile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46124 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17 06:54:09 +00:00
Evan Cheng
839b759c38 When a live virtual register is being clobbered by an implicit def, it is spilled
and the spill is its kill. However, if the local allocator has determined the
register has not been modified (possible when its value was reloaded), it would
not issue a restore. In that case, mark the last use of the virtual register as
kill.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46111 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17 02:08:17 +00:00
Chris Lattner
ab04e13a1f Fix arg promotion to propagate the correct attrs on the calls to
promoted functions.  This is important for varargs calls in 
particular.  Thanks to duncan for providing a great testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46108 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17 01:17:03 +00:00
Evan Cheng
02c4285643 Fixes a nasty dag combiner bug that causes a bunch of tests to fail at -O0.
It's not safe to use the two value CombineTo variant to combine away a dead load.
e.g. 
v1, chain2 = load chain1, loc
v2, chain3 = load chain2, loc
v3         = add v2, c 
Now we replace use of v1 with undef, use of chain2 with chain1.
ReplaceAllUsesWith() will iterate through uses of the first load and update operands:
v1, chain2 = load chain1, loc
v2, chain3 = load chain1, loc
v3         = add v2, c 
Now the second load is the same as the first load, SelectionDAG cse will ensure
the use of second load is replaced with the first load.
v1, chain2 = load chain1, loc
v3         = add v1, c
Then v1 is replaced with undef and bad things happen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46099 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 23:11:54 +00:00
Duncan Sands
339e14fbdc Trampoline support for x86-64. This looks like
it should work, but I have no machine to test
it on.  Committed because it will at least
cause no harm, and maybe someone can test it
for me!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46098 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 22:55:25 +00:00
Chris Lattner
b8b92216f1 add testcase for regression
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46073 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 18:03:52 +00:00
Chris Lattner
f763288705 make sure to use a cpu that has sse.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46060 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 06:32:02 +00:00
Chris Lattner
7ff79c2d9d My previous commit had an incomplete message, it should have been:
make the 'fp return in ST(0)' optimization smart enough to
look through token factor nodes.  THis allows us to compile 
testcases like CodeGen/X86/fp-stack-retcopy.ll into:

_carg:
	subl	$12, %esp
	call	L_foo$stub
	fstpl	(%esp)
	fldl	(%esp)
	addl	$12, %esp
	ret

instead of:

_carg:
	subl	$28, %esp
	call	L_foo$stub
	fstpl	16(%esp)
	movsd	16(%esp), %xmm0
	movsd	%xmm0, 8(%esp)
	fldl	8(%esp)
	addl	$28, %esp
	ret

Still not optimal, but much better and this is a trivial patch.  Fixing 
the rest requires invasive surgery that is is not llvm 2.2 material.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46054 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 05:56:59 +00:00
Devang Patel
8c231e5dda Do not strip llvm.used values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46045 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 03:33:05 +00:00
Chris Lattner
beb168992f add a test to ensure that argpromote of one argument doesn't
break the byval attr on some other argument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46025 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 22:38:12 +00:00
Chris Lattner
e07704fc84 verify x86 generates ud2 for llvm.trap
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46023 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 22:22:02 +00:00
Chris Lattner
9a856b049d new testcase for llvm.trap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46020 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 22:17:26 +00:00
Duncan Sands
fdd75125b8 Testcase for gimplify_expr crash caused by an
unexpected placeholder_expr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46006 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 19:55:41 +00:00
Duncan Sands
b0c9b93bb4 I noticed that the trampoline straightening transformation could
drop attributes on varargs call arguments.  Also, it could generate
invalid IR if the transformed call already had the 'nest' attribute
somewhere (this can never happen for code coming from llvm-gcc,
but it's a theoretical possibility).  Fix both problems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45973 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 19:52:09 +00:00
Duncan Sands
02e30d70e2 This test is now the same as byval-1.ll, so remove it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45960 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 14:57:30 +00:00
Duncan Sands
559ad3c2c2 Test that byval cannot be used with pointers to
types with no size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45959 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 14:55:05 +00:00
Duncan Sands
d6a844cda8 We now allow byval on fairly general pointer types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45956 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 06:53:45 +00:00
Chris Lattner
941db495b8 Fix the miscompilation of MiBench/consumer-lame that was exposed by Evan's
byval work.  This miscompilation is due to the program indexing an array out
of range and us doing a transformation that broke this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45949 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 02:09:12 +00:00
Chris Lattner
37ac608623 Turn a memcpy from a double* into a load/store of double instead of
a load/store of i64.  The later prevents promotion/scalarrepl of the
source and dest in many cases.

This fixes the 300% performance regression of the byval stuff on 
stepanov_v1p2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45945 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 00:28:35 +00:00
Chris Lattner
ee2b7a4530 Fix PR1907, a nasty miscompilation because instcombine didn't
realize that ne & sgt  was a signed comparison (it was only 
looking at whether the left compare was signed).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45937 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-13 20:59:02 +00:00
Duncan Sands
1fac17f2e7 Check that nested functions don't get pointless
static chains.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45936 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-13 18:44:12 +00:00
Duncan Sands
e1e520f601 When turning a call to a bitcast function into a direct call,
if this becomes a varargs call then deal correctly with any
parameter attributes on the newly vararg call arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45931 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-13 08:02:44 +00:00
Chris Lattner
4db8f85c75 new testcase for rdar://5685492
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45918 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-13 00:19:57 +00:00
Chris Lattner
92938b7145 we don't have to make an explicit copy of a byval argument when
inlining a function if we know that the function does not write
to *any* memory.  This implements test/Transforms/Inline/byval2.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45912 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-12 18:54:29 +00:00
Duncan Sands
cfad1b4f78 Be more liberal in what parameter attributes are
allowed on the vararg arguments of a call.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-12 16:42:01 +00:00
Chris Lattner
a3554a47ef this actually does pass with 4.0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45899 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-12 01:45:22 +00:00
Duncan Sands
bfc5ae6df0 When DAE drops the varargs part of a function, ensure any
attributes on the vararg call arguments are also dropped.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45892 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11 23:13:45 +00:00
Chris Lattner
48e1dce486 llvm-g++ 4.0 has completely different code for this warning,
just xfail it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45890 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11 23:06:56 +00:00
Chris Lattner
28123d77e0 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45888 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11 23:04:14 +00:00
Duncan Sands
623a389f62 Do not allow attributes beyond a function's last
parameter, even if it is a varargs function.  Do
allow attributes on the varargs part of a call,
but not beyond the last argument.  Only allow
selected attributes to be on the varargs part of
a call (currently only 'byval' is allowed).  The
reasoning here is that most attributes, eg inreg,
simply make no sense here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11 22:36:48 +00:00
Chris Lattner
10603e0c84 Teach argpromote to ruthlessly hack small byval structs when it can
get away with it, which exposes opportunities to eliminate the memory
objects entirely.  For example, we now compile byval.ll to:

define internal void @f1(i32 %b.0, i64 %b.1) {
entry:
	%tmp2 = add i32 %b.0, 1		; <i32> [#uses=0]
	ret void
}

define i32 @main() nounwind  {
entry:
	call void @f1( i32 1, i64 2 )
	ret i32 0
}

This seems like it would trigger a lot for code that passes around small
structs (e.g. SDOperand's or _Complex)...



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45886 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11 22:31:41 +00:00
Duncan Sands
8bc16f0e0e Two occurrences on one line count as one...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45885 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11 21:46:24 +00:00
Duncan Sands
eb824709cb If there are attributes on the varargs part of a
call, don't discard them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45884 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11 21:23:39 +00:00
Scott Michel
497e888daf More CellSPU refinements:
- struct_2.ll: Completely unaligned load/store testing

- call_indirect.ll, struct_1.ll: Add test lines to exercise
   X-form [$reg($reg)] addressing

At this point, loads and stores should be under control (he says
in an optimistic tone of voice.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45882 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11 21:01:19 +00:00
Dale Johannesen
ef68e75618 Disable for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45881 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11 20:47:33 +00:00
Chris Lattner
c93adca358 When inlining a functino with a byval argument, make an explicit
copy of it in case the callee modifies the struct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45853 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11 06:09:30 +00:00
Scott Michel
9de5d0dd42 More CellSPU refinement and progress:
- Cleaned up custom load/store logic, common code is now shared [see note
  below], cleaned up address modes

- More test cases: various intrinsics, structure element access (load/store
  test), updated target data strings, indirect function calls.

Note: This patch contains a refactoring of the LoadSDNode and StoreSDNode
structures: they now share a common base class, LSBaseSDNode, that
provides an interface to their common functionality. There is some hackery
to access the proper operand depending on the derived class; otherwise,
to do a proper job would require finding and rearranging the SDOperands
sent to StoreSDNode's constructor. The current refactor errs on the
side of being conservatively and backwardly compatible while providing
functionality that reduces redundant code for targets where loads and
stores are custom-lowered.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45851 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11 02:53:15 +00:00