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(ptr %addr) {
7 ; CHECK-NEXT: vmovups (%rdi), %zmm0
9 %res = load <64 x i8>, ptr %addr, align 1
13 define void @test2(ptr %addr, <64 x i8> %data) {
16 ; CHECK-NEXT: vmovups %zmm0, (%rdi)
18 store <64 x i8>%data, ptr %addr, align 1
22 define <64 x i8> @test3(ptr %addr, <64 x i8> %old, <64 x i8> %mask1) {
25 ; CHECK-NEXT: vptestmb %zmm1, %zmm1, %k1
26 ; CHECK-NEXT: vmovdqu8 (%rdi), %zmm0 {%k1}
28 %mask = icmp ne <64 x i8> %mask1, zeroinitializer
29 %r = load <64 x i8>, ptr %addr, align 1
30 %res = select <64 x i1> %mask, <64 x i8> %r, <64 x i8> %old
34 define <64 x i8> @test4(ptr %addr, <64 x i8> %mask1) {
37 ; CHECK-NEXT: vptestmb %zmm0, %zmm0, %k1
38 ; CHECK-NEXT: vmovdqu8 (%rdi), %zmm0 {%k1} {z}
40 %mask = icmp ne <64 x i8> %mask1, zeroinitializer
41 %r = load <64 x i8>, ptr %addr, align 1
42 %res = select <64 x i1> %mask, <64 x i8> %r, <64 x i8> zeroinitializer
46 define <32 x i16> @test5(ptr %addr) {
49 ; CHECK-NEXT: vmovups (%rdi), %zmm0
51 %res = load <32 x i16>, ptr %addr, align 1
55 define void @test6(ptr %addr, <32 x i16> %data) {
58 ; CHECK-NEXT: vmovups %zmm0, (%rdi)
60 store <32 x i16>%data, ptr %addr, align 1
64 define <32 x i16> @test7(ptr %addr, <32 x i16> %old, <32 x i16> %mask1) {
67 ; CHECK-NEXT: vptestmw %zmm1, %zmm1, %k1
68 ; CHECK-NEXT: vmovdqu16 (%rdi), %zmm0 {%k1}
70 %mask = icmp ne <32 x i16> %mask1, zeroinitializer
71 %r = load <32 x i16>, ptr %addr, align 1
72 %res = select <32 x i1> %mask, <32 x i16> %r, <32 x i16> %old
76 define <32 x i16> @test8(ptr %addr, <32 x i16> %mask1) {
79 ; CHECK-NEXT: vptestmw %zmm0, %zmm0, %k1
80 ; CHECK-NEXT: vmovdqu16 (%rdi), %zmm0 {%k1} {z}
82 %mask = icmp ne <32 x i16> %mask1, zeroinitializer
83 %r = load <32 x i16>, ptr %addr, align 1
84 %res = select <32 x i1> %mask, <32 x i16> %r, <32 x i16> zeroinitializer
88 define <16 x i8> @test_mask_load_16xi8(<16 x i1> %mask, ptr %addr, <16 x i8> %val) {
89 ; CHECK-LABEL: test_mask_load_16xi8:
91 ; CHECK-NEXT: vpsllw $7, %xmm0, %xmm0
92 ; CHECK-NEXT: vpmovb2m %zmm0, %k0
93 ; CHECK-NEXT: kmovw %k0, %k1
94 ; CHECK-NEXT: vmovdqu8 (%rdi), %zmm0 {%k1} {z}
95 ; CHECK-NEXT: ## kill: def $xmm0 killed $xmm0 killed $zmm0
97 %res = call <16 x i8> @llvm.masked.load.v16i8(ptr %addr, i32 4, <16 x i1>%mask, <16 x i8> undef)
100 declare <16 x i8> @llvm.masked.load.v16i8(ptr, i32, <16 x i1>, <16 x i8>)
102 define <32 x i8> @test_mask_load_32xi8(<32 x i1> %mask, ptr %addr, <32 x i8> %val) {
103 ; CHECK-LABEL: test_mask_load_32xi8:
105 ; CHECK-NEXT: vpsllw $7, %ymm0, %ymm0
106 ; CHECK-NEXT: vpmovb2m %zmm0, %k0
107 ; CHECK-NEXT: kmovd %k0, %k1
108 ; CHECK-NEXT: vmovdqu8 (%rdi), %zmm0 {%k1} {z}
109 ; CHECK-NEXT: ## kill: def $ymm0 killed $ymm0 killed $zmm0
111 %res = call <32 x i8> @llvm.masked.load.v32i8(ptr %addr, i32 4, <32 x i1>%mask, <32 x i8> zeroinitializer)
114 declare <32 x i8> @llvm.masked.load.v32i8(ptr, i32, <32 x i1>, <32 x i8>)
116 define <8 x i16> @test_mask_load_8xi16(<8 x i1> %mask, ptr %addr, <8 x i16> %val) {
117 ; CHECK-LABEL: test_mask_load_8xi16:
119 ; CHECK-NEXT: vpsllw $15, %xmm0, %xmm0
120 ; CHECK-NEXT: vpmovw2m %zmm0, %k0
121 ; CHECK-NEXT: kshiftld $24, %k0, %k0
122 ; CHECK-NEXT: kshiftrd $24, %k0, %k1
123 ; CHECK-NEXT: vmovdqu16 (%rdi), %zmm0 {%k1} {z}
124 ; CHECK-NEXT: ## kill: def $xmm0 killed $xmm0 killed $zmm0
126 %res = call <8 x i16> @llvm.masked.load.v8i16(ptr %addr, i32 4, <8 x i1>%mask, <8 x i16> undef)
129 declare <8 x i16> @llvm.masked.load.v8i16(ptr, i32, <8 x i1>, <8 x i16>)
131 define <16 x i16> @test_mask_load_16xi16(<16 x i1> %mask, ptr %addr, <16 x i16> %val) {
132 ; CHECK-LABEL: test_mask_load_16xi16:
134 ; CHECK-NEXT: vpsllw $7, %xmm0, %xmm0
135 ; CHECK-NEXT: vpmovb2m %zmm0, %k0
136 ; CHECK-NEXT: kmovw %k0, %k1
137 ; CHECK-NEXT: vmovdqu16 (%rdi), %zmm0 {%k1} {z}
138 ; CHECK-NEXT: ## kill: def $ymm0 killed $ymm0 killed $zmm0
140 %res = call <16 x i16> @llvm.masked.load.v16i16(ptr %addr, i32 4, <16 x i1>%mask, <16 x i16> zeroinitializer)
143 declare <16 x i16> @llvm.masked.load.v16i16(ptr, i32, <16 x i1>, <16 x i16>)
145 define void @test_mask_store_16xi8(<16 x i1> %mask, ptr %addr, <16 x i8> %val) {
146 ; CHECK-LABEL: test_mask_store_16xi8:
148 ; CHECK-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
149 ; CHECK-NEXT: vpsllw $7, %xmm0, %xmm0
150 ; CHECK-NEXT: vpmovb2m %zmm0, %k0
151 ; CHECK-NEXT: kmovw %k0, %k1
152 ; CHECK-NEXT: vmovdqu8 %zmm1, (%rdi) {%k1}
154 call void @llvm.masked.store.v16i8(<16 x i8> %val, ptr %addr, i32 4, <16 x i1>%mask)
157 declare void @llvm.masked.store.v16i8(<16 x i8>, ptr, i32, <16 x i1>)
159 define void @test_mask_store_32xi8(<32 x i1> %mask, ptr %addr, <32 x i8> %val) {
160 ; CHECK-LABEL: test_mask_store_32xi8:
162 ; CHECK-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
163 ; CHECK-NEXT: vpsllw $7, %ymm0, %ymm0
164 ; CHECK-NEXT: vpmovb2m %zmm0, %k0
165 ; CHECK-NEXT: kmovd %k0, %k1
166 ; CHECK-NEXT: vmovdqu8 %zmm1, (%rdi) {%k1}
168 call void @llvm.masked.store.v32i8(<32 x i8> %val, ptr %addr, i32 4, <32 x i1>%mask)
171 declare void @llvm.masked.store.v32i8(<32 x i8>, ptr, i32, <32 x i1>)
173 define void @test_mask_store_8xi16(<8 x i1> %mask, ptr %addr, <8 x i16> %val) {
174 ; CHECK-LABEL: test_mask_store_8xi16:
176 ; CHECK-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
177 ; CHECK-NEXT: vpsllw $15, %xmm0, %xmm0
178 ; CHECK-NEXT: vpmovw2m %zmm0, %k0
179 ; CHECK-NEXT: kshiftld $24, %k0, %k0
180 ; CHECK-NEXT: kshiftrd $24, %k0, %k1
181 ; CHECK-NEXT: vmovdqu16 %zmm1, (%rdi) {%k1}
183 call void @llvm.masked.store.v8i16(<8 x i16> %val, ptr %addr, i32 4, <8 x i1>%mask)
186 declare void @llvm.masked.store.v8i16(<8 x i16>, ptr, i32, <8 x i1>)
188 define void @test_mask_store_16xi16(<16 x i1> %mask, ptr %addr, <16 x i16> %val) {
189 ; CHECK-LABEL: test_mask_store_16xi16:
191 ; CHECK-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
192 ; CHECK-NEXT: vpsllw $7, %xmm0, %xmm0
193 ; CHECK-NEXT: vpmovb2m %zmm0, %k0
194 ; CHECK-NEXT: kmovw %k0, %k1
195 ; CHECK-NEXT: vmovdqu16 %zmm1, (%rdi) {%k1}
197 call void @llvm.masked.store.v16i16(<16 x i16> %val, ptr %addr, i32 4, <16 x i1>%mask)
200 declare void @llvm.masked.store.v16i16(<16 x i16>, ptr, i32, <16 x i1>)