1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl -mattr=+avx512bw | FileCheck %s
4 define <64 x i8> @test1(i8 * %addr) {
7 ; CHECK-NEXT: vmovups (%rdi), %zmm0
9 %vaddr = bitcast i8* %addr to <64 x i8>*
10 %res = load <64 x i8>, <64 x i8>* %vaddr, align 1
14 define void @test2(i8 * %addr, <64 x i8> %data) {
17 ; CHECK-NEXT: vmovups %zmm0, (%rdi)
19 %vaddr = bitcast i8* %addr to <64 x i8>*
20 store <64 x i8>%data, <64 x i8>* %vaddr, align 1
24 define <64 x i8> @test3(i8 * %addr, <64 x i8> %old, <64 x i8> %mask1) {
27 ; CHECK-NEXT: vptestmb %zmm1, %zmm1, %k1
28 ; CHECK-NEXT: vmovdqu8 (%rdi), %zmm0 {%k1}
30 %mask = icmp ne <64 x i8> %mask1, zeroinitializer
31 %vaddr = bitcast i8* %addr to <64 x i8>*
32 %r = load <64 x i8>, <64 x i8>* %vaddr, align 1
33 %res = select <64 x i1> %mask, <64 x i8> %r, <64 x i8> %old
37 define <64 x i8> @test4(i8 * %addr, <64 x i8> %mask1) {
40 ; CHECK-NEXT: vptestmb %zmm0, %zmm0, %k1
41 ; CHECK-NEXT: vmovdqu8 (%rdi), %zmm0 {%k1} {z}
43 %mask = icmp ne <64 x i8> %mask1, zeroinitializer
44 %vaddr = bitcast i8* %addr to <64 x i8>*
45 %r = load <64 x i8>, <64 x i8>* %vaddr, align 1
46 %res = select <64 x i1> %mask, <64 x i8> %r, <64 x i8> zeroinitializer
50 define <32 x i16> @test5(i8 * %addr) {
53 ; CHECK-NEXT: vmovups (%rdi), %zmm0
55 %vaddr = bitcast i8* %addr to <32 x i16>*
56 %res = load <32 x i16>, <32 x i16>* %vaddr, align 1
60 define void @test6(i8 * %addr, <32 x i16> %data) {
63 ; CHECK-NEXT: vmovups %zmm0, (%rdi)
65 %vaddr = bitcast i8* %addr to <32 x i16>*
66 store <32 x i16>%data, <32 x i16>* %vaddr, align 1
70 define <32 x i16> @test7(i8 * %addr, <32 x i16> %old, <32 x i16> %mask1) {
73 ; CHECK-NEXT: vptestmw %zmm1, %zmm1, %k1
74 ; CHECK-NEXT: vmovdqu16 (%rdi), %zmm0 {%k1}
76 %mask = icmp ne <32 x i16> %mask1, zeroinitializer
77 %vaddr = bitcast i8* %addr to <32 x i16>*
78 %r = load <32 x i16>, <32 x i16>* %vaddr, align 1
79 %res = select <32 x i1> %mask, <32 x i16> %r, <32 x i16> %old
83 define <32 x i16> @test8(i8 * %addr, <32 x i16> %mask1) {
86 ; CHECK-NEXT: vptestmw %zmm0, %zmm0, %k1
87 ; CHECK-NEXT: vmovdqu16 (%rdi), %zmm0 {%k1} {z}
89 %mask = icmp ne <32 x i16> %mask1, zeroinitializer
90 %vaddr = bitcast i8* %addr to <32 x i16>*
91 %r = load <32 x i16>, <32 x i16>* %vaddr, align 1
92 %res = select <32 x i1> %mask, <32 x i16> %r, <32 x i16> zeroinitializer
96 define <16 x i8> @test_mask_load_16xi8(<16 x i1> %mask, <16 x i8>* %addr, <16 x i8> %val) {
97 ; CHECK-LABEL: test_mask_load_16xi8:
99 ; CHECK-NEXT: vpsllw $7, %xmm0, %xmm0
100 ; CHECK-NEXT: vpmovb2m %zmm0, %k0
101 ; CHECK-NEXT: kmovw %k0, %k1
102 ; CHECK-NEXT: vmovdqu8 (%rdi), %zmm0 {%k1} {z}
103 ; CHECK-NEXT: ## kill: def $xmm0 killed $xmm0 killed $zmm0
105 %res = call <16 x i8> @llvm.masked.load.v16i8(<16 x i8>* %addr, i32 4, <16 x i1>%mask, <16 x i8> undef)
108 declare <16 x i8> @llvm.masked.load.v16i8(<16 x i8>*, i32, <16 x i1>, <16 x i8>)
110 define <32 x i8> @test_mask_load_32xi8(<32 x i1> %mask, <32 x i8>* %addr, <32 x i8> %val) {
111 ; CHECK-LABEL: test_mask_load_32xi8:
113 ; CHECK-NEXT: vpsllw $7, %ymm0, %ymm0
114 ; CHECK-NEXT: vpmovb2m %zmm0, %k0
115 ; CHECK-NEXT: kmovd %k0, %k1
116 ; CHECK-NEXT: vmovdqu8 (%rdi), %zmm0 {%k1} {z}
117 ; CHECK-NEXT: ## kill: def $ymm0 killed $ymm0 killed $zmm0
119 %res = call <32 x i8> @llvm.masked.load.v32i8(<32 x i8>* %addr, i32 4, <32 x i1>%mask, <32 x i8> zeroinitializer)
122 declare <32 x i8> @llvm.masked.load.v32i8(<32 x i8>*, i32, <32 x i1>, <32 x i8>)
124 define <8 x i16> @test_mask_load_8xi16(<8 x i1> %mask, <8 x i16>* %addr, <8 x i16> %val) {
125 ; CHECK-LABEL: test_mask_load_8xi16:
127 ; CHECK-NEXT: vpsllw $15, %xmm0, %xmm0
128 ; CHECK-NEXT: vpmovw2m %zmm0, %k0
129 ; CHECK-NEXT: kshiftld $24, %k0, %k0
130 ; CHECK-NEXT: kshiftrd $24, %k0, %k1
131 ; CHECK-NEXT: vmovdqu16 (%rdi), %zmm0 {%k1} {z}
132 ; CHECK-NEXT: ## kill: def $xmm0 killed $xmm0 killed $zmm0
134 %res = call <8 x i16> @llvm.masked.load.v8i16(<8 x i16>* %addr, i32 4, <8 x i1>%mask, <8 x i16> undef)
137 declare <8 x i16> @llvm.masked.load.v8i16(<8 x i16>*, i32, <8 x i1>, <8 x i16>)
139 define <16 x i16> @test_mask_load_16xi16(<16 x i1> %mask, <16 x i16>* %addr, <16 x i16> %val) {
140 ; CHECK-LABEL: test_mask_load_16xi16:
142 ; CHECK-NEXT: vpsllw $7, %xmm0, %xmm0
143 ; CHECK-NEXT: vpmovb2m %zmm0, %k0
144 ; CHECK-NEXT: kmovw %k0, %k1
145 ; CHECK-NEXT: vmovdqu16 (%rdi), %zmm0 {%k1} {z}
146 ; CHECK-NEXT: ## kill: def $ymm0 killed $ymm0 killed $zmm0
148 %res = call <16 x i16> @llvm.masked.load.v16i16(<16 x i16>* %addr, i32 4, <16 x i1>%mask, <16 x i16> zeroinitializer)
151 declare <16 x i16> @llvm.masked.load.v16i16(<16 x i16>*, i32, <16 x i1>, <16 x i16>)
153 define void @test_mask_store_16xi8(<16 x i1> %mask, <16 x i8>* %addr, <16 x i8> %val) {
154 ; CHECK-LABEL: test_mask_store_16xi8:
156 ; CHECK-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
157 ; CHECK-NEXT: vpsllw $7, %xmm0, %xmm0
158 ; CHECK-NEXT: vpmovb2m %zmm0, %k0
159 ; CHECK-NEXT: kmovw %k0, %k1
160 ; CHECK-NEXT: vmovdqu8 %zmm1, (%rdi) {%k1}
162 call void @llvm.masked.store.v16i8(<16 x i8> %val, <16 x i8>* %addr, i32 4, <16 x i1>%mask)
165 declare void @llvm.masked.store.v16i8(<16 x i8>, <16 x i8>*, i32, <16 x i1>)
167 define void @test_mask_store_32xi8(<32 x i1> %mask, <32 x i8>* %addr, <32 x i8> %val) {
168 ; CHECK-LABEL: test_mask_store_32xi8:
170 ; CHECK-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
171 ; CHECK-NEXT: vpsllw $7, %ymm0, %ymm0
172 ; CHECK-NEXT: vpmovb2m %zmm0, %k0
173 ; CHECK-NEXT: kmovd %k0, %k1
174 ; CHECK-NEXT: vmovdqu8 %zmm1, (%rdi) {%k1}
176 call void @llvm.masked.store.v32i8(<32 x i8> %val, <32 x i8>* %addr, i32 4, <32 x i1>%mask)
179 declare void @llvm.masked.store.v32i8(<32 x i8>, <32 x i8>*, i32, <32 x i1>)
181 define void @test_mask_store_8xi16(<8 x i1> %mask, <8 x i16>* %addr, <8 x i16> %val) {
182 ; CHECK-LABEL: test_mask_store_8xi16:
184 ; CHECK-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
185 ; CHECK-NEXT: vpsllw $15, %xmm0, %xmm0
186 ; CHECK-NEXT: vpmovw2m %zmm0, %k0
187 ; CHECK-NEXT: kshiftld $24, %k0, %k0
188 ; CHECK-NEXT: kshiftrd $24, %k0, %k1
189 ; CHECK-NEXT: vmovdqu16 %zmm1, (%rdi) {%k1}
191 call void @llvm.masked.store.v8i16(<8 x i16> %val, <8 x i16>* %addr, i32 4, <8 x i1>%mask)
194 declare void @llvm.masked.store.v8i16(<8 x i16>, <8 x i16>*, i32, <8 x i1>)
196 define void @test_mask_store_16xi16(<16 x i1> %mask, <16 x i16>* %addr, <16 x i16> %val) {
197 ; CHECK-LABEL: test_mask_store_16xi16:
199 ; CHECK-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
200 ; CHECK-NEXT: vpsllw $7, %xmm0, %xmm0
201 ; CHECK-NEXT: vpmovb2m %zmm0, %k0
202 ; CHECK-NEXT: kmovw %k0, %k1
203 ; CHECK-NEXT: vmovdqu16 %zmm1, (%rdi) {%k1}
205 call void @llvm.masked.store.v16i16(<16 x i16> %val, <16 x i16>* %addr, i32 4, <16 x i1>%mask)
208 declare void @llvm.masked.store.v16i16(<16 x i16>, <16 x i16>*, i32, <16 x i1>)