Add a triple to switch.ll test.
[oota-llvm.git] / test / CodeGen / X86 / vec_trunc_sext.ll
1 ; RUN: llc %s -mtriple=x86_64-unknown-unknown -mattr='-sse4.1' -o - | FileCheck %s -check-prefix=NO_SSE_41
2 ; RUN: llc %s -mtriple=x86_64-unknown-unknown -mattr='+sse4.1' -o - | FileCheck %s -check-prefix=SSE_41
3
4 ; PR20472 ( http://llvm.org/bugs/show_bug.cgi?id=20472 )
5 ; When sexting a trunc'd vector value, we can't eliminate the zext.
6 ; If we don't have SSE4.1, use punpck.
7 ; If we have SSE4.1, use pmovzx because it combines the load op.
8 ; There may be a better way to do this using pshufb + pmovsx,
9 ; but that is beyond our current codegen capabilities.
10
11 define <4 x i32> @trunc_sext(<4 x i16>* %in) {
12   %load = load <4 x i16>, <4 x i16>* %in
13   %trunc = trunc <4 x i16> %load to <4 x i8>
14   %sext = sext <4 x i8> %trunc to <4 x i32>
15   ret <4 x i32> %sext
16
17 ; NO_SSE_41-LABEL: trunc_sext:
18 ; NO_SSE_41: movq (%rdi), %xmm0
19 ; NO_SSE_41-NEXT: punpcklwd %xmm0, %xmm0
20 ; NO_SSE_41-NEXT: pslld $24, %xmm0
21 ; NO_SSE_41-NEXT: psrad $24, %xmm0
22 ; NO_SSE_41-NEXT: retq
23
24 ; SSE_41-LABEL: trunc_sext:
25 ; SSE_41: pmovzxwd (%rdi), %xmm0
26 ; SSE_41-NEXT: pslld $24, %xmm0
27 ; SSE_41-NEXT: psrad $24, %xmm0
28 ; SSE_41-NEXT: retq
29 }
30