1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefix=AVX --check-prefix=AVX512 --check-prefix=AVX512F
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bw | FileCheck %s --check-prefix=AVX --check-prefix=AVX512 --check-prefix=AVX512BW
9 define <8 x i64> @test_div7_8i64(<8 x i64> %a) nounwind {
10 ; AVX-LABEL: test_div7_8i64:
12 ; AVX-NEXT: vextracti32x4 $3, %zmm0, %xmm1
13 ; AVX-NEXT: vpextrq $1, %xmm1, %rcx
14 ; AVX-NEXT: movabsq $2635249153387078803, %rsi # imm = 0x2492492492492493
15 ; AVX-NEXT: movq %rcx, %rax
17 ; AVX-NEXT: subq %rdx, %rcx
19 ; AVX-NEXT: addq %rdx, %rcx
20 ; AVX-NEXT: vmovq %rcx, %xmm2
21 ; AVX-NEXT: vmovq %xmm1, %rcx
22 ; AVX-NEXT: movq %rcx, %rax
24 ; AVX-NEXT: subq %rdx, %rcx
26 ; AVX-NEXT: addq %rdx, %rcx
27 ; AVX-NEXT: vmovq %rcx, %xmm1
28 ; AVX-NEXT: vpunpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm2[0]
29 ; AVX-NEXT: vextracti32x4 $2, %zmm0, %xmm2
30 ; AVX-NEXT: vpextrq $1, %xmm2, %rcx
31 ; AVX-NEXT: movq %rcx, %rax
33 ; AVX-NEXT: subq %rdx, %rcx
35 ; AVX-NEXT: addq %rdx, %rcx
36 ; AVX-NEXT: vmovq %rcx, %xmm3
37 ; AVX-NEXT: vmovq %xmm2, %rcx
38 ; AVX-NEXT: movq %rcx, %rax
40 ; AVX-NEXT: subq %rdx, %rcx
42 ; AVX-NEXT: addq %rdx, %rcx
43 ; AVX-NEXT: vmovq %rcx, %xmm2
44 ; AVX-NEXT: vpunpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
45 ; AVX-NEXT: vinserti128 $1, %xmm1, %ymm2, %ymm1
46 ; AVX-NEXT: vextracti128 $1, %ymm0, %xmm2
47 ; AVX-NEXT: vpextrq $1, %xmm2, %rcx
48 ; AVX-NEXT: movq %rcx, %rax
50 ; AVX-NEXT: subq %rdx, %rcx
52 ; AVX-NEXT: addq %rdx, %rcx
53 ; AVX-NEXT: vmovq %rcx, %xmm3
54 ; AVX-NEXT: vmovq %xmm2, %rcx
55 ; AVX-NEXT: movq %rcx, %rax
57 ; AVX-NEXT: subq %rdx, %rcx
59 ; AVX-NEXT: addq %rdx, %rcx
60 ; AVX-NEXT: vmovq %rcx, %xmm2
61 ; AVX-NEXT: vpunpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
62 ; AVX-NEXT: vpextrq $1, %xmm0, %rcx
63 ; AVX-NEXT: movq %rcx, %rax
65 ; AVX-NEXT: subq %rdx, %rcx
67 ; AVX-NEXT: addq %rdx, %rcx
68 ; AVX-NEXT: vmovq %rcx, %xmm3
69 ; AVX-NEXT: vmovq %xmm0, %rcx
70 ; AVX-NEXT: movq %rcx, %rax
72 ; AVX-NEXT: subq %rdx, %rcx
74 ; AVX-NEXT: addq %rdx, %rcx
75 ; AVX-NEXT: vmovq %rcx, %xmm0
76 ; AVX-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm3[0]
77 ; AVX-NEXT: vinserti128 $1, %xmm2, %ymm0, %ymm0
78 ; AVX-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
79 ; AVX-NEXT: vpsrlq $2, %zmm0, %zmm0
81 %res = udiv <8 x i64> %a, <i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7>
85 define <16 x i32> @test_div7_16i32(<16 x i32> %a) nounwind {
86 ; AVX-LABEL: test_div7_16i32:
88 ; AVX-NEXT: vpbroadcastd {{.*#+}} zmm1 = [613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757]
89 ; AVX-NEXT: vpmuludq %zmm1, %zmm0, %zmm2
90 ; AVX-NEXT: vpshufd {{.*#+}} zmm3 = zmm0[1,1,3,3,5,5,7,7,9,9,11,11,13,13,15,15]
91 ; AVX-NEXT: vpmuludq %zmm1, %zmm3, %zmm1
92 ; AVX-NEXT: vmovdqa64 {{.*#+}} zmm3 = [1,17,3,19,5,21,7,23,9,25,11,27,13,29,15,31]
93 ; AVX-NEXT: vpermi2d %zmm1, %zmm2, %zmm3
94 ; AVX-NEXT: vpsubd %zmm3, %zmm0, %zmm0
95 ; AVX-NEXT: vpsrld $1, %zmm0, %zmm0
96 ; AVX-NEXT: vpaddd %zmm3, %zmm0, %zmm0
97 ; AVX-NEXT: vpsrld $2, %zmm0, %zmm0
99 %res = udiv <16 x i32> %a, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
103 define <32 x i16> @test_div7_32i16(<32 x i16> %a) nounwind {
104 ; AVX512F-LABEL: test_div7_32i16:
106 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm1
107 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm2 = [9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363]
108 ; AVX512F-NEXT: vpmulhuw %ymm2, %ymm1, %ymm3
109 ; AVX512F-NEXT: vpsubw %ymm3, %ymm1, %ymm1
110 ; AVX512F-NEXT: vpsrlw $1, %ymm1, %ymm1
111 ; AVX512F-NEXT: vpaddw %ymm3, %ymm1, %ymm1
112 ; AVX512F-NEXT: vpsrlw $2, %ymm1, %ymm1
113 ; AVX512F-NEXT: vpmulhuw %ymm2, %ymm0, %ymm2
114 ; AVX512F-NEXT: vpsubw %ymm2, %ymm0, %ymm0
115 ; AVX512F-NEXT: vpsrlw $1, %ymm0, %ymm0
116 ; AVX512F-NEXT: vpaddw %ymm2, %ymm0, %ymm0
117 ; AVX512F-NEXT: vpsrlw $2, %ymm0, %ymm0
118 ; AVX512F-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
121 ; AVX512BW-LABEL: test_div7_32i16:
123 ; AVX512BW-NEXT: vpmulhuw {{.*}}(%rip), %zmm0, %zmm1
124 ; AVX512BW-NEXT: vpsubw %zmm1, %zmm0, %zmm0
125 ; AVX512BW-NEXT: vpsrlw $1, %zmm0, %zmm0
126 ; AVX512BW-NEXT: vpaddw %zmm1, %zmm0, %zmm0
127 ; AVX512BW-NEXT: vpsrlw $2, %zmm0, %zmm0
128 ; AVX512BW-NEXT: retq
129 %res = udiv <32 x i16> %a, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
133 define <64 x i8> @test_div7_64i8(<64 x i8> %a) nounwind {
134 ; AVX512F-LABEL: test_div7_64i8:
136 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm1
137 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
138 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm1[8],ymm2[8],ymm1[9],ymm2[9],ymm1[10],ymm2[10],ymm1[11],ymm2[11],ymm1[12],ymm2[12],ymm1[13],ymm2[13],ymm1[14],ymm2[14],ymm1[15],ymm2[15],ymm1[24],ymm2[24],ymm1[25],ymm2[25],ymm1[26],ymm2[26],ymm1[27],ymm2[27],ymm1[28],ymm2[28],ymm1[29],ymm2[29],ymm1[30],ymm2[30],ymm1[31],ymm2[31]
139 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm4 = [37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37]
140 ; AVX512F-NEXT: vpmullw %ymm4, %ymm3, %ymm3
141 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
142 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm5 = ymm1[0],ymm2[0],ymm1[1],ymm2[1],ymm1[2],ymm2[2],ymm1[3],ymm2[3],ymm1[4],ymm2[4],ymm1[5],ymm2[5],ymm1[6],ymm2[6],ymm1[7],ymm2[7],ymm1[16],ymm2[16],ymm1[17],ymm2[17],ymm1[18],ymm2[18],ymm1[19],ymm2[19],ymm1[20],ymm2[20],ymm1[21],ymm2[21],ymm1[22],ymm2[22],ymm1[23],ymm2[23]
143 ; AVX512F-NEXT: vpmullw %ymm4, %ymm5, %ymm5
144 ; AVX512F-NEXT: vpsrlw $8, %ymm5, %ymm5
145 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm5, %ymm3
146 ; AVX512F-NEXT: vpsubb %ymm3, %ymm1, %ymm1
147 ; AVX512F-NEXT: vpsrlw $1, %ymm1, %ymm1
148 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm5 = [127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127]
149 ; AVX512F-NEXT: vpand %ymm5, %ymm1, %ymm1
150 ; AVX512F-NEXT: vpaddb %ymm3, %ymm1, %ymm1
151 ; AVX512F-NEXT: vpsrlw $2, %ymm1, %ymm1
152 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm3 = [63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63]
153 ; AVX512F-NEXT: vpand %ymm3, %ymm1, %ymm1
154 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm6 = ymm0[8],ymm2[8],ymm0[9],ymm2[9],ymm0[10],ymm2[10],ymm0[11],ymm2[11],ymm0[12],ymm2[12],ymm0[13],ymm2[13],ymm0[14],ymm2[14],ymm0[15],ymm2[15],ymm0[24],ymm2[24],ymm0[25],ymm2[25],ymm0[26],ymm2[26],ymm0[27],ymm2[27],ymm0[28],ymm2[28],ymm0[29],ymm2[29],ymm0[30],ymm2[30],ymm0[31],ymm2[31]
155 ; AVX512F-NEXT: vpmullw %ymm4, %ymm6, %ymm6
156 ; AVX512F-NEXT: vpsrlw $8, %ymm6, %ymm6
157 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm2 = ymm0[0],ymm2[0],ymm0[1],ymm2[1],ymm0[2],ymm2[2],ymm0[3],ymm2[3],ymm0[4],ymm2[4],ymm0[5],ymm2[5],ymm0[6],ymm2[6],ymm0[7],ymm2[7],ymm0[16],ymm2[16],ymm0[17],ymm2[17],ymm0[18],ymm2[18],ymm0[19],ymm2[19],ymm0[20],ymm2[20],ymm0[21],ymm2[21],ymm0[22],ymm2[22],ymm0[23],ymm2[23]
158 ; AVX512F-NEXT: vpmullw %ymm4, %ymm2, %ymm2
159 ; AVX512F-NEXT: vpsrlw $8, %ymm2, %ymm2
160 ; AVX512F-NEXT: vpackuswb %ymm6, %ymm2, %ymm2
161 ; AVX512F-NEXT: vpsubb %ymm2, %ymm0, %ymm0
162 ; AVX512F-NEXT: vpsrlw $1, %ymm0, %ymm0
163 ; AVX512F-NEXT: vpand %ymm5, %ymm0, %ymm0
164 ; AVX512F-NEXT: vpaddb %ymm2, %ymm0, %ymm0
165 ; AVX512F-NEXT: vpsrlw $2, %ymm0, %ymm0
166 ; AVX512F-NEXT: vpand %ymm3, %ymm0, %ymm0
167 ; AVX512F-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
170 ; AVX512BW-LABEL: test_div7_64i8:
172 ; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
173 ; AVX512BW-NEXT: vpunpckhbw {{.*#+}} zmm2 = zmm0[8],zmm1[8],zmm0[9],zmm1[9],zmm0[10],zmm1[10],zmm0[11],zmm1[11],zmm0[12],zmm1[12],zmm0[13],zmm1[13],zmm0[14],zmm1[14],zmm0[15],zmm1[15],zmm0[24],zmm1[24],zmm0[25],zmm1[25],zmm0[26],zmm1[26],zmm0[27],zmm1[27],zmm0[28],zmm1[28],zmm0[29],zmm1[29],zmm0[30],zmm1[30],zmm0[31],zmm1[31],zmm0[40],zmm1[40],zmm0[41],zmm1[41],zmm0[42],zmm1[42],zmm0[43],zmm1[43],zmm0[44],zmm1[44],zmm0[45],zmm1[45],zmm0[46],zmm1[46],zmm0[47],zmm1[47],zmm0[56],zmm1[56],zmm0[57],zmm1[57],zmm0[58],zmm1[58],zmm0[59],zmm1[59],zmm0[60],zmm1[60],zmm0[61],zmm1[61],zmm0[62],zmm1[62],zmm0[63],zmm1[63]
174 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37]
175 ; AVX512BW-NEXT: vpmullw %zmm3, %zmm2, %zmm2
176 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
177 ; AVX512BW-NEXT: vpunpcklbw {{.*#+}} zmm1 = zmm0[0],zmm1[0],zmm0[1],zmm1[1],zmm0[2],zmm1[2],zmm0[3],zmm1[3],zmm0[4],zmm1[4],zmm0[5],zmm1[5],zmm0[6],zmm1[6],zmm0[7],zmm1[7],zmm0[16],zmm1[16],zmm0[17],zmm1[17],zmm0[18],zmm1[18],zmm0[19],zmm1[19],zmm0[20],zmm1[20],zmm0[21],zmm1[21],zmm0[22],zmm1[22],zmm0[23],zmm1[23],zmm0[32],zmm1[32],zmm0[33],zmm1[33],zmm0[34],zmm1[34],zmm0[35],zmm1[35],zmm0[36],zmm1[36],zmm0[37],zmm1[37],zmm0[38],zmm1[38],zmm0[39],zmm1[39],zmm0[48],zmm1[48],zmm0[49],zmm1[49],zmm0[50],zmm1[50],zmm0[51],zmm1[51],zmm0[52],zmm1[52],zmm0[53],zmm1[53],zmm0[54],zmm1[54],zmm0[55],zmm1[55]
178 ; AVX512BW-NEXT: vpmullw %zmm3, %zmm1, %zmm1
179 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
180 ; AVX512BW-NEXT: vpackuswb %zmm2, %zmm1, %zmm1
181 ; AVX512BW-NEXT: vpsubb %zmm1, %zmm0, %zmm0
182 ; AVX512BW-NEXT: vpsrlw $1, %zmm0, %zmm0
183 ; AVX512BW-NEXT: vpandq {{.*}}(%rip), %zmm0, %zmm0
184 ; AVX512BW-NEXT: vpaddb %zmm1, %zmm0, %zmm0
185 ; AVX512BW-NEXT: vpsrlw $2, %zmm0, %zmm0
186 ; AVX512BW-NEXT: vpandq {{.*}}(%rip), %zmm0, %zmm0
187 ; AVX512BW-NEXT: retq
188 %res = udiv <64 x i8> %a, <i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7>
193 ; udiv by non-splat constant
196 define <64 x i8> @test_divconstant_64i8(<64 x i8> %a) nounwind {
197 ; AVX512F-LABEL: test_divconstant_64i8:
199 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm2
200 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
201 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm2[8],ymm1[8],ymm2[9],ymm1[9],ymm2[10],ymm1[10],ymm2[11],ymm1[11],ymm2[12],ymm1[12],ymm2[13],ymm1[13],ymm2[14],ymm1[14],ymm2[15],ymm1[15],ymm2[24],ymm1[24],ymm2[25],ymm1[25],ymm2[26],ymm1[26],ymm2[27],ymm1[27],ymm2[28],ymm1[28],ymm2[29],ymm1[29],ymm2[30],ymm1[30],ymm2[31],ymm1[31]
202 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
203 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
204 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
205 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
206 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm4 = ymm2[0],ymm1[0],ymm2[1],ymm1[1],ymm2[2],ymm1[2],ymm2[3],ymm1[3],ymm2[4],ymm1[4],ymm2[5],ymm1[5],ymm2[6],ymm1[6],ymm2[7],ymm1[7],ymm2[16],ymm1[16],ymm2[17],ymm1[17],ymm2[18],ymm1[18],ymm2[19],ymm1[19],ymm2[20],ymm1[20],ymm2[21],ymm1[21],ymm2[22],ymm1[22],ymm2[23],ymm1[23]
207 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
208 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
209 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
210 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
211 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm4, %ymm3
212 ; AVX512F-NEXT: vpsubb %ymm3, %ymm2, %ymm2
213 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm4 = ymm2[8],ymm1[8],ymm2[9],ymm1[9],ymm2[10],ymm1[10],ymm2[11],ymm1[11],ymm2[12],ymm1[12],ymm2[13],ymm1[13],ymm2[14],ymm1[14],ymm2[15],ymm1[15],ymm2[24],ymm1[24],ymm2[25],ymm1[25],ymm2[26],ymm1[26],ymm2[27],ymm1[27],ymm2[28],ymm1[28],ymm2[29],ymm1[29],ymm2[30],ymm1[30],ymm2[31],ymm1[31]
214 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
215 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
216 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm2 = ymm2[0],ymm1[0],ymm2[1],ymm1[1],ymm2[2],ymm1[2],ymm2[3],ymm1[3],ymm2[4],ymm1[4],ymm2[5],ymm1[5],ymm2[6],ymm1[6],ymm2[7],ymm1[7],ymm2[16],ymm1[16],ymm2[17],ymm1[17],ymm2[18],ymm1[18],ymm2[19],ymm1[19],ymm2[20],ymm1[20],ymm2[21],ymm1[21],ymm2[22],ymm1[22],ymm2[23],ymm1[23]
217 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm2, %ymm2
218 ; AVX512F-NEXT: vpsrlw $8, %ymm2, %ymm2
219 ; AVX512F-NEXT: vpackuswb %ymm4, %ymm2, %ymm2
220 ; AVX512F-NEXT: vpaddb %ymm3, %ymm2, %ymm2
221 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm2[8],ymm1[8],ymm2[9],ymm1[9],ymm2[10],ymm1[10],ymm2[11],ymm1[11],ymm2[12],ymm1[12],ymm2[13],ymm1[13],ymm2[14],ymm1[14],ymm2[15],ymm1[15],ymm2[24],ymm1[24],ymm2[25],ymm1[25],ymm2[26],ymm1[26],ymm2[27],ymm1[27],ymm2[28],ymm1[28],ymm2[29],ymm1[29],ymm2[30],ymm1[30],ymm2[31],ymm1[31]
222 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
223 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
224 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm2 = ymm2[0],ymm1[0],ymm2[1],ymm1[1],ymm2[2],ymm1[2],ymm2[3],ymm1[3],ymm2[4],ymm1[4],ymm2[5],ymm1[5],ymm2[6],ymm1[6],ymm2[7],ymm1[7],ymm2[16],ymm1[16],ymm2[17],ymm1[17],ymm2[18],ymm1[18],ymm2[19],ymm1[19],ymm2[20],ymm1[20],ymm2[21],ymm1[21],ymm2[22],ymm1[22],ymm2[23],ymm1[23]
225 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm2, %ymm2
226 ; AVX512F-NEXT: vpsrlw $8, %ymm2, %ymm2
227 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm2, %ymm2
228 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm0[8],ymm1[8],ymm0[9],ymm1[9],ymm0[10],ymm1[10],ymm0[11],ymm1[11],ymm0[12],ymm1[12],ymm0[13],ymm1[13],ymm0[14],ymm1[14],ymm0[15],ymm1[15],ymm0[24],ymm1[24],ymm0[25],ymm1[25],ymm0[26],ymm1[26],ymm0[27],ymm1[27],ymm0[28],ymm1[28],ymm0[29],ymm1[29],ymm0[30],ymm1[30],ymm0[31],ymm1[31]
229 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
230 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
231 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
232 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
233 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm4 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[2],ymm1[2],ymm0[3],ymm1[3],ymm0[4],ymm1[4],ymm0[5],ymm1[5],ymm0[6],ymm1[6],ymm0[7],ymm1[7],ymm0[16],ymm1[16],ymm0[17],ymm1[17],ymm0[18],ymm1[18],ymm0[19],ymm1[19],ymm0[20],ymm1[20],ymm0[21],ymm1[21],ymm0[22],ymm1[22],ymm0[23],ymm1[23]
234 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
235 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
236 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
237 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
238 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm4, %ymm3
239 ; AVX512F-NEXT: vpsubb %ymm3, %ymm0, %ymm0
240 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm4 = ymm0[8],ymm1[8],ymm0[9],ymm1[9],ymm0[10],ymm1[10],ymm0[11],ymm1[11],ymm0[12],ymm1[12],ymm0[13],ymm1[13],ymm0[14],ymm1[14],ymm0[15],ymm1[15],ymm0[24],ymm1[24],ymm0[25],ymm1[25],ymm0[26],ymm1[26],ymm0[27],ymm1[27],ymm0[28],ymm1[28],ymm0[29],ymm1[29],ymm0[30],ymm1[30],ymm0[31],ymm1[31]
241 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
242 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
243 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[2],ymm1[2],ymm0[3],ymm1[3],ymm0[4],ymm1[4],ymm0[5],ymm1[5],ymm0[6],ymm1[6],ymm0[7],ymm1[7],ymm0[16],ymm1[16],ymm0[17],ymm1[17],ymm0[18],ymm1[18],ymm0[19],ymm1[19],ymm0[20],ymm1[20],ymm0[21],ymm1[21],ymm0[22],ymm1[22],ymm0[23],ymm1[23]
244 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm0, %ymm0
245 ; AVX512F-NEXT: vpsrlw $8, %ymm0, %ymm0
246 ; AVX512F-NEXT: vpackuswb %ymm4, %ymm0, %ymm0
247 ; AVX512F-NEXT: vpaddb %ymm3, %ymm0, %ymm0
248 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm0[8],ymm1[8],ymm0[9],ymm1[9],ymm0[10],ymm1[10],ymm0[11],ymm1[11],ymm0[12],ymm1[12],ymm0[13],ymm1[13],ymm0[14],ymm1[14],ymm0[15],ymm1[15],ymm0[24],ymm1[24],ymm0[25],ymm1[25],ymm0[26],ymm1[26],ymm0[27],ymm1[27],ymm0[28],ymm1[28],ymm0[29],ymm1[29],ymm0[30],ymm1[30],ymm0[31],ymm1[31]
249 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
250 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
251 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[2],ymm1[2],ymm0[3],ymm1[3],ymm0[4],ymm1[4],ymm0[5],ymm1[5],ymm0[6],ymm1[6],ymm0[7],ymm1[7],ymm0[16],ymm1[16],ymm0[17],ymm1[17],ymm0[18],ymm1[18],ymm0[19],ymm1[19],ymm0[20],ymm1[20],ymm0[21],ymm1[21],ymm0[22],ymm1[22],ymm0[23],ymm1[23]
252 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm0, %ymm0
253 ; AVX512F-NEXT: vpsrlw $8, %ymm0, %ymm0
254 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm0, %ymm0
255 ; AVX512F-NEXT: vinserti64x4 $1, %ymm2, %zmm0, %zmm0
258 ; AVX512BW-LABEL: test_divconstant_64i8:
260 ; AVX512BW-NEXT: vpunpckhbw {{.*#+}} zmm1 = zmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,40,40,41,41,42,42,43,43,44,44,45,45,46,46,47,47,56,56,57,57,58,58,59,59,60,60,61,61,62,62,63,63]
261 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
262 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm1, %zmm1
263 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
264 ; AVX512BW-NEXT: vpunpcklbw {{.*#+}} zmm2 = zmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,48,48,49,49,50,50,51,51,52,52,53,53,54,54,55,55]
265 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
266 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm2, %zmm2
267 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
268 ; AVX512BW-NEXT: vpackuswb %zmm1, %zmm2, %zmm1
269 ; AVX512BW-NEXT: vpxor %xmm2, %xmm2, %xmm2
270 ; AVX512BW-NEXT: vpunpckhbw {{.*#+}} zmm3 = zmm1[8],zmm2[8],zmm1[9],zmm2[9],zmm1[10],zmm2[10],zmm1[11],zmm2[11],zmm1[12],zmm2[12],zmm1[13],zmm2[13],zmm1[14],zmm2[14],zmm1[15],zmm2[15],zmm1[24],zmm2[24],zmm1[25],zmm2[25],zmm1[26],zmm2[26],zmm1[27],zmm2[27],zmm1[28],zmm2[28],zmm1[29],zmm2[29],zmm1[30],zmm2[30],zmm1[31],zmm2[31],zmm1[40],zmm2[40],zmm1[41],zmm2[41],zmm1[42],zmm2[42],zmm1[43],zmm2[43],zmm1[44],zmm2[44],zmm1[45],zmm2[45],zmm1[46],zmm2[46],zmm1[47],zmm2[47],zmm1[56],zmm2[56],zmm1[57],zmm2[57],zmm1[58],zmm2[58],zmm1[59],zmm2[59],zmm1[60],zmm2[60],zmm1[61],zmm2[61],zmm1[62],zmm2[62],zmm1[63],zmm2[63]
271 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm3, %zmm3
272 ; AVX512BW-NEXT: vpsrlw $8, %zmm3, %zmm3
273 ; AVX512BW-NEXT: vpunpcklbw {{.*#+}} zmm1 = zmm1[0],zmm2[0],zmm1[1],zmm2[1],zmm1[2],zmm2[2],zmm1[3],zmm2[3],zmm1[4],zmm2[4],zmm1[5],zmm2[5],zmm1[6],zmm2[6],zmm1[7],zmm2[7],zmm1[16],zmm2[16],zmm1[17],zmm2[17],zmm1[18],zmm2[18],zmm1[19],zmm2[19],zmm1[20],zmm2[20],zmm1[21],zmm2[21],zmm1[22],zmm2[22],zmm1[23],zmm2[23],zmm1[32],zmm2[32],zmm1[33],zmm2[33],zmm1[34],zmm2[34],zmm1[35],zmm2[35],zmm1[36],zmm2[36],zmm1[37],zmm2[37],zmm1[38],zmm2[38],zmm1[39],zmm2[39],zmm1[48],zmm2[48],zmm1[49],zmm2[49],zmm1[50],zmm2[50],zmm1[51],zmm2[51],zmm1[52],zmm2[52],zmm1[53],zmm2[53],zmm1[54],zmm2[54],zmm1[55],zmm2[55]
274 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm1, %zmm1
275 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
276 ; AVX512BW-NEXT: vpackuswb %zmm3, %zmm1, %zmm1
277 ; AVX512BW-NEXT: vpsubb %zmm1, %zmm0, %zmm0
278 ; AVX512BW-NEXT: vpunpckhbw {{.*#+}} zmm3 = zmm0[8],zmm2[8],zmm0[9],zmm2[9],zmm0[10],zmm2[10],zmm0[11],zmm2[11],zmm0[12],zmm2[12],zmm0[13],zmm2[13],zmm0[14],zmm2[14],zmm0[15],zmm2[15],zmm0[24],zmm2[24],zmm0[25],zmm2[25],zmm0[26],zmm2[26],zmm0[27],zmm2[27],zmm0[28],zmm2[28],zmm0[29],zmm2[29],zmm0[30],zmm2[30],zmm0[31],zmm2[31],zmm0[40],zmm2[40],zmm0[41],zmm2[41],zmm0[42],zmm2[42],zmm0[43],zmm2[43],zmm0[44],zmm2[44],zmm0[45],zmm2[45],zmm0[46],zmm2[46],zmm0[47],zmm2[47],zmm0[56],zmm2[56],zmm0[57],zmm2[57],zmm0[58],zmm2[58],zmm0[59],zmm2[59],zmm0[60],zmm2[60],zmm0[61],zmm2[61],zmm0[62],zmm2[62],zmm0[63],zmm2[63]
279 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm3, %zmm3
280 ; AVX512BW-NEXT: vpsrlw $8, %zmm3, %zmm3
281 ; AVX512BW-NEXT: vpunpcklbw {{.*#+}} zmm0 = zmm0[0],zmm2[0],zmm0[1],zmm2[1],zmm0[2],zmm2[2],zmm0[3],zmm2[3],zmm0[4],zmm2[4],zmm0[5],zmm2[5],zmm0[6],zmm2[6],zmm0[7],zmm2[7],zmm0[16],zmm2[16],zmm0[17],zmm2[17],zmm0[18],zmm2[18],zmm0[19],zmm2[19],zmm0[20],zmm2[20],zmm0[21],zmm2[21],zmm0[22],zmm2[22],zmm0[23],zmm2[23],zmm0[32],zmm2[32],zmm0[33],zmm2[33],zmm0[34],zmm2[34],zmm0[35],zmm2[35],zmm0[36],zmm2[36],zmm0[37],zmm2[37],zmm0[38],zmm2[38],zmm0[39],zmm2[39],zmm0[48],zmm2[48],zmm0[49],zmm2[49],zmm0[50],zmm2[50],zmm0[51],zmm2[51],zmm0[52],zmm2[52],zmm0[53],zmm2[53],zmm0[54],zmm2[54],zmm0[55],zmm2[55]
282 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm0, %zmm0
283 ; AVX512BW-NEXT: vpsrlw $8, %zmm0, %zmm0
284 ; AVX512BW-NEXT: vpackuswb %zmm3, %zmm0, %zmm0
285 ; AVX512BW-NEXT: vpaddb %zmm1, %zmm0, %zmm0
286 ; AVX512BW-NEXT: vpunpckhbw {{.*#+}} zmm1 = zmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,40,40,41,41,42,42,43,43,44,44,45,45,46,46,47,47,56,56,57,57,58,58,59,59,60,60,61,61,62,62,63,63]
287 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
288 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm1, %zmm1
289 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
290 ; AVX512BW-NEXT: vpunpcklbw {{.*#+}} zmm0 = zmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,48,48,49,49,50,50,51,51,52,52,53,53,54,54,55,55]
291 ; AVX512BW-NEXT: vpsrlw $8, %zmm0, %zmm0
292 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm0, %zmm0
293 ; AVX512BW-NEXT: vpsrlw $8, %zmm0, %zmm0
294 ; AVX512BW-NEXT: vpackuswb %zmm1, %zmm0, %zmm0
295 ; AVX512BW-NEXT: retq
296 %res = udiv <64 x i8> %a, <i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 20, i8 21, i8 22, i8 23, i8 24, i8 25, i8 26, i8 27, i8 28, i8 29, i8 30, i8 31, i8 32, i8 33, i8 34, i8 35, i8 36, i8 37, i8 38, i8 38, i8 37, i8 36, i8 35, i8 34, i8 33, i8 32, i8 31, i8 30, i8 29, i8 28, i8 27, i8 26, i8 25, i8 24, i8 23, i8 22, i8 21, i8 20, i8 19, i8 18, i8 17, i8 16, i8 15, i8 14, i8 13, i8 12, i8 11, i8 10, i8 9, i8 8, i8 7>
304 define <8 x i64> @test_rem7_8i64(<8 x i64> %a) nounwind {
305 ; AVX-LABEL: test_rem7_8i64:
307 ; AVX-NEXT: vextracti32x4 $3, %zmm0, %xmm1
308 ; AVX-NEXT: vpextrq $1, %xmm1, %rcx
309 ; AVX-NEXT: movabsq $2635249153387078803, %rsi # imm = 0x2492492492492493
310 ; AVX-NEXT: movq %rcx, %rax
311 ; AVX-NEXT: mulq %rsi
312 ; AVX-NEXT: movq %rcx, %rax
313 ; AVX-NEXT: subq %rdx, %rax
314 ; AVX-NEXT: shrq %rax
315 ; AVX-NEXT: addq %rdx, %rax
316 ; AVX-NEXT: shrq $2, %rax
317 ; AVX-NEXT: leaq (,%rax,8), %rdx
318 ; AVX-NEXT: subq %rdx, %rax
319 ; AVX-NEXT: addq %rcx, %rax
320 ; AVX-NEXT: vmovq %rax, %xmm2
321 ; AVX-NEXT: vmovq %xmm1, %rcx
322 ; AVX-NEXT: movq %rcx, %rax
323 ; AVX-NEXT: mulq %rsi
324 ; AVX-NEXT: movq %rcx, %rax
325 ; AVX-NEXT: subq %rdx, %rax
326 ; AVX-NEXT: shrq %rax
327 ; AVX-NEXT: addq %rdx, %rax
328 ; AVX-NEXT: shrq $2, %rax
329 ; AVX-NEXT: leaq (,%rax,8), %rdx
330 ; AVX-NEXT: subq %rdx, %rax
331 ; AVX-NEXT: addq %rcx, %rax
332 ; AVX-NEXT: vmovq %rax, %xmm1
333 ; AVX-NEXT: vpunpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm2[0]
334 ; AVX-NEXT: vextracti32x4 $2, %zmm0, %xmm2
335 ; AVX-NEXT: vpextrq $1, %xmm2, %rcx
336 ; AVX-NEXT: movq %rcx, %rax
337 ; AVX-NEXT: mulq %rsi
338 ; AVX-NEXT: movq %rcx, %rax
339 ; AVX-NEXT: subq %rdx, %rax
340 ; AVX-NEXT: shrq %rax
341 ; AVX-NEXT: addq %rdx, %rax
342 ; AVX-NEXT: shrq $2, %rax
343 ; AVX-NEXT: leaq (,%rax,8), %rdx
344 ; AVX-NEXT: subq %rdx, %rax
345 ; AVX-NEXT: addq %rcx, %rax
346 ; AVX-NEXT: vmovq %rax, %xmm3
347 ; AVX-NEXT: vmovq %xmm2, %rcx
348 ; AVX-NEXT: movq %rcx, %rax
349 ; AVX-NEXT: mulq %rsi
350 ; AVX-NEXT: movq %rcx, %rax
351 ; AVX-NEXT: subq %rdx, %rax
352 ; AVX-NEXT: shrq %rax
353 ; AVX-NEXT: addq %rdx, %rax
354 ; AVX-NEXT: shrq $2, %rax
355 ; AVX-NEXT: leaq (,%rax,8), %rdx
356 ; AVX-NEXT: subq %rdx, %rax
357 ; AVX-NEXT: addq %rcx, %rax
358 ; AVX-NEXT: vmovq %rax, %xmm2
359 ; AVX-NEXT: vpunpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
360 ; AVX-NEXT: vinserti128 $1, %xmm1, %ymm2, %ymm1
361 ; AVX-NEXT: vextracti128 $1, %ymm0, %xmm2
362 ; AVX-NEXT: vpextrq $1, %xmm2, %rcx
363 ; AVX-NEXT: movq %rcx, %rax
364 ; AVX-NEXT: mulq %rsi
365 ; AVX-NEXT: movq %rcx, %rax
366 ; AVX-NEXT: subq %rdx, %rax
367 ; AVX-NEXT: shrq %rax
368 ; AVX-NEXT: addq %rdx, %rax
369 ; AVX-NEXT: shrq $2, %rax
370 ; AVX-NEXT: leaq (,%rax,8), %rdx
371 ; AVX-NEXT: subq %rdx, %rax
372 ; AVX-NEXT: addq %rcx, %rax
373 ; AVX-NEXT: vmovq %rax, %xmm3
374 ; AVX-NEXT: vmovq %xmm2, %rcx
375 ; AVX-NEXT: movq %rcx, %rax
376 ; AVX-NEXT: mulq %rsi
377 ; AVX-NEXT: movq %rcx, %rax
378 ; AVX-NEXT: subq %rdx, %rax
379 ; AVX-NEXT: shrq %rax
380 ; AVX-NEXT: addq %rdx, %rax
381 ; AVX-NEXT: shrq $2, %rax
382 ; AVX-NEXT: leaq (,%rax,8), %rdx
383 ; AVX-NEXT: subq %rdx, %rax
384 ; AVX-NEXT: addq %rcx, %rax
385 ; AVX-NEXT: vmovq %rax, %xmm2
386 ; AVX-NEXT: vpunpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
387 ; AVX-NEXT: vpextrq $1, %xmm0, %rcx
388 ; AVX-NEXT: movq %rcx, %rax
389 ; AVX-NEXT: mulq %rsi
390 ; AVX-NEXT: movq %rcx, %rax
391 ; AVX-NEXT: subq %rdx, %rax
392 ; AVX-NEXT: shrq %rax
393 ; AVX-NEXT: addq %rdx, %rax
394 ; AVX-NEXT: shrq $2, %rax
395 ; AVX-NEXT: leaq (,%rax,8), %rdx
396 ; AVX-NEXT: subq %rdx, %rax
397 ; AVX-NEXT: addq %rcx, %rax
398 ; AVX-NEXT: vmovq %rax, %xmm3
399 ; AVX-NEXT: vmovq %xmm0, %rcx
400 ; AVX-NEXT: movq %rcx, %rax
401 ; AVX-NEXT: mulq %rsi
402 ; AVX-NEXT: movq %rcx, %rax
403 ; AVX-NEXT: subq %rdx, %rax
404 ; AVX-NEXT: shrq %rax
405 ; AVX-NEXT: addq %rdx, %rax
406 ; AVX-NEXT: shrq $2, %rax
407 ; AVX-NEXT: leaq (,%rax,8), %rdx
408 ; AVX-NEXT: subq %rdx, %rax
409 ; AVX-NEXT: addq %rcx, %rax
410 ; AVX-NEXT: vmovq %rax, %xmm0
411 ; AVX-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm3[0]
412 ; AVX-NEXT: vinserti128 $1, %xmm2, %ymm0, %ymm0
413 ; AVX-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
415 %res = urem <8 x i64> %a, <i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7>
419 define <16 x i32> @test_rem7_16i32(<16 x i32> %a) nounwind {
420 ; AVX-LABEL: test_rem7_16i32:
422 ; AVX-NEXT: vpbroadcastd {{.*#+}} zmm1 = [613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757]
423 ; AVX-NEXT: vpmuludq %zmm1, %zmm0, %zmm2
424 ; AVX-NEXT: vpshufd {{.*#+}} zmm3 = zmm0[1,1,3,3,5,5,7,7,9,9,11,11,13,13,15,15]
425 ; AVX-NEXT: vpmuludq %zmm1, %zmm3, %zmm1
426 ; AVX-NEXT: vmovdqa64 {{.*#+}} zmm3 = [1,17,3,19,5,21,7,23,9,25,11,27,13,29,15,31]
427 ; AVX-NEXT: vpermi2d %zmm1, %zmm2, %zmm3
428 ; AVX-NEXT: vpsubd %zmm3, %zmm0, %zmm1
429 ; AVX-NEXT: vpsrld $1, %zmm1, %zmm1
430 ; AVX-NEXT: vpaddd %zmm3, %zmm1, %zmm1
431 ; AVX-NEXT: vpsrld $2, %zmm1, %zmm1
432 ; AVX-NEXT: vpmulld {{.*}}(%rip){1to16}, %zmm1, %zmm1
433 ; AVX-NEXT: vpsubd %zmm1, %zmm0, %zmm0
435 %res = urem <16 x i32> %a, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
439 define <32 x i16> @test_rem7_32i16(<32 x i16> %a) nounwind {
440 ; AVX512F-LABEL: test_rem7_32i16:
442 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm1
443 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm2 = [9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363]
444 ; AVX512F-NEXT: vpmulhuw %ymm2, %ymm1, %ymm3
445 ; AVX512F-NEXT: vpsubw %ymm3, %ymm1, %ymm4
446 ; AVX512F-NEXT: vpsrlw $1, %ymm4, %ymm4
447 ; AVX512F-NEXT: vpaddw %ymm3, %ymm4, %ymm3
448 ; AVX512F-NEXT: vpsrlw $2, %ymm3, %ymm3
449 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm4 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
450 ; AVX512F-NEXT: vpmullw %ymm4, %ymm3, %ymm3
451 ; AVX512F-NEXT: vpsubw %ymm3, %ymm1, %ymm1
452 ; AVX512F-NEXT: vpmulhuw %ymm2, %ymm0, %ymm2
453 ; AVX512F-NEXT: vpsubw %ymm2, %ymm0, %ymm3
454 ; AVX512F-NEXT: vpsrlw $1, %ymm3, %ymm3
455 ; AVX512F-NEXT: vpaddw %ymm2, %ymm3, %ymm2
456 ; AVX512F-NEXT: vpsrlw $2, %ymm2, %ymm2
457 ; AVX512F-NEXT: vpmullw %ymm4, %ymm2, %ymm2
458 ; AVX512F-NEXT: vpsubw %ymm2, %ymm0, %ymm0
459 ; AVX512F-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
462 ; AVX512BW-LABEL: test_rem7_32i16:
464 ; AVX512BW-NEXT: vpmulhuw {{.*}}(%rip), %zmm0, %zmm1
465 ; AVX512BW-NEXT: vpsubw %zmm1, %zmm0, %zmm2
466 ; AVX512BW-NEXT: vpsrlw $1, %zmm2, %zmm2
467 ; AVX512BW-NEXT: vpaddw %zmm1, %zmm2, %zmm1
468 ; AVX512BW-NEXT: vpsrlw $2, %zmm1, %zmm1
469 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm1, %zmm1
470 ; AVX512BW-NEXT: vpsubw %zmm1, %zmm0, %zmm0
471 ; AVX512BW-NEXT: retq
472 %res = urem <32 x i16> %a, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
476 define <64 x i8> @test_rem7_64i8(<64 x i8> %a) nounwind {
477 ; AVX512F-LABEL: test_rem7_64i8:
479 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm1
480 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
481 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm1[8],ymm2[8],ymm1[9],ymm2[9],ymm1[10],ymm2[10],ymm1[11],ymm2[11],ymm1[12],ymm2[12],ymm1[13],ymm2[13],ymm1[14],ymm2[14],ymm1[15],ymm2[15],ymm1[24],ymm2[24],ymm1[25],ymm2[25],ymm1[26],ymm2[26],ymm1[27],ymm2[27],ymm1[28],ymm2[28],ymm1[29],ymm2[29],ymm1[30],ymm2[30],ymm1[31],ymm2[31]
482 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm4 = [37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37]
483 ; AVX512F-NEXT: vpmullw %ymm4, %ymm3, %ymm3
484 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
485 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm5 = ymm1[0],ymm2[0],ymm1[1],ymm2[1],ymm1[2],ymm2[2],ymm1[3],ymm2[3],ymm1[4],ymm2[4],ymm1[5],ymm2[5],ymm1[6],ymm2[6],ymm1[7],ymm2[7],ymm1[16],ymm2[16],ymm1[17],ymm2[17],ymm1[18],ymm2[18],ymm1[19],ymm2[19],ymm1[20],ymm2[20],ymm1[21],ymm2[21],ymm1[22],ymm2[22],ymm1[23],ymm2[23]
486 ; AVX512F-NEXT: vpmullw %ymm4, %ymm5, %ymm5
487 ; AVX512F-NEXT: vpsrlw $8, %ymm5, %ymm5
488 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm5, %ymm3
489 ; AVX512F-NEXT: vpsubb %ymm3, %ymm1, %ymm5
490 ; AVX512F-NEXT: vpsrlw $1, %ymm5, %ymm5
491 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm6 = [127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127]
492 ; AVX512F-NEXT: vpand %ymm6, %ymm5, %ymm5
493 ; AVX512F-NEXT: vpaddb %ymm3, %ymm5, %ymm3
494 ; AVX512F-NEXT: vpsrlw $2, %ymm3, %ymm3
495 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm5 = [63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63]
496 ; AVX512F-NEXT: vpand %ymm5, %ymm3, %ymm3
497 ; AVX512F-NEXT: vpsllw $3, %ymm3, %ymm7
498 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm8 = [248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248]
499 ; AVX512F-NEXT: vpand %ymm8, %ymm7, %ymm7
500 ; AVX512F-NEXT: vpsubb %ymm7, %ymm3, %ymm3
501 ; AVX512F-NEXT: vpaddb %ymm3, %ymm1, %ymm1
502 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm0[8],ymm2[8],ymm0[9],ymm2[9],ymm0[10],ymm2[10],ymm0[11],ymm2[11],ymm0[12],ymm2[12],ymm0[13],ymm2[13],ymm0[14],ymm2[14],ymm0[15],ymm2[15],ymm0[24],ymm2[24],ymm0[25],ymm2[25],ymm0[26],ymm2[26],ymm0[27],ymm2[27],ymm0[28],ymm2[28],ymm0[29],ymm2[29],ymm0[30],ymm2[30],ymm0[31],ymm2[31]
503 ; AVX512F-NEXT: vpmullw %ymm4, %ymm3, %ymm3
504 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
505 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm2 = ymm0[0],ymm2[0],ymm0[1],ymm2[1],ymm0[2],ymm2[2],ymm0[3],ymm2[3],ymm0[4],ymm2[4],ymm0[5],ymm2[5],ymm0[6],ymm2[6],ymm0[7],ymm2[7],ymm0[16],ymm2[16],ymm0[17],ymm2[17],ymm0[18],ymm2[18],ymm0[19],ymm2[19],ymm0[20],ymm2[20],ymm0[21],ymm2[21],ymm0[22],ymm2[22],ymm0[23],ymm2[23]
506 ; AVX512F-NEXT: vpmullw %ymm4, %ymm2, %ymm2
507 ; AVX512F-NEXT: vpsrlw $8, %ymm2, %ymm2
508 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm2, %ymm2
509 ; AVX512F-NEXT: vpsubb %ymm2, %ymm0, %ymm3
510 ; AVX512F-NEXT: vpsrlw $1, %ymm3, %ymm3
511 ; AVX512F-NEXT: vpand %ymm6, %ymm3, %ymm3
512 ; AVX512F-NEXT: vpaddb %ymm2, %ymm3, %ymm2
513 ; AVX512F-NEXT: vpsrlw $2, %ymm2, %ymm2
514 ; AVX512F-NEXT: vpand %ymm5, %ymm2, %ymm2
515 ; AVX512F-NEXT: vpsllw $3, %ymm2, %ymm3
516 ; AVX512F-NEXT: vpand %ymm8, %ymm3, %ymm3
517 ; AVX512F-NEXT: vpsubb %ymm3, %ymm2, %ymm2
518 ; AVX512F-NEXT: vpaddb %ymm2, %ymm0, %ymm0
519 ; AVX512F-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
522 ; AVX512BW-LABEL: test_rem7_64i8:
524 ; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
525 ; AVX512BW-NEXT: vpunpckhbw {{.*#+}} zmm2 = zmm0[8],zmm1[8],zmm0[9],zmm1[9],zmm0[10],zmm1[10],zmm0[11],zmm1[11],zmm0[12],zmm1[12],zmm0[13],zmm1[13],zmm0[14],zmm1[14],zmm0[15],zmm1[15],zmm0[24],zmm1[24],zmm0[25],zmm1[25],zmm0[26],zmm1[26],zmm0[27],zmm1[27],zmm0[28],zmm1[28],zmm0[29],zmm1[29],zmm0[30],zmm1[30],zmm0[31],zmm1[31],zmm0[40],zmm1[40],zmm0[41],zmm1[41],zmm0[42],zmm1[42],zmm0[43],zmm1[43],zmm0[44],zmm1[44],zmm0[45],zmm1[45],zmm0[46],zmm1[46],zmm0[47],zmm1[47],zmm0[56],zmm1[56],zmm0[57],zmm1[57],zmm0[58],zmm1[58],zmm0[59],zmm1[59],zmm0[60],zmm1[60],zmm0[61],zmm1[61],zmm0[62],zmm1[62],zmm0[63],zmm1[63]
526 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37]
527 ; AVX512BW-NEXT: vpmullw %zmm3, %zmm2, %zmm2
528 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
529 ; AVX512BW-NEXT: vpunpcklbw {{.*#+}} zmm1 = zmm0[0],zmm1[0],zmm0[1],zmm1[1],zmm0[2],zmm1[2],zmm0[3],zmm1[3],zmm0[4],zmm1[4],zmm0[5],zmm1[5],zmm0[6],zmm1[6],zmm0[7],zmm1[7],zmm0[16],zmm1[16],zmm0[17],zmm1[17],zmm0[18],zmm1[18],zmm0[19],zmm1[19],zmm0[20],zmm1[20],zmm0[21],zmm1[21],zmm0[22],zmm1[22],zmm0[23],zmm1[23],zmm0[32],zmm1[32],zmm0[33],zmm1[33],zmm0[34],zmm1[34],zmm0[35],zmm1[35],zmm0[36],zmm1[36],zmm0[37],zmm1[37],zmm0[38],zmm1[38],zmm0[39],zmm1[39],zmm0[48],zmm1[48],zmm0[49],zmm1[49],zmm0[50],zmm1[50],zmm0[51],zmm1[51],zmm0[52],zmm1[52],zmm0[53],zmm1[53],zmm0[54],zmm1[54],zmm0[55],zmm1[55]
530 ; AVX512BW-NEXT: vpmullw %zmm3, %zmm1, %zmm1
531 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
532 ; AVX512BW-NEXT: vpackuswb %zmm2, %zmm1, %zmm1
533 ; AVX512BW-NEXT: vpsubb %zmm1, %zmm0, %zmm2
534 ; AVX512BW-NEXT: vpsrlw $1, %zmm2, %zmm2
535 ; AVX512BW-NEXT: vpandq {{.*}}(%rip), %zmm2, %zmm2
536 ; AVX512BW-NEXT: vpaddb %zmm1, %zmm2, %zmm1
537 ; AVX512BW-NEXT: vpsrlw $2, %zmm1, %zmm1
538 ; AVX512BW-NEXT: vpandq {{.*}}(%rip), %zmm1, %zmm1
539 ; AVX512BW-NEXT: vpsllw $3, %zmm1, %zmm2
540 ; AVX512BW-NEXT: vpandq {{.*}}(%rip), %zmm2, %zmm2
541 ; AVX512BW-NEXT: vpsubb %zmm2, %zmm1, %zmm1
542 ; AVX512BW-NEXT: vpaddb %zmm1, %zmm0, %zmm0
543 ; AVX512BW-NEXT: retq
544 %res = urem <64 x i8> %a, <i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7>
549 ; urem by non-splat constant
552 define <64 x i8> @test_remconstant_64i8(<64 x i8> %a) nounwind {
553 ; AVX512F-LABEL: test_remconstant_64i8:
555 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm3
556 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
557 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm2 = ymm3[8],ymm1[8],ymm3[9],ymm1[9],ymm3[10],ymm1[10],ymm3[11],ymm1[11],ymm3[12],ymm1[12],ymm3[13],ymm1[13],ymm3[14],ymm1[14],ymm3[15],ymm1[15],ymm3[24],ymm1[24],ymm3[25],ymm1[25],ymm3[26],ymm1[26],ymm3[27],ymm1[27],ymm3[28],ymm1[28],ymm3[29],ymm1[29],ymm3[30],ymm1[30],ymm3[31],ymm1[31]
558 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm2, %ymm2
559 ; AVX512F-NEXT: vpsrlw $8, %ymm2, %ymm2
560 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm2, %ymm2
561 ; AVX512F-NEXT: vpsrlw $8, %ymm2, %ymm2
562 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm4 = ymm3[0],ymm1[0],ymm3[1],ymm1[1],ymm3[2],ymm1[2],ymm3[3],ymm1[3],ymm3[4],ymm1[4],ymm3[5],ymm1[5],ymm3[6],ymm1[6],ymm3[7],ymm1[7],ymm3[16],ymm1[16],ymm3[17],ymm1[17],ymm3[18],ymm1[18],ymm3[19],ymm1[19],ymm3[20],ymm1[20],ymm3[21],ymm1[21],ymm3[22],ymm1[22],ymm3[23],ymm1[23]
563 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
564 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
565 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
566 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
567 ; AVX512F-NEXT: vpackuswb %ymm2, %ymm4, %ymm2
568 ; AVX512F-NEXT: vpsubb %ymm2, %ymm3, %ymm4
569 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm5 = ymm4[8],ymm1[8],ymm4[9],ymm1[9],ymm4[10],ymm1[10],ymm4[11],ymm1[11],ymm4[12],ymm1[12],ymm4[13],ymm1[13],ymm4[14],ymm1[14],ymm4[15],ymm1[15],ymm4[24],ymm1[24],ymm4[25],ymm1[25],ymm4[26],ymm1[26],ymm4[27],ymm1[27],ymm4[28],ymm1[28],ymm4[29],ymm1[29],ymm4[30],ymm1[30],ymm4[31],ymm1[31]
570 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm5, %ymm5
571 ; AVX512F-NEXT: vpsrlw $8, %ymm5, %ymm5
572 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm4 = ymm4[0],ymm1[0],ymm4[1],ymm1[1],ymm4[2],ymm1[2],ymm4[3],ymm1[3],ymm4[4],ymm1[4],ymm4[5],ymm1[5],ymm4[6],ymm1[6],ymm4[7],ymm1[7],ymm4[16],ymm1[16],ymm4[17],ymm1[17],ymm4[18],ymm1[18],ymm4[19],ymm1[19],ymm4[20],ymm1[20],ymm4[21],ymm1[21],ymm4[22],ymm1[22],ymm4[23],ymm1[23]
573 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
574 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
575 ; AVX512F-NEXT: vpackuswb %ymm5, %ymm4, %ymm4
576 ; AVX512F-NEXT: vpaddb %ymm2, %ymm4, %ymm4
577 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm2 = ymm4[8],ymm1[8],ymm4[9],ymm1[9],ymm4[10],ymm1[10],ymm4[11],ymm1[11],ymm4[12],ymm1[12],ymm4[13],ymm1[13],ymm4[14],ymm1[14],ymm4[15],ymm1[15],ymm4[24],ymm1[24],ymm4[25],ymm1[25],ymm4[26],ymm1[26],ymm4[27],ymm1[27],ymm4[28],ymm1[28],ymm4[29],ymm1[29],ymm4[30],ymm1[30],ymm4[31],ymm1[31]
578 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm2, %ymm2
579 ; AVX512F-NEXT: vpsrlw $8, %ymm2, %ymm2
580 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm2, %ymm5
581 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm2 = [255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]
582 ; AVX512F-NEXT: vpand %ymm2, %ymm5, %ymm5
583 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm4 = ymm4[0],ymm1[0],ymm4[1],ymm1[1],ymm4[2],ymm1[2],ymm4[3],ymm1[3],ymm4[4],ymm1[4],ymm4[5],ymm1[5],ymm4[6],ymm1[6],ymm4[7],ymm1[7],ymm4[16],ymm1[16],ymm4[17],ymm1[17],ymm4[18],ymm1[18],ymm4[19],ymm1[19],ymm4[20],ymm1[20],ymm4[21],ymm1[21],ymm4[22],ymm1[22],ymm4[23],ymm1[23]
584 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
585 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
586 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
587 ; AVX512F-NEXT: vpand %ymm2, %ymm4, %ymm4
588 ; AVX512F-NEXT: vpackuswb %ymm5, %ymm4, %ymm4
589 ; AVX512F-NEXT: vpsubb %ymm4, %ymm3, %ymm3
590 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm4 = ymm0[8],ymm1[8],ymm0[9],ymm1[9],ymm0[10],ymm1[10],ymm0[11],ymm1[11],ymm0[12],ymm1[12],ymm0[13],ymm1[13],ymm0[14],ymm1[14],ymm0[15],ymm1[15],ymm0[24],ymm1[24],ymm0[25],ymm1[25],ymm0[26],ymm1[26],ymm0[27],ymm1[27],ymm0[28],ymm1[28],ymm0[29],ymm1[29],ymm0[30],ymm1[30],ymm0[31],ymm1[31]
591 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
592 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
593 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
594 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
595 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm5 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[2],ymm1[2],ymm0[3],ymm1[3],ymm0[4],ymm1[4],ymm0[5],ymm1[5],ymm0[6],ymm1[6],ymm0[7],ymm1[7],ymm0[16],ymm1[16],ymm0[17],ymm1[17],ymm0[18],ymm1[18],ymm0[19],ymm1[19],ymm0[20],ymm1[20],ymm0[21],ymm1[21],ymm0[22],ymm1[22],ymm0[23],ymm1[23]
596 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm5, %ymm5
597 ; AVX512F-NEXT: vpsrlw $8, %ymm5, %ymm5
598 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm5, %ymm5
599 ; AVX512F-NEXT: vpsrlw $8, %ymm5, %ymm5
600 ; AVX512F-NEXT: vpackuswb %ymm4, %ymm5, %ymm4
601 ; AVX512F-NEXT: vpsubb %ymm4, %ymm0, %ymm5
602 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm6 = ymm5[8],ymm1[8],ymm5[9],ymm1[9],ymm5[10],ymm1[10],ymm5[11],ymm1[11],ymm5[12],ymm1[12],ymm5[13],ymm1[13],ymm5[14],ymm1[14],ymm5[15],ymm1[15],ymm5[24],ymm1[24],ymm5[25],ymm1[25],ymm5[26],ymm1[26],ymm5[27],ymm1[27],ymm5[28],ymm1[28],ymm5[29],ymm1[29],ymm5[30],ymm1[30],ymm5[31],ymm1[31]
603 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm6, %ymm6
604 ; AVX512F-NEXT: vpsrlw $8, %ymm6, %ymm6
605 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm5 = ymm5[0],ymm1[0],ymm5[1],ymm1[1],ymm5[2],ymm1[2],ymm5[3],ymm1[3],ymm5[4],ymm1[4],ymm5[5],ymm1[5],ymm5[6],ymm1[6],ymm5[7],ymm1[7],ymm5[16],ymm1[16],ymm5[17],ymm1[17],ymm5[18],ymm1[18],ymm5[19],ymm1[19],ymm5[20],ymm1[20],ymm5[21],ymm1[21],ymm5[22],ymm1[22],ymm5[23],ymm1[23]
606 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm5, %ymm5
607 ; AVX512F-NEXT: vpsrlw $8, %ymm5, %ymm5
608 ; AVX512F-NEXT: vpackuswb %ymm6, %ymm5, %ymm5
609 ; AVX512F-NEXT: vpaddb %ymm4, %ymm5, %ymm4
610 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm5 = ymm4[8],ymm1[8],ymm4[9],ymm1[9],ymm4[10],ymm1[10],ymm4[11],ymm1[11],ymm4[12],ymm1[12],ymm4[13],ymm1[13],ymm4[14],ymm1[14],ymm4[15],ymm1[15],ymm4[24],ymm1[24],ymm4[25],ymm1[25],ymm4[26],ymm1[26],ymm4[27],ymm1[27],ymm4[28],ymm1[28],ymm4[29],ymm1[29],ymm4[30],ymm1[30],ymm4[31],ymm1[31]
611 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm5, %ymm5
612 ; AVX512F-NEXT: vpsrlw $8, %ymm5, %ymm5
613 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm5, %ymm5
614 ; AVX512F-NEXT: vpand %ymm2, %ymm5, %ymm5
615 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm1 = ymm4[0],ymm1[0],ymm4[1],ymm1[1],ymm4[2],ymm1[2],ymm4[3],ymm1[3],ymm4[4],ymm1[4],ymm4[5],ymm1[5],ymm4[6],ymm1[6],ymm4[7],ymm1[7],ymm4[16],ymm1[16],ymm4[17],ymm1[17],ymm4[18],ymm1[18],ymm4[19],ymm1[19],ymm4[20],ymm1[20],ymm4[21],ymm1[21],ymm4[22],ymm1[22],ymm4[23],ymm1[23]
616 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm1, %ymm1
617 ; AVX512F-NEXT: vpsrlw $8, %ymm1, %ymm1
618 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm1, %ymm1
619 ; AVX512F-NEXT: vpand %ymm2, %ymm1, %ymm1
620 ; AVX512F-NEXT: vpackuswb %ymm5, %ymm1, %ymm1
621 ; AVX512F-NEXT: vpsubb %ymm1, %ymm0, %ymm0
622 ; AVX512F-NEXT: vinserti64x4 $1, %ymm3, %zmm0, %zmm0
625 ; AVX512BW-LABEL: test_remconstant_64i8:
627 ; AVX512BW-NEXT: vpunpckhbw {{.*#+}} zmm1 = zmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,40,40,41,41,42,42,43,43,44,44,45,45,46,46,47,47,56,56,57,57,58,58,59,59,60,60,61,61,62,62,63,63]
628 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
629 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm1, %zmm1
630 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
631 ; AVX512BW-NEXT: vpunpcklbw {{.*#+}} zmm2 = zmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,48,48,49,49,50,50,51,51,52,52,53,53,54,54,55,55]
632 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
633 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm2, %zmm2
634 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
635 ; AVX512BW-NEXT: vpackuswb %zmm1, %zmm2, %zmm1
636 ; AVX512BW-NEXT: vpxor %xmm2, %xmm2, %xmm2
637 ; AVX512BW-NEXT: vpunpckhbw {{.*#+}} zmm3 = zmm1[8],zmm2[8],zmm1[9],zmm2[9],zmm1[10],zmm2[10],zmm1[11],zmm2[11],zmm1[12],zmm2[12],zmm1[13],zmm2[13],zmm1[14],zmm2[14],zmm1[15],zmm2[15],zmm1[24],zmm2[24],zmm1[25],zmm2[25],zmm1[26],zmm2[26],zmm1[27],zmm2[27],zmm1[28],zmm2[28],zmm1[29],zmm2[29],zmm1[30],zmm2[30],zmm1[31],zmm2[31],zmm1[40],zmm2[40],zmm1[41],zmm2[41],zmm1[42],zmm2[42],zmm1[43],zmm2[43],zmm1[44],zmm2[44],zmm1[45],zmm2[45],zmm1[46],zmm2[46],zmm1[47],zmm2[47],zmm1[56],zmm2[56],zmm1[57],zmm2[57],zmm1[58],zmm2[58],zmm1[59],zmm2[59],zmm1[60],zmm2[60],zmm1[61],zmm2[61],zmm1[62],zmm2[62],zmm1[63],zmm2[63]
638 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm3, %zmm3
639 ; AVX512BW-NEXT: vpsrlw $8, %zmm3, %zmm3
640 ; AVX512BW-NEXT: vpunpcklbw {{.*#+}} zmm1 = zmm1[0],zmm2[0],zmm1[1],zmm2[1],zmm1[2],zmm2[2],zmm1[3],zmm2[3],zmm1[4],zmm2[4],zmm1[5],zmm2[5],zmm1[6],zmm2[6],zmm1[7],zmm2[7],zmm1[16],zmm2[16],zmm1[17],zmm2[17],zmm1[18],zmm2[18],zmm1[19],zmm2[19],zmm1[20],zmm2[20],zmm1[21],zmm2[21],zmm1[22],zmm2[22],zmm1[23],zmm2[23],zmm1[32],zmm2[32],zmm1[33],zmm2[33],zmm1[34],zmm2[34],zmm1[35],zmm2[35],zmm1[36],zmm2[36],zmm1[37],zmm2[37],zmm1[38],zmm2[38],zmm1[39],zmm2[39],zmm1[48],zmm2[48],zmm1[49],zmm2[49],zmm1[50],zmm2[50],zmm1[51],zmm2[51],zmm1[52],zmm2[52],zmm1[53],zmm2[53],zmm1[54],zmm2[54],zmm1[55],zmm2[55]
641 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm1, %zmm1
642 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
643 ; AVX512BW-NEXT: vpackuswb %zmm3, %zmm1, %zmm1
644 ; AVX512BW-NEXT: vpsubb %zmm1, %zmm0, %zmm3
645 ; AVX512BW-NEXT: vpunpckhbw {{.*#+}} zmm4 = zmm3[8],zmm2[8],zmm3[9],zmm2[9],zmm3[10],zmm2[10],zmm3[11],zmm2[11],zmm3[12],zmm2[12],zmm3[13],zmm2[13],zmm3[14],zmm2[14],zmm3[15],zmm2[15],zmm3[24],zmm2[24],zmm3[25],zmm2[25],zmm3[26],zmm2[26],zmm3[27],zmm2[27],zmm3[28],zmm2[28],zmm3[29],zmm2[29],zmm3[30],zmm2[30],zmm3[31],zmm2[31],zmm3[40],zmm2[40],zmm3[41],zmm2[41],zmm3[42],zmm2[42],zmm3[43],zmm2[43],zmm3[44],zmm2[44],zmm3[45],zmm2[45],zmm3[46],zmm2[46],zmm3[47],zmm2[47],zmm3[56],zmm2[56],zmm3[57],zmm2[57],zmm3[58],zmm2[58],zmm3[59],zmm2[59],zmm3[60],zmm2[60],zmm3[61],zmm2[61],zmm3[62],zmm2[62],zmm3[63],zmm2[63]
646 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm4, %zmm4
647 ; AVX512BW-NEXT: vpsrlw $8, %zmm4, %zmm4
648 ; AVX512BW-NEXT: vpunpcklbw {{.*#+}} zmm2 = zmm3[0],zmm2[0],zmm3[1],zmm2[1],zmm3[2],zmm2[2],zmm3[3],zmm2[3],zmm3[4],zmm2[4],zmm3[5],zmm2[5],zmm3[6],zmm2[6],zmm3[7],zmm2[7],zmm3[16],zmm2[16],zmm3[17],zmm2[17],zmm3[18],zmm2[18],zmm3[19],zmm2[19],zmm3[20],zmm2[20],zmm3[21],zmm2[21],zmm3[22],zmm2[22],zmm3[23],zmm2[23],zmm3[32],zmm2[32],zmm3[33],zmm2[33],zmm3[34],zmm2[34],zmm3[35],zmm2[35],zmm3[36],zmm2[36],zmm3[37],zmm2[37],zmm3[38],zmm2[38],zmm3[39],zmm2[39],zmm3[48],zmm2[48],zmm3[49],zmm2[49],zmm3[50],zmm2[50],zmm3[51],zmm2[51],zmm3[52],zmm2[52],zmm3[53],zmm2[53],zmm3[54],zmm2[54],zmm3[55],zmm2[55]
649 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm2, %zmm2
650 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
651 ; AVX512BW-NEXT: vpackuswb %zmm4, %zmm2, %zmm2
652 ; AVX512BW-NEXT: vpaddb %zmm1, %zmm2, %zmm1
653 ; AVX512BW-NEXT: vpunpckhbw {{.*#+}} zmm2 = zmm1[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,40,40,41,41,42,42,43,43,44,44,45,45,46,46,47,47,56,56,57,57,58,58,59,59,60,60,61,61,62,62,63,63]
654 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
655 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm2, %zmm2
656 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
657 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm2, %zmm2
658 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]
659 ; AVX512BW-NEXT: vpandq %zmm3, %zmm2, %zmm2
660 ; AVX512BW-NEXT: vpunpcklbw {{.*#+}} zmm1 = zmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,48,48,49,49,50,50,51,51,52,52,53,53,54,54,55,55]
661 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
662 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm1, %zmm1
663 ; AVX512BW-NEXT: vpshufb {{.*#+}} zmm1 = zmm1[1,u,3,u,5,u,7,u,9,u,11,u,13,u,15,u,17,u,19,u,21,u,23,u,25,u,27,u,29,u,31,u,33,u,35,u,37,u,39,u,41,u,43,u,45,u,47,u,49,u,51,u,53,u,55,u,57,u,59,u,61,u,63,u]
664 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm1, %zmm1
665 ; AVX512BW-NEXT: vpandq %zmm3, %zmm1, %zmm1
666 ; AVX512BW-NEXT: vpackuswb %zmm2, %zmm1, %zmm1
667 ; AVX512BW-NEXT: vpsubb %zmm1, %zmm0, %zmm0
668 ; AVX512BW-NEXT: retq
669 %res = urem <64 x i8> %a, <i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 20, i8 21, i8 22, i8 23, i8 24, i8 25, i8 26, i8 27, i8 28, i8 29, i8 30, i8 31, i8 32, i8 33, i8 34, i8 35, i8 36, i8 37, i8 38, i8 38, i8 37, i8 36, i8 35, i8 34, i8 33, i8 32, i8 31, i8 30, i8 29, i8 28, i8 27, i8 26, i8 25, i8 24, i8 23, i8 22, i8 21, i8 20, i8 19, i8 18, i8 17, i8 16, i8 15, i8 14, i8 13, i8 12, i8 11, i8 10, i8 9, i8 8, i8 7>