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