CodeGen peephole: fold redundant phys reg copies
[oota-llvm.git] / test / CodeGen / X86 / fast-isel-nontemporal.ll
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+sse2 -fast-isel -O0 < %s | FileCheck %s --check-prefix=ALL --check-prefix=SSE --check-prefix=SSE2
3 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+sse4a -fast-isel -O0 < %s | FileCheck %s --check-prefix=ALL --check-prefix=SSE --check-prefix=SSE4A
4 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx -fast-isel -O0 < %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX
5
6 define void @test_nti32(i32* nocapture %ptr, i32 %X) {
7 ; ALL-LABEL: test_nti32:
8 ; ALL:       # BB#0: # %entry
9 ; ALL-NEXT:    movntil %esi, (%rdi)
10 ; ALL-NEXT:    retq
11 entry:
12   store i32 %X, i32* %ptr, align 4, !nontemporal !1
13   ret void
14 }
15
16 define void @test_nti64(i64* nocapture %ptr, i64 %X) {
17 ; ALL-LABEL: test_nti64:
18 ; ALL:       # BB#0: # %entry
19 ; ALL-NEXT:    movntiq %rsi, (%rdi)
20 ; ALL-NEXT:    retq
21 entry:
22   store i64 %X, i64* %ptr, align 8, !nontemporal !1
23   ret void
24 }
25
26 define void @test_ntfloat(float* nocapture %ptr, float %X) {
27 ; SSE2-LABEL: test_ntfloat:
28 ; SSE2:       # BB#0: # %entry
29 ; SSE2-NEXT:    movss %xmm0, (%rdi)
30 ; SSE2-NEXT:    retq
31 ;
32 ; SSE4A-LABEL: test_ntfloat:
33 ; SSE4A:       # BB#0: # %entry
34 ; SSE4A-NEXT:    movntss %xmm0, (%rdi)
35 ; SSE4A-NEXT:    retq
36 ;
37 ; AVX-LABEL: test_ntfloat:
38 ; AVX:       # BB#0: # %entry
39 ; AVX-NEXT:    vmovss %xmm0, (%rdi)
40 ; AVX-NEXT:    retq
41 entry:
42   store float %X, float* %ptr, align 4, !nontemporal !1
43   ret void
44 }
45
46 define void @test_ntdouble(double* nocapture %ptr, double %X) {
47 ; SSE2-LABEL: test_ntdouble:
48 ; SSE2:       # BB#0: # %entry
49 ; SSE2-NEXT:    movsd %xmm0, (%rdi)
50 ; SSE2-NEXT:    retq
51 ;
52 ; SSE4A-LABEL: test_ntdouble:
53 ; SSE4A:       # BB#0: # %entry
54 ; SSE4A-NEXT:    movntsd %xmm0, (%rdi)
55 ; SSE4A-NEXT:    retq
56 ;
57 ; AVX-LABEL: test_ntdouble:
58 ; AVX:       # BB#0: # %entry
59 ; AVX-NEXT:    vmovsd %xmm0, (%rdi)
60 ; AVX-NEXT:    retq
61 entry:
62   store double %X, double* %ptr, align 8, !nontemporal !1
63   ret void
64 }
65
66 define void @test_nt4xfloat(<4 x float>* nocapture %ptr, <4 x float> %X) {
67 ; SSE-LABEL: test_nt4xfloat:
68 ; SSE:       # BB#0: # %entry
69 ; SSE-NEXT:    movntps %xmm0, (%rdi)
70 ; SSE-NEXT:    retq
71 ;
72 ; AVX-LABEL: test_nt4xfloat:
73 ; AVX:       # BB#0: # %entry
74 ; AVX-NEXT:    vmovntps %xmm0, (%rdi)
75 ; AVX-NEXT:    retq
76 entry:
77   store <4 x float> %X, <4 x float>* %ptr, align 16, !nontemporal !1
78   ret void
79 }
80
81 define void @test_nt2xdouble(<2 x double>* nocapture %ptr, <2 x double> %X) {
82 ; SSE-LABEL: test_nt2xdouble:
83 ; SSE:       # BB#0: # %entry
84 ; SSE-NEXT:    movntpd %xmm0, (%rdi)
85 ; SSE-NEXT:    retq
86 ;
87 ; AVX-LABEL: test_nt2xdouble:
88 ; AVX:       # BB#0: # %entry
89 ; AVX-NEXT:    vmovntpd %xmm0, (%rdi)
90 ; AVX-NEXT:    retq
91 entry:
92   store <2 x double> %X, <2 x double>* %ptr, align 16, !nontemporal !1
93   ret void
94 }
95
96 define void @test_nt2xi64(<2 x i64>* nocapture %ptr, <2 x i64> %X) {
97 ; SSE-LABEL: test_nt2xi64:
98 ; SSE:       # BB#0: # %entry
99 ; SSE-NEXT:    movntdq %xmm0, (%rdi)
100 ; SSE-NEXT:    retq
101 ;
102 ; AVX-LABEL: test_nt2xi64:
103 ; AVX:       # BB#0: # %entry
104 ; AVX-NEXT:    vmovntdq %xmm0, (%rdi)
105 ; AVX-NEXT:    retq
106 entry:
107   store <2 x i64> %X, <2 x i64>* %ptr, align 16, !nontemporal !1
108   ret void
109 }
110
111 !1 = !{i32 1}