Commit Graph

1608 Commits

Author SHA1 Message Date
Chris Lattner
aeecb6c73a Fix PR2096, a regression introduced with my patch last night. This
also fixes cfrac, flops, and 175.vpr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 17:09:59 +00:00
Gabor Greif
72c8f0d156 Really feed llvm-as with the testcase, do not let it read from stdin. This fixes the hangs seen on solaris10.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47604 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 13:37:13 +00:00
Evan Cheng
c886c460e4 This is possible:
vr1 = extract_subreg vr2, 3
...
vr3 = extract_subreg vr1, 2
The end result is vr3 is equal to vr2 with subidx 2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47592 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 08:03:41 +00:00
Chris Lattner
0254e7033a Fix isNegatibleForFree to not return true for ConstantFP nodes
after legalize.  Just because a constant is legal (e.g. 0.0 in SSE) 
doesn't mean that its negated value is legal (-0.0).  We could make
this stronger by checking to see if the negated constant is actually
legal post negation, but it doesn't seem like a big deal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 07:04:54 +00:00
Evan Cheng
9bf12b5583 Fix PR2076. CodeGenPrepare now sinks address computation for inline asm memory
operands into inline asm block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47589 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 02:42:37 +00:00
Scott Michel
a59d469e9b Merge current work back to tree to minimize diffs and drift. Major highlights
for CellSPU modifications:

- SPUInstrInfo.td refactoring: "multiclass" really is _your_ friend.
- Other improvements based on refactoring effort in SPUISelLowering.cpp,
  esp. in SPUISelLowering::PerformDAGCombine(), where zero amount shifts and
  rotates are now eliminiated, other scalar-to-vector-to-scalar silliness
  is also eliminated.
- 64-bit operations are being implemented, _muldi3.c gcc runtime now
  compiles and generates the right code. More work still needs to be done.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47532 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-23 18:41:37 +00:00
Evan Cheng
249ded3fa8 Rematerialization logic was overly conservative when it comes to loads from fixed stack slots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47529 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-23 03:38:34 +00:00
Evan Cheng
aaa1d4265e Update test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47527 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-23 02:57:25 +00:00
Evan Cheng
18924f11c1 Remat of pic loads are now on by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-23 02:08:30 +00:00
Evan Cheng
28c9fc630c Really. Why doesn't every arch support MMX?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-23 00:56:14 +00:00
Evan Cheng
530d47f4f2 Test case for PR2082.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47501 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-22 20:38:49 +00:00
Evan Cheng
d8850a512e Allow re-materialization of pic load (controlled by -remat-pic-load for now).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47476 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-22 09:25:47 +00:00
Chris Lattner
d2b1fb27df copy mmx values from/to memory with GPRs on x86-32
instead of with mmx registers.  This horribleness is apparently
done by gcc to avoid having to insert emms in places that really 
should have it.  This is the second half of rdar://5741668.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47474 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-22 05:18:04 +00:00
Chris Lattner
149a4e56fc Start using GPR's to copy around mmx value instead of mmx regs.
GCC apparently does this, and code depends on not having to do
emms when this happens.  This is x86-64 only so far, second half
should handle x86-32.

rdar://5741668


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47470 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-22 02:09:43 +00:00
Chris Lattner
0fe71e9bb1 Treat clobber operands like early clobbers: if we have
any, we force sdisel to do all regalloc for an asm.  This
leads to gross but correct codegen.

This fixes the rest of PR2078.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47454 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 19:43:13 +00:00
Tanya Lattner
33eefffb2b Remove llvm-upgrade and update tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47432 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 07:42:26 +00:00
Chris Lattner
2bedd7359c testcase for PR1133
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47427 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 05:27:08 +00:00
Chris Lattner
7cbeb2431c Fix a (harmless) but where vregs were added to the used reg lists for
inline asms.

Fix PR2078 by marking aliases of registers used when a register is 
marked used.  This prevents EAX from being allocated when AX is listed
in the clobber set for the asm.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47426 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 04:55:52 +00:00
Evan Cheng
359026e39a XFAIL this for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47355 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 02:38:58 +00:00
Chris Lattner
b476f98ca9 this test requires sse2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47331 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 18:07:46 +00:00
Chris Lattner
ce2bcc8839 Don't fold and's into test instructions if they have multiple uses.
This compiles test-nofold.ll into:

_test:
	movl	$15, %ecx
	andl	4(%esp), %ecx
	testl	%ecx, %ecx
	movl	$42, %eax
	cmove	%ecx, %eax
	ret

instead of:
_test:
	movl	4(%esp), %eax
	movl	%eax, %ecx
	andl	$15, %ecx
	testl	$15, %eax
	movl	$42, %eax
	cmove	%ecx, %eax
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47330 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 17:37:35 +00:00
Chris Lattner
22c31769fb rename tests to avoid a test- prefix when they aren't related to the test instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47329 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 17:33:52 +00:00
Tanya Lattner
cfab3da46e Remove llvm-upgrade and update tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47325 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 08:07:33 +00:00
Nick Lewycky
7ad3920e31 Don't spew stats to stderr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47308 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 03:11:47 +00:00
Nick Lewycky
9103ba1003 Fix up the run line for this new test.
llc: for the -info-output-file option:  requires a value!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47306 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 02:58:36 +00:00
Evan Cheng
acfab64631 New test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47302 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 02:09:58 +00:00
Tanya Lattner
53a66d10f0 Remove llvm-upgrade and update tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47296 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 01:41:04 +00:00
Evan Cheng
efec751a1b - When DAG combiner is folding a bit convert into a BUILD_VECTOR, it should check if it's essentially a SCALAR_TO_VECTOR. Avoid turning (v8i16) <10, u, u, u> to <10, 0, u, u, u, u, u, u>. Instead, simply convert it to a SCALAR_TO_VECTOR of the proper type.
- X86 now normalize SCALAR_TO_VECTOR to (BIT_CONVERT (v4i32 SCALAR_TO_VECTOR)). Get rid of X86ISD::S2VEC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47290 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 23:04:32 +00:00
Dan Gohman
339ffedca9 Don't mark scalar integer multiplication as Expand on x86, since x86
has plain one-result scalar integer multiplication instructions.
This avoids expanding such instructions into MUL_LOHI sequences that
must be special-cased at isel time, and avoids the problem with that
code that provented memory operands from being folded.

This fixes PR1874, addressesing the most common case. The uncommon
cases of optimizing multiply-high operations will require work
in DAGCombiner.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47277 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 17:55:26 +00:00
Tanya Lattner
6263f94674 Remove llvm-upgrade.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47238 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-17 20:02:20 +00:00
Andrew Lenharth
22c5c1b2df llvm.memory.barrier, and impl for x86 and alpha
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47204 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-16 01:24:58 +00:00
Evan Cheng
de7f560744 This test is not interesting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47189 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-15 23:06:21 +00:00
Chris Lattner
423be627e6 Fix a miscompilation from Dan's recent apintification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47128 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 18:48:56 +00:00
Chris Lattner
8b0cb7bcc6 This readme entry is done, testcase here: CodeGen/X86/zero-remat.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47106 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 05:39:46 +00:00
Evan Cheng
5598b70a78 Fix test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47102 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 01:32:53 +00:00
Duncan Sands
d462ba8539 Teach LegalizeTypes how to expand and promote CTLZ,
CTTZ and CTPOP.  The expansion code differs from
that in LegalizeDAG in that it chooses to take the
CTLZ/CTTZ count from the Hi/Lo part depending on
whether the Hi/Lo value is zero, not on whether
CTLZ/CTTZ of Hi/Lo returned 32 (or whatever the
width of the type is) for it.  I made this change
because the optimizers may well know that Hi/Lo
is zero and exploit it.  The promotion code for
CTTZ also differs from that in LegalizeDAG: it
uses an "or" to get the right result when the
original value is zero, rather than using a compare
and select.  This also means the value doesn't
need to be zero extended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47075 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 18:01:53 +00:00
Chris Lattner
86ca3cacc5 In SDISel, for targets that support FORMAL_ARGUMENTS nodes, lower this
node as soon as we create it in SDISel.  Previously we would lower it in
legalize.  The problem with this is that it only exposes the argument
loads implied by FORMAL_ARGUMENTs after legalize, so that only dag combine 2
can hack on them.  This causes us to miss some optimizations because 
datatype expansion also happens here.

Exposing the loads early allows us to do optimizations on them.  For example
we now compile arg-cast.ll to:

_foo:
	movl	$2147483647, %eax
	andl	8(%esp), %eax
	ret

where we previously produced:

_foo:
	subl	$12, %esp
	movsd	16(%esp), %xmm0
	movsd	%xmm0, (%esp)
	movl	$2147483647, %eax
	andl	4(%esp), %eax
	addl	$12, %esp
	ret

It might also make sense to do this for ISD::CALL nodes, which have implicit
stores on many targets.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47054 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 07:39:09 +00:00
Nate Begeman
5e1dd5597e Add testcase for recent legalizer change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47049 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 06:48:40 +00:00
Evan Cheng
b2e72b0feb New tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47047 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 03:23:53 +00:00
Evan Cheng
073c5b721d Don't mask the isel bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47018 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 19:11:29 +00:00
Evan Cheng
aeb231cb59 This test assumes no SSE4.1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 19:11:08 +00:00
Evan Cheng
65b2e3df0d Fix some test cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46998 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 07:22:46 +00:00
Evan Cheng
431bfcbe37 Determine whether a spill kills the register it's spilling before insertion rather than trying to undo the kill marker afterwards.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46953 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 08:30:52 +00:00
Dale Johannesen
b3c4eb46d6 Alignment of struct containing vectors depends on
whether SSE is present, on Darwin anyway.  Make it
explicit.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-09 19:04:25 +00:00
Evan Cheng
5fd79d0560 It's not always safe to fold movsd into xorpd, etc. Check the alignment of the load address first to make sure it's 16 byte aligned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46893 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 21:20:40 +00:00
Evan Cheng
33663fc104 Added missing entries in X86 load / store folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46866 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 00:12:56 +00:00
Evan Cheng
be3bf42331 Fix a x86-64 codegen deficiency. Allow gv + offset when using rip addressing mode.
Before:
_main:
        subq    $8, %rsp
        leaq    _X(%rip), %rax
        movsd   8(%rax), %xmm1
        movss   _X(%rip), %xmm0
        call    _t
        xorl    %ecx, %ecx
        movl    %ecx, %eax
        addq    $8, %rsp
        ret
Now:
_main:
        subq    $8, %rsp
        movsd   _X+8(%rip), %xmm1
        movss   _X(%rip), %xmm0
        call    _t
        xorl    %ecx, %ecx
        movl    %ecx, %eax
        addq    $8, %rsp
        ret

Notice there is another idiotic codegen issue that needs to be fixed asap:
xorl    %ecx, %ecx
movl    %ecx, %eax


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46850 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 08:53:49 +00:00
Evan Cheng
b745e88bf0 It's PR1925, not PR1609.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46825 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 22:07:17 +00:00
Evan Cheng
2fc628d662 Fix a number of local register allocator issues: PR1609.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46821 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 19:16:53 +00:00
Evan Cheng
a58891ff1e Fix PR1975: dag isel emitter produces patterns that isel wrong flag result.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46776 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 22:50:29 +00:00
Evan Cheng
bb4151bd1f If a vr is already marked alive in a bb, then it has PHI uses that are visited earlier, then it is not killed in the def block (i.e. not dead).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46763 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 20:04:18 +00:00
Duncan Sands
6cc24947b6 Crashes LegalizeTypes with "Do not know how to
expand the result of this operator!" (node: ctlz).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46713 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 18:07:02 +00:00
Duncan Sands
06418c5610 Crashes LegalizeTypes with "Do not know how to split
this operator's operand" (node: extract_subvector).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46712 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 18:05:42 +00:00
Chris Lattner
003de9a81e remove target triple to make this test more "generic"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46711 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 18:02:37 +00:00
Duncan Sands
df3fb5ef97 Crashed the new type legalizer. Not likely to catch
any bugs in the future since to get the crash you also
need hacked in fake libcall support (which creates odd
but legal trees), but since adding it doesn't hurt...
Thanks to Chris for this ultimately reduced version.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 09:40:27 +00:00
Lauro Ramos Venancio
859efca7f9 CBackend: Implement unaligned load/store.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46646 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 21:25:59 +00:00
Chris Lattner
7cf9abff23 Add target triples to these so they don't fail on linux.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46496 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 06:26:07 +00:00
Scott Michel
053c1da8d9 Overhaul Cell SPU's addressing mode internals so that there are now
only two addressing mode nodes, SPUaform and SPUindirect (vice the
three previous ones, SPUaform, SPUdform and SPUxform). This improves
code somewhat because we now avoid using reg+reg addressing when
it can be avoided. It also simplifies the address selection logic,
which was the main point for doing this.

Also, for various global variables that would be loaded using SPU's
A-form addressing, prefer D-form offs[reg] addressing, keeping the
base in a register if the variable is used more than once.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46483 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 02:16:57 +00:00
Chris Lattner
15c2351a93 Update this test. Due to dag combiner improvements, we now compile
f7/f11 to:

_f7:
	eor r0, r0, #2, 2 @ -2147483648
	bx lr
_f11:
	bic r0, r0, #2, 2 @ -2147483648
	bx lr

instead of:

_f7:
	fmsr s0, r0
	fnegs s0, s0
	fmrs r0, s0
	bx lr

_f11:
	fmsr s0, r0
	fabss s0, s0
	fmrs r0, s0
	bx lr



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46423 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-27 23:26:37 +00:00
Chris Lattner
3bd39d4ca8 Implement some dag combines that allow doing fneg/fabs/fcopysign in integer
registers if used by a bitconvert or using a bitconvert.  This allows us to
avoid constant pool loads and use cheaper integer instructions when the
values come from or end up in integer regs anyway.  For example, we now 
compile CodeGen/X86/fp-in-intregs.ll to:

_test1:
	movl	$2147483648, %eax
	xorl	4(%esp), %eax
	ret
_test2:
	movl	$1065353216, %eax
	orl	4(%esp), %eax
	andl	$3212836864, %eax
	ret

Instead of:
_test1:
	movss	4(%esp), %xmm0
	xorps	LCPI2_0, %xmm0
	movd	%xmm0, %eax
	ret
_test2:
	movss	4(%esp), %xmm0
	andps	LCPI3_0, %xmm0
	movss	LCPI3_1, %xmm1
	andps	LCPI3_2, %xmm1
	orps	%xmm0, %xmm1
	movd	%xmm1, %eax
	ret

bitconverts can happen due to various calling conventions that require
fp values to passed in integer regs in some cases, e.g. when returning
a complex.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46414 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-27 17:42:27 +00:00
Chris Lattner
b8f43875c3 New test to verify that "merging 4 loads into a vec load" continues to work and
continues to infer alignment info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46403 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 20:06:45 +00:00
Chris Lattner
1329cb8d89 Infer alignment of loads and increase their alignment when we can tell they are
from the stack.  This allows us to compile stack-align.ll to:

_test:
	movsd	LCPI1_0, %xmm0
	movapd	%xmm0, %xmm1
***	andpd	4(%esp), %xmm1
	andpd	_G, %xmm0
	addsd	%xmm1, %xmm0
	movl	20(%esp), %eax
	movsd	%xmm0, (%eax)
	ret

instead of:

_test:
	movsd	LCPI1_0, %xmm0
**	movsd	4(%esp), %xmm1
**	andpd	%xmm0, %xmm1
	andpd	_G, %xmm0
	addsd	%xmm1, %xmm0
	movl	20(%esp), %eax
	movsd	%xmm0, (%eax)
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46401 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 19:45:50 +00:00
Chris Lattner
216f3f6522 remove a useless xfailed test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46400 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 19:35:46 +00:00
Bill Wendling
824a721560 If there's no instructions being emitted on X86 for a function, emit a
nop. Emit the nop directly for PPC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46398 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 09:03:52 +00:00
Bill Wendling
c79348d8dc Need to convert to LLVM code and not C.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46397 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 06:56:08 +00:00
Bill Wendling
cd76af4a62 Rename the .c to .ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46396 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 06:53:40 +00:00
Bill Wendling
f7214bca74 Move testcase to the code gen directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46395 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 06:53:06 +00:00
Chris Lattner
5eee427594 Fix some bugs in SimplifyNodeWithTwoResults where it would call deletenode to
delete a node even if it was not dead in some cases.  Instead, just add it to
the worklist.  Also, make sure to use the CombineTo methods, as it was doing
things that were unsafe: the top level combine loop could touch dangling memory.

This fixes CodeGen/Generic/2008-01-25-dag-combine-mul.ll



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46384 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 01:09:19 +00:00
Chris Lattner
af723b9ae4 Add target-specific dag combines for FAND(x,0) and FOR(x,0). This allows
us to compile:

double test(double X) {
  return copysign(0.0, X);
}

into:

_test:
	andpd	LCPI1_0(%rip), %xmm0
	ret

instead of:
_test:
	pxor	%xmm1, %xmm1
	andpd	LCPI1_0(%rip), %xmm1
	movapd	%xmm0, %xmm2
	andpd	LCPI1_1(%rip), %xmm2
	movapd	%xmm1, %xmm0
	orpd	%xmm2, %xmm0
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46344 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 05:46:26 +00:00
Chris Lattner
d43d00cf3a Significantly simplify and improve handling of FP function results on x86-32.
This case returns the value in ST(0) and then has to convert it to an SSE
register.  This causes significant codegen ugliness in some cases.  For 
example in the trivial fp-stack-direct-ret.ll testcase we used to generate:

_bar:
	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

because we move the result of foo() into an XMM register, then have to
move it back for the return of bar.

Instead of hacking ever-more special cases into the call result lowering code
we take a much simpler approach: on x86-32, fp return is modeled as always 
returning into an f80 register which is then truncated to f32 or f64 as needed.
Similarly for a result, we model it as an extension to f80 + return.

This exposes the truncate and extensions to the dag combiner, allowing target
independent code to hack on them, eliminating them in this case.  This gives 
us this code for the example above:

_bar:
	subl	$12, %esp
	call	L_foo$stub
	addl	$12, %esp
	ret

The nasty aspect of this is that these conversions are not legal, but we want
the second pass of dag combiner (post-legalize) to be able to hack on them.
To handle this, we lie to legalize and say they are legal, then custom expand
them on entry to the isel pass (PreprocessForFPConvert).  This is gross, but
less gross than the code it is replacing :)

This also allows us to generate better code in several other cases.  For 
example on fp-stack-ret-conv.ll, we now generate:

_test:
	subl	$12, %esp
	call	L_foo$stub
	fstps	8(%esp)
	movl	16(%esp), %eax
	cvtss2sd	8(%esp), %xmm0
	movsd	%xmm0, (%eax)
	addl	$12, %esp
	ret

where before we produced (incidentally, the old bad code is identical to what
gcc produces):

_test:
	subl	$12, %esp
	call	L_foo$stub
	fstpl	(%esp)
	cvtsd2ss	(%esp), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	16(%esp), %eax
	movsd	%xmm0, (%eax)
	addl	$12, %esp
	ret

Note that we generate slightly worse code on pr1505b.ll due to a scheduling 
deficiency that is unrelated to this patch.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46307 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-24 08:07:48 +00:00
Chris Lattner
7323999b31 take these with a pr #
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46303 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-24 06:35:44 +00:00
Evan Cheng
2928650262 Let each target decide byval alignment. For X86, it's 4-byte unless the aggregare contains SSE vector(s). For x86-64, it's max of 8 or alignment of the type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46286 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-23 23:17:41 +00:00
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
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
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
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
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
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
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
Duncan Sands
007f9847c4 Output sinl for a long double FSIN node, not sin.
Likewise fix up a bunch of other libcalls.  While
there I remove NEG_F32 and NEG_F64 since they are
not used anywhere.  This fixes 9 Ada ACATS failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45833 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 10:28:30 +00:00
Evan Cheng
9c9cec4372 Codegen improvement has reduced one spill.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45814 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 02:54:40 +00:00
Chris Lattner
314286f6bd new testcase for PR1845
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45795 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 00:30:38 +00:00
Evan Cheng
19107563af Special copy SUnit's do not have SDNode's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45787 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 23:01:55 +00:00
Evan Cheng
92b7c1d94e Fix sse2.psrl.w and sse2.psrl.q definitions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45772 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 02:16:44 +00:00
Chris Lattner
07649d9265 Make load->store deletion a bit smarter. This allows us to compile this:
void test(long long *P) { *P ^= 1; }

into just:

_test:
	movl	4(%esp), %eax
	xorl	$1, (%eax)
	ret

instead of code like this:

_test:
	movl	4(%esp), %ecx
        xorl    $1, (%ecx)
	movl	4(%ecx), %edx
	movl	%edx, 4(%ecx)
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45762 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-08 23:08:06 +00:00
Duncan Sands
2815cbb9c7 Crashes llc when using Chris's new legalization logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45758 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-08 21:51:53 +00:00
Chris Lattner
a4040e9a9f remove darwin/i386 t-t
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45743 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-08 06:52:51 +00:00
Chris Lattner
fe39edde27 Finally implement correct ordered comparisons for PPC, even though
the code generated is not wonderful.  This turns a miscompilation into
a code quality bug (noted in the ppc readme).  This fixes PR642, which
is over 2 years old (!).  Nate, please review this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45742 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-08 06:46:30 +00:00
Nate Begeman
337c213c18 Update test to catch recent x86 insert regression and improvements
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45705 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 17:49:23 +00:00
Gordon Henriksen
572742e876 Setting GlobalDirective in TargetAsmInfo by default rather than
providing a misleading facility. It's used once in the MIPS backend
and hardcoded as "\t.globl\t" everywhere else.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45676 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 02:31:11 +00:00
Gordon Henriksen
8fa8929177 With this patch, the LowerGC transformation becomes the
ShadowStackCollector, which additionally has reduced overhead with
no sacrifice in portability.

Considering a function @fun with 8 loop-local roots,
ShadowStackCollector introduces the following overhead
(x86):

; shadowstack prologue
        movl    L_llvm_gc_root_chain$non_lazy_ptr, %eax
        movl    (%eax), %ecx
        movl    $___gc_fun, 20(%esp)
        movl    $0, 24(%esp)
        movl    $0, 28(%esp)
        movl    $0, 32(%esp)
        movl    $0, 36(%esp)
        movl    $0, 40(%esp)
        movl    $0, 44(%esp)
        movl    $0, 48(%esp)
        movl    $0, 52(%esp)
        movl    %ecx, 16(%esp)
        leal    16(%esp), %ecx
        movl    %ecx, (%eax)

; shadowstack loop overhead
        (none)

; shadowstack epilogue
        movl    48(%esp), %edx
        movl    %edx, (%ecx)

; shadowstack metadata
        .align  3
___gc_fun:                              # __gc_fun
        .long   8
        .space  4

In comparison to LowerGC:

; lowergc prologue
        movl    L_llvm_gc_root_chain$non_lazy_ptr, %eax
        movl    (%eax), %ecx
        movl    %ecx, 48(%esp)
        movl    $8, 52(%esp)
        movl    $0, 60(%esp)
        movl    $0, 56(%esp)
        movl    $0, 68(%esp)
        movl    $0, 64(%esp)
        movl    $0, 76(%esp)
        movl    $0, 72(%esp)
        movl    $0, 84(%esp)
        movl    $0, 80(%esp)
        movl    $0, 92(%esp)
        movl    $0, 88(%esp)
        movl    $0, 100(%esp)
        movl    $0, 96(%esp)
        movl    $0, 108(%esp)
        movl    $0, 104(%esp)
        movl    $0, 116(%esp)
        movl    $0, 112(%esp)

; lowergc loop overhead
        leal    44(%esp), %eax
        movl    %eax, 56(%esp)
        leal    40(%esp), %eax
        movl    %eax, 64(%esp)
        leal    36(%esp), %eax
        movl    %eax, 72(%esp)
        leal    32(%esp), %eax
        movl    %eax, 80(%esp)
        leal    28(%esp), %eax
        movl    %eax, 88(%esp)
        leal    24(%esp), %eax
        movl    %eax, 96(%esp)
        leal    20(%esp), %eax
        movl    %eax, 104(%esp)
        leal    16(%esp), %eax
        movl    %eax, 112(%esp)

; lowergc epilogue
        movl    48(%esp), %edx
        movl    %edx, (%ecx)

; lowergc metadata
        (none)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45670 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 01:30:53 +00:00
Chris Lattner
e9d666e7fb fix this to use a valid triple.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45509 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 22:21:45 +00:00
Chris Lattner
e2620add35 verify that aligned common support doesn't break.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45495 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 19:48:24 +00:00
Duncan Sands
b027fa001f Fix PR1833 - eh.exception and eh.selector return two
values, which means doing extra legalization work.
It would be easier to get this kind of thing right if
there was some documentation...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45472 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-31 18:35:50 +00:00
Chris Lattner
03c079d5fc One readme entry is done, one is really easy (Evan, want to investigate
eliminating the llvm.x86.sse2.loadl.pd intrinsic?), one shuffle optzn
may be done (if shufps is better than pinsw, Evan, please review), and
we already know about LICM of simple instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45407 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 19:31:47 +00:00
Chris Lattner
18f07f49c5 upgrade this test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45406 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 19:24:06 +00:00
Chris Lattner
63079f0757 Fold comparisons against a constant nan, and optimize ORD/UNORD
comparisons with a constant.  This allows us to compile isnan to:

_foo:
	fcmpu cr7, f1, f1
	mfcr r2
	rlwinm r3, r2, 0, 31, 31
	blr 

instead of:

LCPI1_0:					;  float
	.space	4
_foo:
	lis r2, ha16(LCPI1_0)
	lfs f0, lo16(LCPI1_0)(r2)
	fcmpu cr7, f1, f0
	mfcr r2
	rlwinm r3, r2, 0, 31, 31
	blr 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45405 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 08:37:08 +00:00
Chris Lattner
69bfbdfaee this xform is implemented.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45404 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 08:19:39 +00:00
Chris Lattner
d60eedca01 Codegen:
as:

_bar:
	pushl	%esi
	subl	$8, %esp
	movl	16(%esp), %esi
	call	L_foo$stub
	fstps	(%esi)
	addl	$8, %esp
	popl	%esi
	#FP_REG_KILL
	ret

instead of:

_bar:
	pushl	%esi
	subl	$8, %esp
	movl	16(%esp), %esi
	call	L_foo$stub
	fstpl	(%esi)
	cvtsd2ss	(%esi), %xmm0
	movss	%xmm0, (%esi)
	addl	$8, %esp
	popl	%esi
	#FP_REG_KILL
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45401 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 06:57:38 +00:00
Chris Lattner
112dedc520 avoid going through a stack slot to convert from fpstack to xmm reg
if we are just going to store it back anyway.  This improves things 
like:
double foo();
void bar(double *P) { *P = foo(); }



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45399 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 06:41:28 +00:00
Chris Lattner
8d2a922814 one fewer uncond branch with my codegenprepare hack for single-mbb backedges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45360 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-26 17:23:47 +00:00
Gordon Henriksen
e86ce7d94a Tests for changes made in r45356, where IPO optimizations would drop
collector algorithms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45357 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-26 02:47:37 +00:00
Gordon Henriksen
0e13821c96 GC poses hazards to the inliner. Consider:
define void @f() {
            ...
            call i32 @g()
            ...
    }

    define void @g() {
            ...
    }

The hazards are:

  - @f and @g have GC, but they differ GC. Inlining is invalid. This
    may never occur.
  - @f has no GC, but @g does. g's GC must be propagated to @f.

The other scenarios are safe:

  - @f and @g have the same GC.
  - @f and @g have no GC.
  - @g has no GC.

This patch adds inliner checks for the former two scenarios.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45351 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-25 03:10:07 +00:00
Gordon Henriksen
e1433f24cf Noting and enforcing that GC intrinsics are valid only within a
function with GC.

This will catch the error when the inliner inlines a function with
GC into a caller with no GC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45350 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-25 02:31:26 +00:00
Gordon Henriksen
27acd3a999 Adjusting verification of "llvm.gc*" intrinsic prototypes to match
LangRef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45349 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-25 02:02:10 +00:00
Evan Cheng
e3c1cfb181 Remove xfail. This is fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45254 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-20 02:25:21 +00:00
Scott Michel
86c041f50e More working CellSPU tests:
- vec_const.ll: Vector constant loads
- immed64.ll: i64, f64 constant loads


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45242 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-20 00:44:13 +00:00
Scott Michel
0e5665bf03 CellSPU testcase, extract_elt.ll: extract vector element.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45219 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 21:17:42 +00:00
Scott Michel
0a92af487b More working CellSPU test cases:
- call.ll: Function call
- ctpop.ll: Count population
- dp_farith.ll: DP arithmetic
- eqv.ll: Equivalence primitives
- fcmp.ll: SP comparisons
- fdiv.ll: SP division
- fneg-fabs.ll: SP negation, aboslute value
- int2fp.ll: Integer -> SP conversion
- rotate_ops.ll: Rotation primitives
- select_bits.ll: (a & c) | (b & ~c) bit selection
- shift_ops.ll: Shift primitives
- sp_farith.ll: SP arithmentic


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45217 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 20:50:49 +00:00
Scott Michel
170783a5fc Two more test cases: or_ops.ll (arithmetic or operations) and vecinsert.ll
(vector insertions)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45216 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 20:15:47 +00:00
Scott Michel
9999e685ea Add new immed16.ll test case, fix CellSPU errata to make test case work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45196 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 07:35:06 +00:00
Evan Cheng
636e5a216c Fix PR1872: SrcValue and SrcValueOffset should not be used to compute load / store node id.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45167 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 19:38:14 +00:00
Evan Cheng
beec823d4b FIX for PR1799: When a load is unfolded from an instruction, check if it is a new node. If not, do not create a new SUnit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45157 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 08:42:10 +00:00
Scott Michel
4a5b66bc2f i32 immediate constant test case for CellSPU
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45134 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 23:45:52 +00:00
Scott Michel
504c369213 - Restore some i8 functionality in CellSPU
- New test case: nand.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45130 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 22:32:34 +00:00
Duncan Sands
fd7b326bea Make invokes of inline asm legal. Teach codegen
how to lower them (with no attempt made to be
efficient, since they should only occur for
unoptimized code).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45108 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 18:08:19 +00:00
Evan Cheng
7a831ce85f Make better use of instructions that clear high bits; fix various 2-wide shuffle bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45058 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-15 03:00:47 +00:00
Scott Michel
ec2a08ff06 Start committing working test cases for CellSPU.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45050 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-15 00:38:50 +00:00
Evan Cheng
152804e9c1 Fix ctlz and cttz. llvm definition requires them to return number of bits in of the src type when value is zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45029 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 08:30:15 +00:00
Evan Cheng
18efe269b1 Implement ctlz and cttz with bsr and bsf.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45024 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 02:13:44 +00:00
Evan Cheng
f9785f92b6 Be extra careful with extension use optimation. Now turned on by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44981 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-13 03:32:53 +00:00
Evan Cheng
1314b00cf2 Fold some and + shift in x86 addressing mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44970 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-13 00:43:27 +00:00
Evan Cheng
6e141fd048 Implicit def instructions, e.g. X86::IMPLICIT_DEF_GR32, are always re-materializable and they should not be spilled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44960 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 23:12:09 +00:00
Dan Gohman
890813243f Allow vector integer constants to be created with
SelectionDAG::getConstant, in the same way as vector floating-point
constants. This allows the legalize expansion code for @llvm.ctpop and
friends to be usable with vector types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44954 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 22:21:26 +00:00
Evan Cheng
794405e6aa Use shuffles to implement insert_vector_elt for i32, i64, f32, and f64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44929 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 07:55:34 +00:00
Evan Cheng
2044bccd1a Add a test case for -optimize-ext-uses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44928 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 07:54:08 +00:00
Evan Cheng
db2d524d5f Lower a build_vector with all constants into a constpool load unless it can be done with a move to low part.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44921 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 06:45:40 +00:00
Evan Cheng
14b32e1941 - Improved v8i16 shuffle lowering. It now uses pshuflw and pshufhw as much as
possible before resorting to pextrw and pinsrw.
- Better codegen for v4i32 shuffles masquerading as v8i16 or v16i8 shuffles.
- Improves (i16 extract_vector_element 0) codegen by recognizing
  (i32 extract_vector_element 0) does not require a pextrw.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44836 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 01:46:18 +00:00
Christopher Lamb
11a4f64bd4 Improve branch folding by recgonizing that explict successor relationships impact the value of fall-through choices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44785 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 07:24:06 +00:00
Gordon Henriksen
80a75bfae9 Adding a collector name attribute to Function in the IR. These
methods are new to Function:

  bool hasCollector() const;
  const std::string &getCollector() const;
  void setCollector(const std::string &);
  void clearCollector();

The assembly representation is as such:

  define void @f() gc "shadow-stack" { ...

The implementation uses an on-the-side table to map Functions to 
collector names, such that there is no overhead. A StringPool is 
further used to unique collector names, which are extremely
likely to be unique per process.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44769 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 03:18:06 +00:00
Gordon Henriksen
38200692fa Upgrading this test to 2.0 .ll syntax.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44738 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09 15:03:01 +00:00
Chris Lattner
d96428597b Fix a significant code quality regression I introduced on PPC64 quite
a while ago.  We now produce:

_foo:
	mflr r0
	std r0, 16(r1)
	ld r2, 16(r1)
	std r2, 0(r3)
	ld r0, 16(r1)
	mtlr r0
	blr 

instead of:

_foo:
	mflr r0
	std r0, 16(r1)
	lis r0, 0
	ori r0, r0, 16
	ldx r2, r1, r0
	std r2, 0(r3)
	ld r0, 16(r1)
	mtlr r0
	blr 

for:

void foo(void **X) {
  *X = __builtin_return_address(0);
}

on ppc64.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44701 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 07:04:58 +00:00
Chris Lattner
3fc027df4f implement __builtin_return_addr(0) on ppc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44700 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 06:59:59 +00:00
Evan Cheng
8a86c3f3ae Much improved v8i16 shuffles. (Step 1).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44676 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07 08:07:39 +00:00
Evan Cheng
a97159336d New test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44672 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07 01:48:46 +00:00
Evan Cheng
b0e370abdf Fix a bogus test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44668 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 22:12:45 +00:00
Evan Cheng
33faddc35d Turning simple splitting on. Start testing new coalescer heuristics as new llcbeta.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44660 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 08:54:31 +00:00