llvm-6502/lib
Chris Lattner 8a594489bf Fix a long standing deficiency in the X86 backend: we would
sometimes emit "zero" and "all one" vectors multiple times,
for example:

_test2:
	pcmpeqd	%mm0, %mm0
	movq	%mm0, _M1
	pcmpeqd	%mm0, %mm0
	movq	%mm0, _M2
	ret

instead of:

_test2:
	pcmpeqd	%mm0, %mm0
	movq	%mm0, _M1
	movq	%mm0, _M2
	ret

This patch fixes this by always arranging for zero/one vectors
to be defined as v4i32 or v2i32 (SSE/MMX) instead of letting them be
any random type.  This ensures they get trivially CSE'd on the dag.
This fix is also important for LegalizeDAGTypes, as it gets unhappy
when the x86 backend wants BUILD_VECTOR(i64 0) to be legal even when
'i64' isn't legal.

This patch makes the following changes:

1) X86TargetLowering::LowerBUILD_VECTOR now lowers 0/1 vectors into
   their canonical types.
2) The now-dead patterns are removed from the SSE/MMX .td files.
3) All the patterns in the .td file that referred to immAllOnesV or
   immAllZerosV in the wrong form now use *_bc to match them with a
   bitcast wrapped around them.
4) X86DAGToDAGISel::SelectScalarSSELoad is generalized to handle 
   bitcast'd zero vectors, which simplifies the code actually.
5) getShuffleVectorZeroOrUndef is updated to generate a shuffle that
   is legal, instead of generating one that is illegal and expecting
   a later legalize pass to clean it up.
6) isZeroShuffle is generalized to handle bitcast of zeros.
7) several other minor tweaks.

This patch is definite goodness, but has the potential to cause random
code quality regressions.  Please be on the lookout for these and let 
me know if they happen.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44310 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 00:24:49 +00:00
..
Analysis simplify some code. 2007-11-23 22:36:49 +00:00
Archive finishing touches of bytecode -> bitcode changes. also unbreak Windows 2007-07-06 20:28:40 +00:00
AsmParser Rename the 'const' parameter attribute to 'readnone', 2007-11-22 20:23:04 +00:00
Bitcode In order for parameter attribute uniquing to make 2007-11-20 14:09:29 +00:00
CodeGen Implement expand support for MERGE_VALUEs that only produces one result. 2007-11-24 19:12:15 +00:00
Debugger switch this to bitcode instead of bytecode 2007-05-06 09:29:13 +00:00
ExecutionEngine Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize. 2007-11-01 20:53:16 +00:00
Linker Use correct parentheses with the '&& "..."' idiom in an assert. 2007-10-08 15:13:30 +00:00
Support Fix PR1816, by correcting the broken definition of APInt::countTrailingZeros. 2007-11-23 22:42:31 +00:00
System This change does a couple of things. First it gets the Visual Studio builds working. 2007-11-21 00:37:56 +00:00
Target Fix a long standing deficiency in the X86 backend: we would 2007-11-25 00:24:49 +00:00
Transforms add a comment. 2007-11-23 22:35:18 +00:00
VMCore Rename the 'const' parameter attribute to 'readnone', 2007-11-22 20:23:04 +00:00
Makefile build lib/Archive instead of lib/Bytecode 2007-05-06 19:50:06 +00:00