1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/test
Chris Lattner 16a8f126d3 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.

llvm-svn: 46307
2008-01-24 08:07:48 +00:00
..
Analysis Accept both %y, %x and %x, %y as valid answers. 2008-01-06 03:12:44 +00:00
Archive Delete the svn:executable property on these files, which aren't executable. 2007-07-23 19:26:08 +00:00
Assembler Two occurrences on one line count as one... 2008-01-11 21:46:24 +00:00
Bindings/Ocaml Another backwards compatibility fix. 2007-12-30 22:48:58 +00:00
Bitcode Bring back int_x86_sse2_movl_dq intrinsic for backward compatibility. Make sure 2007-12-17 22:33:23 +00:00
BugPoint Convert .cvsignore files 2007-06-29 16:35:07 +00:00
C++Frontend new testcase for rdar://5685492 2008-01-13 00:19:57 +00:00
CFrontend New test. 2008-01-21 22:15:58 +00:00
CodeGen Significantly simplify and improve handling of FP function results on x86-32. 2008-01-24 08:07:48 +00:00
DebugInfo For PR1558: 2007-07-17 06:20:38 +00:00
ExecutionEngine Teach the interpreter to read and write memory in the 2007-12-14 19:38:31 +00:00
Feature Use not instead of ignore when an exit status is expected to always 2007-12-11 15:50:23 +00:00
FrontendAda Testcase for gimplify_expr crash caused by an 2008-01-15 19:55:41 +00:00
FrontendObjC Rename these tests to use the appropriate suffixes. 2007-12-11 15:55:52 +00:00
Integer Fix PR1146: parameter attributes are longer part of 2007-11-27 13:23:08 +00:00
lib Fix bug in regression tests that ignored stderr output in RUN lines. Updated tests and fixed broken run lines. 2007-11-28 04:57:00 +00:00
Linker Use not instead of ignore when an exit status is expected to always 2007-12-11 15:50:23 +00:00
Other New test. 2007-09-10 18:12:52 +00:00
Scripts Add a test script for counting lines. This can be used instead of the 2007-08-10 15:07:05 +00:00
TableGen Convert tests using "| wc -l | grep ..." to use the count script. 2007-08-15 13:36:28 +00:00
Transforms Multiply can be evaluated in a different type, so long as the target type has 2008-01-22 05:08:48 +00:00
Verifier update this test to pass with duncan's change. 2008-01-22 05:31:58 +00:00
Makefile remove attributions from the rest of the llvm makefiles. 2007-12-29 20:11:13 +00:00
Makefile.tests Failure.sh is dead, remove it. 2007-04-21 20:46:55 +00:00
TestRunner.sh Avoid an infinite loop when TestRunner.sh is run outside of the test dir. 2007-05-18 02:06:03 +00:00