[X86][AVX2] Missing AVX2 memory folding instructions
[oota-llvm.git] / test / CodeGen / X86 / vector-shuffle-mmx.ll
1 ; RUN: llc < %s -mtriple=i686-darwin -mattr=+mmx,+sse2 | FileCheck -check-prefix=X32 %s
2 ; RUN: llc < %s -mtriple=x86_64-darwin -mattr=+mmx,+sse2 | FileCheck -check-prefix=X64 %s
3
4 ; If there is no explicit MMX type usage, always promote to XMM.
5
6 define void @test0(<1 x i64>* %x) {
7 ; X32-LABEL: test0
8 ; X64-LABEL: test0
9 ; X32: pshufd $213
10 ; X64: pshufd $213
11 ; X32-NEXT: movlpd %xmm
12 ; X64-NEXT: movq %xmm
13 entry:
14   %tmp2 = load <1 x i64>* %x
15   %tmp6 = bitcast <1 x i64> %tmp2 to <2 x i32>
16   %tmp9 = shufflevector <2 x i32> %tmp6, <2 x i32> undef, <2 x i32> < i32 1, i32 1 >
17   %tmp10 = bitcast <2 x i32> %tmp9 to <1 x i64>
18   store <1 x i64> %tmp10, <1 x i64>* %x
19   ret void
20 }
21
22 define void @test1() {
23 ; X32-LABEL: test1:
24 ; X32:    pshuflw
25 ; X32-NEXT:    pshufhw
26 ; X32-NEXT:    pshufd
27 ; X32:    maskmovq
28 entry:
29   %tmp528 = bitcast <8 x i8> zeroinitializer to <2 x i32>
30   %tmp529 = and <2 x i32> %tmp528, bitcast (<4 x i16> < i16 -32640, i16 16448, i16 8224, i16 4112 > to <2 x i32>)
31   %tmp542 = bitcast <2 x i32> %tmp529 to <4 x i16>
32   %tmp543 = add <4 x i16> %tmp542, < i16 0, i16 16448, i16 24672, i16 28784 >
33   %tmp555 = bitcast <4 x i16> %tmp543 to <8 x i8>
34   %tmp556 = bitcast <8 x i8> %tmp555 to x86_mmx
35   %tmp557 = bitcast <8 x i8> zeroinitializer to x86_mmx
36   tail call void @llvm.x86.mmx.maskmovq( x86_mmx %tmp557, x86_mmx %tmp556, i8* null)
37   ret void
38 }
39
40 @tmp_V2i = common global <2 x i32> zeroinitializer
41
42 define void @test2() nounwind {
43 ; X32-LABEL: test2:
44 ; X32:    movsd
45 ; X32-NEXT:    movlhps {{.*#+}} xmm0 = xmm0[0,0]
46 ; X32-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
47 ; X32-NEXT:    movlpd %xmm0, (%eax)
48 entry:
49   %0 = load <2 x i32>* @tmp_V2i, align 8
50   %1 = shufflevector <2 x i32> %0, <2 x i32> undef, <2 x i32> zeroinitializer
51   store <2 x i32> %1, <2 x i32>* @tmp_V2i, align 8
52   ret void
53 }
54
55 declare void @llvm.x86.mmx.maskmovq(x86_mmx, x86_mmx, i8*)