1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=-slow-unaligned-mem-16 | FileCheck %s --check-prefix=FAST
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+slow-unaligned-mem-16 | FileCheck %s --check-prefix=SLOW
4 ; Verify that the DAGCombiner is creating unaligned 16-byte loads and stores
5 ; if and only if those are fast.
7 define void @merge_const_vec_store(i64* %ptr) {
8 ; FAST-LABEL: merge_const_vec_store:
10 ; FAST-NEXT: xorps %xmm0, %xmm0
11 ; FAST-NEXT: movups %xmm0, (%rdi)
14 ; SLOW-LABEL: merge_const_vec_store:
16 ; SLOW-NEXT: movq $0, (%rdi)
17 ; SLOW-NEXT: movq $0, 8(%rdi)
20 %idx0 = getelementptr i64, i64* %ptr, i64 0
21 %idx1 = getelementptr i64, i64* %ptr, i64 1
23 store i64 0, i64* %idx0, align 8
24 store i64 0, i64* %idx1, align 8
29 define void @merge_vec_element_store(<4 x double> %v, double* %ptr) {
30 ; FAST-LABEL: merge_vec_element_store:
32 ; FAST-NEXT: movups %xmm0, (%rdi)
35 ; SLOW-LABEL: merge_vec_element_store:
37 ; SLOW-NEXT: movlpd %xmm0, (%rdi)
38 ; SLOW-NEXT: movhpd %xmm0, 8(%rdi)
41 %vecext0 = extractelement <4 x double> %v, i32 0
42 %vecext1 = extractelement <4 x double> %v, i32 1
44 %idx0 = getelementptr double, double* %ptr, i64 0
45 %idx1 = getelementptr double, double* %ptr, i64 1
47 store double %vecext0, double* %idx0, align 8
48 store double %vecext1, double* %idx1, align 8
53 ;; TODO: FAST *should* be:
54 ;; movups (%rdi), %xmm0
55 ;; movups %xmm0, 40(%rdi)
56 ;; ..but is not currently. See the UseAA FIXME in DAGCombiner.cpp
59 define void @merge_vec_load_and_stores(i64 *%ptr) {
60 ; FAST-LABEL: merge_vec_load_and_stores:
62 ; FAST-NEXT: movq (%rdi), %rax
63 ; FAST-NEXT: movq 8(%rdi), %rcx
64 ; FAST-NEXT: movq %rax, 40(%rdi)
65 ; FAST-NEXT: movq %rcx, 48(%rdi)
68 ; SLOW-LABEL: merge_vec_load_and_stores:
70 ; SLOW-NEXT: movq (%rdi), %rax
71 ; SLOW-NEXT: movq 8(%rdi), %rcx
72 ; SLOW-NEXT: movq %rax, 40(%rdi)
73 ; SLOW-NEXT: movq %rcx, 48(%rdi)
76 %idx0 = getelementptr i64, i64* %ptr, i64 0
77 %idx1 = getelementptr i64, i64* %ptr, i64 1
79 %ld0 = load i64, i64* %idx0, align 4
80 %ld1 = load i64, i64* %idx1, align 4
82 %idx4 = getelementptr i64, i64* %ptr, i64 5
83 %idx5 = getelementptr i64, i64* %ptr, i64 6
85 store i64 %ld0, i64* %idx4, align 4
86 store i64 %ld1, i64* %idx5, align 4