Commit Graph

1498 Commits

Author SHA1 Message Date
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