llvm-6502/test
Jim Grosbach 49af380e3b x86: Move bitcasts outside concat_vector.
Consider the following:

typedef unsigned short ushort4U __attribute__((ext_vector_type(4),
aligned(2)));
typedef unsigned short ushort4 __attribute__((ext_vector_type(4)));
typedef unsigned short ushort8 __attribute__((ext_vector_type(8)));
typedef int int4 __attribute__((ext_vector_type(4)));

int4 __bbase_cvt_int(ushort4 v) {
  ushort8 a;
  a.lo = v;
  return _mm_cvtepu16_epi32(a);
}

This generates the, not unreasonable, IR:
define <4 x i32> @foo0(double %v.coerce) nounwind ssp {
  %tmp = bitcast double %v.coerce to <4 x i16>
  %tmp1 = shufflevector <4 x i16> %tmp, <4 x i16> undef, <8 x i32> <i32
  %0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
  %tmp2 = tail call <4 x i32> @llvm.x86.sse41.pmovzxwd(<8 x i16> %tmp1)
  ret <4 x i32> %tmp2
}

The problem is when type legalization gets hold of the v4i16. It
legalizes that by spilling to the stack, then doing a zero-extending
load. Things go even more silly from there, ending up with something
like:
_foo0:
  movsd %xmm0, -8(%rsp)       <== Spill to the stack.
  movq  -8(%rsp), %xmm0       <== Reload it right back out.
  pmovzxwd  %xmm0, %xmm1      <== Here's what we actually asked for.
  pblendw $1, %xmm1, %xmm0    <== We don't need this at all
  pmovzxwd  %xmm0, %xmm0      <== We already did this
  ret

The v8i8 to v8i16 zext intrinsic gives even worse results, with two
table lookups via pshufb instructions(!!).

To avoid all that, we can move the bitcasting until after we've formed
the wider (legal) vector type. Then our normal codegen flows along
nicely and we get the expected:
_foo0:
  pmovzxwd  %xmm0, %xmm0
  ret

rdar://15245794

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192866 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-17 02:58:06 +00:00
..
Analysis Remove the very substantial, largely unmaintained legacy PGO 2013-10-02 15:42:23 +00:00
Assembler Change objectsize intrinsic to accept different address spaces. 2013-10-07 18:06:48 +00:00
Bindings/Ocaml
Bitcode
BugPoint
CodeGen x86: Move bitcasts outside concat_vector. 2013-10-17 02:58:06 +00:00
DebugInfo According to the dwarf standard pubnames and pubtypes for languages 2013-10-17 02:06:06 +00:00
ExecutionEngine Fixing problems in lli's RemoteMemoryManager. 2013-10-11 22:47:10 +00:00
Feature
FileCheck Really fix CHECK-LABEL and CHECK-DAG interaction. This actually just restores the initial implementation that was in r186162 but got lost in some subsequent refactoring. More explicit variable names and comments are present now to hopefully prevent repeat regression, as well as another test. 2013-10-11 18:38:36 +00:00
Instrumentation [asan] Optimize accesses to global arrays with constant index 2013-10-16 14:06:14 +00:00
Integer
JitListener
Linker Debug Info: In DIBuilder, the derived-from field of a DW_TAG_pointer_type 2013-10-05 01:43:03 +00:00
LTO llvm/test/LTO should run also on cygwin. 2013-10-09 01:07:31 +00:00
MC Re-commit r192758 - MC: quote tricky symbol names in asm output 2013-10-17 01:13:02 +00:00
Object Create an atom with just the data that failed to disassemble. 2013-10-16 19:03:14 +00:00
Other
TableGen
tools [Mips] Teach llvm-readobj to print MIPS-specific ELF program headers. 2013-10-07 08:58:27 +00:00
Transforms SLPVectorizer: Don't vectorize volatile memory operations 2013-10-16 17:52:40 +00:00
Unit [tests] Update to use lit_config and lit package, as appropriate. 2013-08-09 16:22:05 +00:00
Verifier Add support for metadata representing .ident directives. 2013-10-16 01:49:05 +00:00
YAMLParser
CMakeLists.txt Fixing lli-child-target build 2013-10-02 22:27:23 +00:00
lit.cfg Remove the very substantial, largely unmaintained legacy PGO 2013-10-02 15:42:23 +00:00
lit.site.cfg.in
Makefile
Makefile.tests
TestRunner.sh