a5873be6f27f27c5f2f55c90ab1fdad7b7b8598a
[oota-llvm.git] / test / CodeGen / X86 / exedeps-movq.ll
1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=sse2 | FileCheck %s --check-prefix=SSE
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx | FileCheck %s --check-prefix=AVX
3
4 ; Verify that we select the correct version of the instruction that stores the low 64-bits
5 ; of a 128-bit vector. We want to avoid int/fp domain crossing penalties, so ignore the
6 ; bitcast ops and choose:
7 ;
8 ; movlps for floats
9 ; movlpd for doubles
10 ; movq for integers
11
12 define void @store_floats(<4 x float> %x, i64* %p) {
13 ; SSE-LABEL: store_floats:
14 ; SSE:       # BB#0:
15 ; SSE-NEXT:    addps %xmm0, %xmm0
16 ; SSE-NEXT:    movlps %xmm0, (%rdi)
17 ; SSE-NEXT:    retq
18 ;
19 ; AVX-LABEL: store_floats:
20 ; AVX:       # BB#0:
21 ; AVX-NEXT:    vaddps %xmm0, %xmm0, %xmm0
22 ; AVX-NEXT:    vmovlps %xmm0, (%rdi)
23 ; AVX-NEXT:    retq
24   %a = fadd <4 x float> %x, %x
25   %b = shufflevector <4 x float> %a, <4 x float> undef, <2 x i32> <i32 0, i32 1>
26   %c = bitcast <2 x float> %b to i64
27   store i64 %c, i64* %p
28   ret void
29 }
30
31 define void @store_double(<2 x double> %x, i64* %p) {
32 ; SSE-LABEL: store_double:
33 ; SSE:       # BB#0:
34 ; SSE-NEXT:    addpd %xmm0, %xmm0
35 ; SSE-NEXT:    movlpd %xmm0, (%rdi)
36 ; SSE-NEXT:    retq
37 ;
38 ; AVX-LABEL: store_double:
39 ; AVX:       # BB#0:
40 ; AVX-NEXT:    vaddpd %xmm0, %xmm0, %xmm0
41 ; AVX-NEXT:    vmovlpd %xmm0, (%rdi)
42 ; AVX-NEXT:    retq
43   %a = fadd <2 x double> %x, %x
44   %b = extractelement <2 x double> %a, i32 0
45   %c = bitcast double %b to i64
46   store i64 %c, i64* %p
47   ret void
48 }
49
50 define void @store_int(<4 x i32> %x, <2 x float>* %p) {
51 ; SSE-LABEL: store_int:
52 ; SSE:       # BB#0:
53 ; SSE-NEXT:    paddd %xmm0, %xmm0
54 ; SSE-NEXT:    movq %xmm0, (%rdi)
55 ; SSE-NEXT:    retq
56 ;
57 ; AVX-LABEL: store_int:
58 ; AVX:       # BB#0:
59 ; AVX-NEXT:    vpaddd %xmm0, %xmm0, %xmm0
60 ; AVX-NEXT:    vmovq %xmm0, (%rdi)
61 ; AVX-NEXT:    retq
62   %a = add <4 x i32> %x, %x
63   %b = shufflevector <4 x i32> %a, <4 x i32> undef, <2 x i32> <i32 0, i32 1>
64   %c = bitcast <2 x i32> %b to <2 x float>
65   store <2 x float> %c, <2 x float>* %p
66   ret void
67 }
68