1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=sse2 | FileCheck %s --check-prefix=SSE
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx | FileCheck %s --check-prefix=AVX
5 ; Verify that we select the correct version of the instruction that stores the low 64-bits
6 ; of a 128-bit vector. We want to avoid int/fp domain crossing penalties, so ignore the
7 ; bitcast ops and choose:
13 define void @store_floats(<4 x float> %x, i64* %p) {
14 ; SSE-LABEL: store_floats:
16 ; SSE-NEXT: addps %xmm0, %xmm0
17 ; SSE-NEXT: movlps %xmm0, (%rdi)
20 ; AVX-LABEL: store_floats:
22 ; AVX-NEXT: vaddps %xmm0, %xmm0, %xmm0
23 ; AVX-NEXT: vmovlps %xmm0, (%rdi)
25 %a = fadd <4 x float> %x, %x
26 %b = shufflevector <4 x float> %a, <4 x float> undef, <2 x i32> <i32 0, i32 1>
27 %c = bitcast <2 x float> %b to i64
32 define void @store_double(<2 x double> %x, i64* %p) {
33 ; SSE-LABEL: store_double:
35 ; SSE-NEXT: addsd %xmm0, %xmm0
36 ; SSE-NEXT: movsd %xmm0, (%rdi)
39 ; AVX-LABEL: store_double:
41 ; AVX-NEXT: vaddsd %xmm0, %xmm0, %xmm0
42 ; AVX-NEXT: vmovsd %xmm0, (%rdi)
44 %a = fadd <2 x double> %x, %x
45 %b = extractelement <2 x double> %a, i32 0
46 %c = bitcast double %b to i64
51 define void @store_int(<4 x i32> %x, <2 x float>* %p) {
52 ; SSE-LABEL: store_int:
54 ; SSE-NEXT: paddd %xmm0, %xmm0
55 ; SSE-NEXT: movq %xmm0, (%rdi)
58 ; AVX-LABEL: store_int:
60 ; AVX-NEXT: vpaddd %xmm0, %xmm0, %xmm0
61 ; AVX-NEXT: vmovq %xmm0, (%rdi)
63 %a = add <4 x i32> %x, %x
64 %b = shufflevector <4 x i32> %a, <4 x i32> undef, <2 x i32> <i32 0, i32 1>
65 %c = bitcast <2 x i32> %b to <2 x float>
66 store <2 x float> %c, <2 x float>* %p
70 define void @store_h_double(<2 x double> %x, i64* %p) {
71 ; SSE-LABEL: store_h_double:
73 ; SSE-NEXT: addpd %xmm0, %xmm0
74 ; SSE-NEXT: movhpd %xmm0, (%rdi)
77 ; AVX-LABEL: store_h_double:
79 ; AVX-NEXT: vaddpd %xmm0, %xmm0, %xmm0
80 ; AVX-NEXT: vmovhpd %xmm0, (%rdi)
82 %a = fadd <2 x double> %x, %x
83 %b = extractelement <2 x double> %a, i32 1
84 %c = bitcast double %b to i64