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: vmovdqa {{.*#+}} ymm2 = [9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363]
107 ; AVX512F-NEXT: vpmulhuw %ymm2, %ymm0, %ymm3
108 ; AVX512F-NEXT: vpsubw %ymm3, %ymm0, %ymm0
109 ; AVX512F-NEXT: vpsrlw $1, %ymm0, %ymm0
110 ; AVX512F-NEXT: vpaddw %ymm3, %ymm0, %ymm0
111 ; AVX512F-NEXT: vpsrlw $2, %ymm0, %ymm0
112 ; AVX512F-NEXT: vpmulhuw %ymm2, %ymm1, %ymm2
113 ; AVX512F-NEXT: vpsubw %ymm2, %ymm1, %ymm1
114 ; AVX512F-NEXT: vpsrlw $1, %ymm1, %ymm1
115 ; AVX512F-NEXT: vpaddw %ymm2, %ymm1, %ymm1
116 ; AVX512F-NEXT: vpsrlw $2, %ymm1, %ymm1
119 ; AVX512BW-LABEL: test_div7_32i16:
121 ; AVX512BW-NEXT: vpmulhuw {{.*}}(%rip), %zmm0, %zmm1
122 ; AVX512BW-NEXT: vpsubw %zmm1, %zmm0, %zmm0
123 ; AVX512BW-NEXT: vpsrlw $1, %zmm0, %zmm0
124 ; AVX512BW-NEXT: vpaddw %zmm1, %zmm0, %zmm0
125 ; AVX512BW-NEXT: vpsrlw $2, %zmm0, %zmm0
126 ; AVX512BW-NEXT: retq
127 %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>
131 define <64 x i8> @test_div7_64i8(<64 x i8> %a) nounwind {
132 ; AVX512F-LABEL: test_div7_64i8:
134 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
135 ; 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]
136 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm4 = [37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37]
137 ; AVX512F-NEXT: vpmullw %ymm4, %ymm3, %ymm3
138 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
139 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm5 = 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]
140 ; AVX512F-NEXT: vpmullw %ymm4, %ymm5, %ymm5
141 ; AVX512F-NEXT: vpsrlw $8, %ymm5, %ymm5
142 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm5, %ymm3
143 ; AVX512F-NEXT: vpsubb %ymm3, %ymm0, %ymm0
144 ; AVX512F-NEXT: vpsrlw $1, %ymm0, %ymm0
145 ; 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]
146 ; AVX512F-NEXT: vpand %ymm5, %ymm0, %ymm0
147 ; AVX512F-NEXT: vpaddb %ymm3, %ymm0, %ymm0
148 ; AVX512F-NEXT: vpsrlw $2, %ymm0, %ymm0
149 ; 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]
150 ; AVX512F-NEXT: vpand %ymm3, %ymm0, %ymm0
151 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm6 = 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]
152 ; AVX512F-NEXT: vpmullw %ymm4, %ymm6, %ymm6
153 ; AVX512F-NEXT: vpsrlw $8, %ymm6, %ymm6
154 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm2 = 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]
155 ; AVX512F-NEXT: vpmullw %ymm4, %ymm2, %ymm2
156 ; AVX512F-NEXT: vpsrlw $8, %ymm2, %ymm2
157 ; AVX512F-NEXT: vpackuswb %ymm6, %ymm2, %ymm2
158 ; AVX512F-NEXT: vpsubb %ymm2, %ymm1, %ymm1
159 ; AVX512F-NEXT: vpsrlw $1, %ymm1, %ymm1
160 ; AVX512F-NEXT: vpand %ymm5, %ymm1, %ymm1
161 ; AVX512F-NEXT: vpaddb %ymm2, %ymm1, %ymm1
162 ; AVX512F-NEXT: vpsrlw $2, %ymm1, %ymm1
163 ; AVX512F-NEXT: vpand %ymm3, %ymm1, %ymm1
166 ; AVX512BW-LABEL: test_div7_64i8:
168 ; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
169 ; 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]
170 ; 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]
171 ; AVX512BW-NEXT: vpmullw %zmm3, %zmm2, %zmm2
172 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
173 ; 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]
174 ; AVX512BW-NEXT: vpmullw %zmm3, %zmm1, %zmm1
175 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
176 ; AVX512BW-NEXT: vpackuswb %zmm2, %zmm1, %zmm1
177 ; AVX512BW-NEXT: vpsubb %zmm1, %zmm0, %zmm0
178 ; AVX512BW-NEXT: vpsrlw $1, %zmm0, %zmm0
179 ; AVX512BW-NEXT: vpandq {{.*}}(%rip), %zmm0, %zmm0
180 ; AVX512BW-NEXT: vpaddb %zmm1, %zmm0, %zmm0
181 ; AVX512BW-NEXT: vpsrlw $2, %zmm0, %zmm0
182 ; AVX512BW-NEXT: vpandq {{.*}}(%rip), %zmm0, %zmm0
183 ; AVX512BW-NEXT: retq
184 %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>
189 ; udiv by non-splat constant
192 define <64 x i8> @test_divconstant_64i8(<64 x i8> %a) nounwind {
193 ; AVX512F-LABEL: test_divconstant_64i8:
195 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
196 ; 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]
197 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
198 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
199 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
200 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
201 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm4 = 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]
202 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
203 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
204 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
205 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
206 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm4, %ymm3
207 ; AVX512F-NEXT: vpsubb %ymm3, %ymm0, %ymm0
208 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm4 = 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]
209 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
210 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
211 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm0 = 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]
212 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm0, %ymm0
213 ; AVX512F-NEXT: vpsrlw $8, %ymm0, %ymm0
214 ; AVX512F-NEXT: vpackuswb %ymm4, %ymm0, %ymm0
215 ; AVX512F-NEXT: vpaddb %ymm3, %ymm0, %ymm0
216 ; 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]
217 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
218 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
219 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm0 = 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]
220 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm0, %ymm0
221 ; AVX512F-NEXT: vpsrlw $8, %ymm0, %ymm0
222 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm0, %ymm0
223 ; 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]
224 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
225 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
226 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
227 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
228 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm4 = 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]
229 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
230 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
231 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
232 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
233 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm4, %ymm3
234 ; AVX512F-NEXT: vpsubb %ymm3, %ymm1, %ymm1
235 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm4 = 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]
236 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
237 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
238 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm1 = 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]
239 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm1, %ymm1
240 ; AVX512F-NEXT: vpsrlw $8, %ymm1, %ymm1
241 ; AVX512F-NEXT: vpackuswb %ymm4, %ymm1, %ymm1
242 ; AVX512F-NEXT: vpaddb %ymm3, %ymm1, %ymm1
243 ; 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]
244 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
245 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
246 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm1 = 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]
247 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm1, %ymm1
248 ; AVX512F-NEXT: vpsrlw $8, %ymm1, %ymm1
249 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm1, %ymm1
252 ; AVX512BW-LABEL: test_divconstant_64i8:
254 ; 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]
255 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
256 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm1, %zmm1
257 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
258 ; 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]
259 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
260 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm2, %zmm2
261 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
262 ; AVX512BW-NEXT: vpackuswb %zmm1, %zmm2, %zmm1
263 ; AVX512BW-NEXT: vpxor %xmm2, %xmm2, %xmm2
264 ; 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]
265 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm3, %zmm3
266 ; AVX512BW-NEXT: vpsrlw $8, %zmm3, %zmm3
267 ; 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]
268 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm1, %zmm1
269 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
270 ; AVX512BW-NEXT: vpackuswb %zmm3, %zmm1, %zmm1
271 ; AVX512BW-NEXT: vpsubb %zmm1, %zmm0, %zmm0
272 ; 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]
273 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm3, %zmm3
274 ; AVX512BW-NEXT: vpsrlw $8, %zmm3, %zmm3
275 ; 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]
276 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm0, %zmm0
277 ; AVX512BW-NEXT: vpsrlw $8, %zmm0, %zmm0
278 ; AVX512BW-NEXT: vpackuswb %zmm3, %zmm0, %zmm0
279 ; AVX512BW-NEXT: vpaddb %zmm1, %zmm0, %zmm0
280 ; 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]
281 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
282 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm1, %zmm1
283 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
284 ; 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]
285 ; AVX512BW-NEXT: vpsrlw $8, %zmm0, %zmm0
286 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm0, %zmm0
287 ; AVX512BW-NEXT: vpsrlw $8, %zmm0, %zmm0
288 ; AVX512BW-NEXT: vpackuswb %zmm1, %zmm0, %zmm0
289 ; AVX512BW-NEXT: retq
290 %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>
298 define <8 x i64> @test_rem7_8i64(<8 x i64> %a) nounwind {
299 ; AVX-LABEL: test_rem7_8i64:
301 ; AVX-NEXT: vextracti32x4 $3, %zmm0, %xmm1
302 ; AVX-NEXT: vpextrq $1, %xmm1, %rcx
303 ; AVX-NEXT: movabsq $2635249153387078803, %rsi # imm = 0x2492492492492493
304 ; AVX-NEXT: movq %rcx, %rax
305 ; AVX-NEXT: mulq %rsi
306 ; AVX-NEXT: movq %rcx, %rax
307 ; AVX-NEXT: subq %rdx, %rax
308 ; AVX-NEXT: shrq %rax
309 ; AVX-NEXT: addq %rdx, %rax
310 ; AVX-NEXT: shrq $2, %rax
311 ; AVX-NEXT: leaq (,%rax,8), %rdx
312 ; AVX-NEXT: subq %rdx, %rax
313 ; AVX-NEXT: addq %rcx, %rax
314 ; AVX-NEXT: vmovq %rax, %xmm2
315 ; AVX-NEXT: vmovq %xmm1, %rcx
316 ; AVX-NEXT: movq %rcx, %rax
317 ; AVX-NEXT: mulq %rsi
318 ; AVX-NEXT: movq %rcx, %rax
319 ; AVX-NEXT: subq %rdx, %rax
320 ; AVX-NEXT: shrq %rax
321 ; AVX-NEXT: addq %rdx, %rax
322 ; AVX-NEXT: shrq $2, %rax
323 ; AVX-NEXT: leaq (,%rax,8), %rdx
324 ; AVX-NEXT: subq %rdx, %rax
325 ; AVX-NEXT: addq %rcx, %rax
326 ; AVX-NEXT: vmovq %rax, %xmm1
327 ; AVX-NEXT: vpunpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm2[0]
328 ; AVX-NEXT: vextracti32x4 $2, %zmm0, %xmm2
329 ; AVX-NEXT: vpextrq $1, %xmm2, %rcx
330 ; AVX-NEXT: movq %rcx, %rax
331 ; AVX-NEXT: mulq %rsi
332 ; AVX-NEXT: movq %rcx, %rax
333 ; AVX-NEXT: subq %rdx, %rax
334 ; AVX-NEXT: shrq %rax
335 ; AVX-NEXT: addq %rdx, %rax
336 ; AVX-NEXT: shrq $2, %rax
337 ; AVX-NEXT: leaq (,%rax,8), %rdx
338 ; AVX-NEXT: subq %rdx, %rax
339 ; AVX-NEXT: addq %rcx, %rax
340 ; AVX-NEXT: vmovq %rax, %xmm3
341 ; AVX-NEXT: vmovq %xmm2, %rcx
342 ; AVX-NEXT: movq %rcx, %rax
343 ; AVX-NEXT: mulq %rsi
344 ; AVX-NEXT: movq %rcx, %rax
345 ; AVX-NEXT: subq %rdx, %rax
346 ; AVX-NEXT: shrq %rax
347 ; AVX-NEXT: addq %rdx, %rax
348 ; AVX-NEXT: shrq $2, %rax
349 ; AVX-NEXT: leaq (,%rax,8), %rdx
350 ; AVX-NEXT: subq %rdx, %rax
351 ; AVX-NEXT: addq %rcx, %rax
352 ; AVX-NEXT: vmovq %rax, %xmm2
353 ; AVX-NEXT: vpunpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
354 ; AVX-NEXT: vinserti128 $1, %xmm1, %ymm2, %ymm1
355 ; AVX-NEXT: vextracti128 $1, %ymm0, %xmm2
356 ; AVX-NEXT: vpextrq $1, %xmm2, %rcx
357 ; AVX-NEXT: movq %rcx, %rax
358 ; AVX-NEXT: mulq %rsi
359 ; AVX-NEXT: movq %rcx, %rax
360 ; AVX-NEXT: subq %rdx, %rax
361 ; AVX-NEXT: shrq %rax
362 ; AVX-NEXT: addq %rdx, %rax
363 ; AVX-NEXT: shrq $2, %rax
364 ; AVX-NEXT: leaq (,%rax,8), %rdx
365 ; AVX-NEXT: subq %rdx, %rax
366 ; AVX-NEXT: addq %rcx, %rax
367 ; AVX-NEXT: vmovq %rax, %xmm3
368 ; AVX-NEXT: vmovq %xmm2, %rcx
369 ; AVX-NEXT: movq %rcx, %rax
370 ; AVX-NEXT: mulq %rsi
371 ; AVX-NEXT: movq %rcx, %rax
372 ; AVX-NEXT: subq %rdx, %rax
373 ; AVX-NEXT: shrq %rax
374 ; AVX-NEXT: addq %rdx, %rax
375 ; AVX-NEXT: shrq $2, %rax
376 ; AVX-NEXT: leaq (,%rax,8), %rdx
377 ; AVX-NEXT: subq %rdx, %rax
378 ; AVX-NEXT: addq %rcx, %rax
379 ; AVX-NEXT: vmovq %rax, %xmm2
380 ; AVX-NEXT: vpunpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
381 ; AVX-NEXT: vpextrq $1, %xmm0, %rcx
382 ; AVX-NEXT: movq %rcx, %rax
383 ; AVX-NEXT: mulq %rsi
384 ; AVX-NEXT: movq %rcx, %rax
385 ; AVX-NEXT: subq %rdx, %rax
386 ; AVX-NEXT: shrq %rax
387 ; AVX-NEXT: addq %rdx, %rax
388 ; AVX-NEXT: shrq $2, %rax
389 ; AVX-NEXT: leaq (,%rax,8), %rdx
390 ; AVX-NEXT: subq %rdx, %rax
391 ; AVX-NEXT: addq %rcx, %rax
392 ; AVX-NEXT: vmovq %rax, %xmm3
393 ; AVX-NEXT: vmovq %xmm0, %rcx
394 ; AVX-NEXT: movq %rcx, %rax
395 ; AVX-NEXT: mulq %rsi
396 ; AVX-NEXT: movq %rcx, %rax
397 ; AVX-NEXT: subq %rdx, %rax
398 ; AVX-NEXT: shrq %rax
399 ; AVX-NEXT: addq %rdx, %rax
400 ; AVX-NEXT: shrq $2, %rax
401 ; AVX-NEXT: leaq (,%rax,8), %rdx
402 ; AVX-NEXT: subq %rdx, %rax
403 ; AVX-NEXT: addq %rcx, %rax
404 ; AVX-NEXT: vmovq %rax, %xmm0
405 ; AVX-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm3[0]
406 ; AVX-NEXT: vinserti128 $1, %xmm2, %ymm0, %ymm0
407 ; AVX-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
409 %res = urem <8 x i64> %a, <i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7>
413 define <16 x i32> @test_rem7_16i32(<16 x i32> %a) nounwind {
414 ; AVX-LABEL: test_rem7_16i32:
416 ; AVX-NEXT: vpbroadcastd {{.*#+}} zmm1 = [613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757,613566757]
417 ; AVX-NEXT: vpmuludq %zmm1, %zmm0, %zmm2
418 ; AVX-NEXT: vpshufd {{.*#+}} zmm3 = zmm0[1,1,3,3,5,5,7,7,9,9,11,11,13,13,15,15]
419 ; AVX-NEXT: vpmuludq %zmm1, %zmm3, %zmm1
420 ; AVX-NEXT: vmovdqa64 {{.*#+}} zmm3 = [1,17,3,19,5,21,7,23,9,25,11,27,13,29,15,31]
421 ; AVX-NEXT: vpermi2d %zmm1, %zmm2, %zmm3
422 ; AVX-NEXT: vpsubd %zmm3, %zmm0, %zmm1
423 ; AVX-NEXT: vpsrld $1, %zmm1, %zmm1
424 ; AVX-NEXT: vpaddd %zmm3, %zmm1, %zmm1
425 ; AVX-NEXT: vpsrld $2, %zmm1, %zmm1
426 ; AVX-NEXT: vpmulld {{.*}}(%rip){1to16}, %zmm1, %zmm1
427 ; AVX-NEXT: vpsubd %zmm1, %zmm0, %zmm0
429 %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>
433 define <32 x i16> @test_rem7_32i16(<32 x i16> %a) nounwind {
434 ; AVX512F-LABEL: test_rem7_32i16:
436 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm2 = [9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363,9363]
437 ; AVX512F-NEXT: vpmulhuw %ymm2, %ymm0, %ymm3
438 ; AVX512F-NEXT: vpsubw %ymm3, %ymm0, %ymm4
439 ; AVX512F-NEXT: vpsrlw $1, %ymm4, %ymm4
440 ; AVX512F-NEXT: vpaddw %ymm3, %ymm4, %ymm3
441 ; AVX512F-NEXT: vpsrlw $2, %ymm3, %ymm3
442 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm4 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
443 ; AVX512F-NEXT: vpmullw %ymm4, %ymm3, %ymm3
444 ; AVX512F-NEXT: vpsubw %ymm3, %ymm0, %ymm0
445 ; AVX512F-NEXT: vpmulhuw %ymm2, %ymm1, %ymm2
446 ; AVX512F-NEXT: vpsubw %ymm2, %ymm1, %ymm3
447 ; AVX512F-NEXT: vpsrlw $1, %ymm3, %ymm3
448 ; AVX512F-NEXT: vpaddw %ymm2, %ymm3, %ymm2
449 ; AVX512F-NEXT: vpsrlw $2, %ymm2, %ymm2
450 ; AVX512F-NEXT: vpmullw %ymm4, %ymm2, %ymm2
451 ; AVX512F-NEXT: vpsubw %ymm2, %ymm1, %ymm1
454 ; AVX512BW-LABEL: test_rem7_32i16:
456 ; AVX512BW-NEXT: vpmulhuw {{.*}}(%rip), %zmm0, %zmm1
457 ; AVX512BW-NEXT: vpsubw %zmm1, %zmm0, %zmm2
458 ; AVX512BW-NEXT: vpsrlw $1, %zmm2, %zmm2
459 ; AVX512BW-NEXT: vpaddw %zmm1, %zmm2, %zmm1
460 ; AVX512BW-NEXT: vpsrlw $2, %zmm1, %zmm1
461 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm1, %zmm1
462 ; AVX512BW-NEXT: vpsubw %zmm1, %zmm0, %zmm0
463 ; AVX512BW-NEXT: retq
464 %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>
468 define <64 x i8> @test_rem7_64i8(<64 x i8> %a) nounwind {
469 ; AVX512F-LABEL: test_rem7_64i8:
471 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
472 ; 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]
473 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm4 = [37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37]
474 ; AVX512F-NEXT: vpmullw %ymm4, %ymm3, %ymm3
475 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
476 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm5 = 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]
477 ; AVX512F-NEXT: vpmullw %ymm4, %ymm5, %ymm5
478 ; AVX512F-NEXT: vpsrlw $8, %ymm5, %ymm5
479 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm5, %ymm3
480 ; AVX512F-NEXT: vpsubb %ymm3, %ymm0, %ymm5
481 ; AVX512F-NEXT: vpsrlw $1, %ymm5, %ymm5
482 ; 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]
483 ; AVX512F-NEXT: vpand %ymm6, %ymm5, %ymm5
484 ; AVX512F-NEXT: vpaddb %ymm3, %ymm5, %ymm3
485 ; AVX512F-NEXT: vpsrlw $2, %ymm3, %ymm3
486 ; 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]
487 ; AVX512F-NEXT: vpand %ymm5, %ymm3, %ymm3
488 ; AVX512F-NEXT: vpsllw $3, %ymm3, %ymm7
489 ; 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]
490 ; AVX512F-NEXT: vpand %ymm8, %ymm7, %ymm7
491 ; AVX512F-NEXT: vpsubb %ymm7, %ymm3, %ymm3
492 ; AVX512F-NEXT: vpaddb %ymm3, %ymm0, %ymm0
493 ; 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]
494 ; AVX512F-NEXT: vpmullw %ymm4, %ymm3, %ymm3
495 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
496 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm2 = 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]
497 ; AVX512F-NEXT: vpmullw %ymm4, %ymm2, %ymm2
498 ; AVX512F-NEXT: vpsrlw $8, %ymm2, %ymm2
499 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm2, %ymm2
500 ; AVX512F-NEXT: vpsubb %ymm2, %ymm1, %ymm3
501 ; AVX512F-NEXT: vpsrlw $1, %ymm3, %ymm3
502 ; AVX512F-NEXT: vpand %ymm6, %ymm3, %ymm3
503 ; AVX512F-NEXT: vpaddb %ymm2, %ymm3, %ymm2
504 ; AVX512F-NEXT: vpsrlw $2, %ymm2, %ymm2
505 ; AVX512F-NEXT: vpand %ymm5, %ymm2, %ymm2
506 ; AVX512F-NEXT: vpsllw $3, %ymm2, %ymm3
507 ; AVX512F-NEXT: vpand %ymm8, %ymm3, %ymm3
508 ; AVX512F-NEXT: vpsubb %ymm3, %ymm2, %ymm2
509 ; AVX512F-NEXT: vpaddb %ymm2, %ymm1, %ymm1
512 ; AVX512BW-LABEL: test_rem7_64i8:
514 ; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
515 ; 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]
516 ; 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]
517 ; AVX512BW-NEXT: vpmullw %zmm3, %zmm2, %zmm2
518 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
519 ; 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]
520 ; AVX512BW-NEXT: vpmullw %zmm3, %zmm1, %zmm1
521 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
522 ; AVX512BW-NEXT: vpackuswb %zmm2, %zmm1, %zmm1
523 ; AVX512BW-NEXT: vpsubb %zmm1, %zmm0, %zmm2
524 ; AVX512BW-NEXT: vpsrlw $1, %zmm2, %zmm2
525 ; AVX512BW-NEXT: vpandq {{.*}}(%rip), %zmm2, %zmm2
526 ; AVX512BW-NEXT: vpaddb %zmm1, %zmm2, %zmm1
527 ; AVX512BW-NEXT: vpsrlw $2, %zmm1, %zmm1
528 ; AVX512BW-NEXT: vpandq {{.*}}(%rip), %zmm1, %zmm1
529 ; AVX512BW-NEXT: vpsllw $3, %zmm1, %zmm2
530 ; AVX512BW-NEXT: vpandq {{.*}}(%rip), %zmm2, %zmm2
531 ; AVX512BW-NEXT: vpsubb %zmm2, %zmm1, %zmm1
532 ; AVX512BW-NEXT: vpaddb %zmm1, %zmm0, %zmm0
533 ; AVX512BW-NEXT: retq
534 %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>
539 ; urem by non-splat constant
542 define <64 x i8> @test_remconstant_64i8(<64 x i8> %a) nounwind {
543 ; AVX512F-LABEL: test_remconstant_64i8:
545 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
546 ; 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]
547 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
548 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
549 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
550 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
551 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm4 = 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]
552 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
553 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
554 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
555 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
556 ; AVX512F-NEXT: vpackuswb %ymm3, %ymm4, %ymm3
557 ; AVX512F-NEXT: vpsubb %ymm3, %ymm0, %ymm4
558 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm5 = ymm4[8],ymm2[8],ymm4[9],ymm2[9],ymm4[10],ymm2[10],ymm4[11],ymm2[11],ymm4[12],ymm2[12],ymm4[13],ymm2[13],ymm4[14],ymm2[14],ymm4[15],ymm2[15],ymm4[24],ymm2[24],ymm4[25],ymm2[25],ymm4[26],ymm2[26],ymm4[27],ymm2[27],ymm4[28],ymm2[28],ymm4[29],ymm2[29],ymm4[30],ymm2[30],ymm4[31],ymm2[31]
559 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm5, %ymm5
560 ; AVX512F-NEXT: vpsrlw $8, %ymm5, %ymm5
561 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm4 = ymm4[0],ymm2[0],ymm4[1],ymm2[1],ymm4[2],ymm2[2],ymm4[3],ymm2[3],ymm4[4],ymm2[4],ymm4[5],ymm2[5],ymm4[6],ymm2[6],ymm4[7],ymm2[7],ymm4[16],ymm2[16],ymm4[17],ymm2[17],ymm4[18],ymm2[18],ymm4[19],ymm2[19],ymm4[20],ymm2[20],ymm4[21],ymm2[21],ymm4[22],ymm2[22],ymm4[23],ymm2[23]
562 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
563 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
564 ; AVX512F-NEXT: vpackuswb %ymm5, %ymm4, %ymm4
565 ; AVX512F-NEXT: vpaddb %ymm3, %ymm4, %ymm4
566 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm4[8],ymm2[8],ymm4[9],ymm2[9],ymm4[10],ymm2[10],ymm4[11],ymm2[11],ymm4[12],ymm2[12],ymm4[13],ymm2[13],ymm4[14],ymm2[14],ymm4[15],ymm2[15],ymm4[24],ymm2[24],ymm4[25],ymm2[25],ymm4[26],ymm2[26],ymm4[27],ymm2[27],ymm4[28],ymm2[28],ymm4[29],ymm2[29],ymm4[30],ymm2[30],ymm4[31],ymm2[31]
567 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm3
568 ; AVX512F-NEXT: vpsrlw $8, %ymm3, %ymm3
569 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm3, %ymm5
570 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm3 = [255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]
571 ; AVX512F-NEXT: vpand %ymm3, %ymm5, %ymm5
572 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm4 = ymm4[0],ymm2[0],ymm4[1],ymm2[1],ymm4[2],ymm2[2],ymm4[3],ymm2[3],ymm4[4],ymm2[4],ymm4[5],ymm2[5],ymm4[6],ymm2[6],ymm4[7],ymm2[7],ymm4[16],ymm2[16],ymm4[17],ymm2[17],ymm4[18],ymm2[18],ymm4[19],ymm2[19],ymm4[20],ymm2[20],ymm4[21],ymm2[21],ymm4[22],ymm2[22],ymm4[23],ymm2[23]
573 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
574 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
575 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
576 ; AVX512F-NEXT: vpand %ymm3, %ymm4, %ymm4
577 ; AVX512F-NEXT: vpackuswb %ymm5, %ymm4, %ymm4
578 ; AVX512F-NEXT: vpsubb %ymm4, %ymm0, %ymm0
579 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm4 = 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]
580 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
581 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
582 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm4, %ymm4
583 ; AVX512F-NEXT: vpsrlw $8, %ymm4, %ymm4
584 ; 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]
585 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm5, %ymm5
586 ; AVX512F-NEXT: vpsrlw $8, %ymm5, %ymm5
587 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm5, %ymm5
588 ; AVX512F-NEXT: vpsrlw $8, %ymm5, %ymm5
589 ; AVX512F-NEXT: vpackuswb %ymm4, %ymm5, %ymm4
590 ; AVX512F-NEXT: vpsubb %ymm4, %ymm1, %ymm5
591 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm6 = ymm5[8],ymm2[8],ymm5[9],ymm2[9],ymm5[10],ymm2[10],ymm5[11],ymm2[11],ymm5[12],ymm2[12],ymm5[13],ymm2[13],ymm5[14],ymm2[14],ymm5[15],ymm2[15],ymm5[24],ymm2[24],ymm5[25],ymm2[25],ymm5[26],ymm2[26],ymm5[27],ymm2[27],ymm5[28],ymm2[28],ymm5[29],ymm2[29],ymm5[30],ymm2[30],ymm5[31],ymm2[31]
592 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm6, %ymm6
593 ; AVX512F-NEXT: vpsrlw $8, %ymm6, %ymm6
594 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm5 = ymm5[0],ymm2[0],ymm5[1],ymm2[1],ymm5[2],ymm2[2],ymm5[3],ymm2[3],ymm5[4],ymm2[4],ymm5[5],ymm2[5],ymm5[6],ymm2[6],ymm5[7],ymm2[7],ymm5[16],ymm2[16],ymm5[17],ymm2[17],ymm5[18],ymm2[18],ymm5[19],ymm2[19],ymm5[20],ymm2[20],ymm5[21],ymm2[21],ymm5[22],ymm2[22],ymm5[23],ymm2[23]
595 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm5, %ymm5
596 ; AVX512F-NEXT: vpsrlw $8, %ymm5, %ymm5
597 ; AVX512F-NEXT: vpackuswb %ymm6, %ymm5, %ymm5
598 ; AVX512F-NEXT: vpaddb %ymm4, %ymm5, %ymm4
599 ; AVX512F-NEXT: vpunpckhbw {{.*#+}} ymm5 = ymm4[8],ymm2[8],ymm4[9],ymm2[9],ymm4[10],ymm2[10],ymm4[11],ymm2[11],ymm4[12],ymm2[12],ymm4[13],ymm2[13],ymm4[14],ymm2[14],ymm4[15],ymm2[15],ymm4[24],ymm2[24],ymm4[25],ymm2[25],ymm4[26],ymm2[26],ymm4[27],ymm2[27],ymm4[28],ymm2[28],ymm4[29],ymm2[29],ymm4[30],ymm2[30],ymm4[31],ymm2[31]
600 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm5, %ymm5
601 ; AVX512F-NEXT: vpsrlw $8, %ymm5, %ymm5
602 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm5, %ymm5
603 ; AVX512F-NEXT: vpand %ymm3, %ymm5, %ymm5
604 ; AVX512F-NEXT: vpunpcklbw {{.*#+}} ymm2 = ymm4[0],ymm2[0],ymm4[1],ymm2[1],ymm4[2],ymm2[2],ymm4[3],ymm2[3],ymm4[4],ymm2[4],ymm4[5],ymm2[5],ymm4[6],ymm2[6],ymm4[7],ymm2[7],ymm4[16],ymm2[16],ymm4[17],ymm2[17],ymm4[18],ymm2[18],ymm4[19],ymm2[19],ymm4[20],ymm2[20],ymm4[21],ymm2[21],ymm4[22],ymm2[22],ymm4[23],ymm2[23]
605 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm2, %ymm2
606 ; AVX512F-NEXT: vpsrlw $8, %ymm2, %ymm2
607 ; AVX512F-NEXT: vpmullw {{.*}}(%rip), %ymm2, %ymm2
608 ; AVX512F-NEXT: vpand %ymm3, %ymm2, %ymm2
609 ; AVX512F-NEXT: vpackuswb %ymm5, %ymm2, %ymm2
610 ; AVX512F-NEXT: vpsubb %ymm2, %ymm1, %ymm1
613 ; AVX512BW-LABEL: test_remconstant_64i8:
615 ; 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]
616 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
617 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm1, %zmm1
618 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
619 ; 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]
620 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
621 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm2, %zmm2
622 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
623 ; AVX512BW-NEXT: vpackuswb %zmm1, %zmm2, %zmm1
624 ; AVX512BW-NEXT: vpxor %xmm2, %xmm2, %xmm2
625 ; 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]
626 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm3, %zmm3
627 ; AVX512BW-NEXT: vpsrlw $8, %zmm3, %zmm3
628 ; 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]
629 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm1, %zmm1
630 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
631 ; AVX512BW-NEXT: vpackuswb %zmm3, %zmm1, %zmm1
632 ; AVX512BW-NEXT: vpsubb %zmm1, %zmm0, %zmm3
633 ; 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]
634 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm4, %zmm4
635 ; AVX512BW-NEXT: vpsrlw $8, %zmm4, %zmm4
636 ; 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]
637 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm2, %zmm2
638 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
639 ; AVX512BW-NEXT: vpackuswb %zmm4, %zmm2, %zmm2
640 ; AVX512BW-NEXT: vpaddb %zmm1, %zmm2, %zmm1
641 ; 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]
642 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
643 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm2, %zmm2
644 ; AVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
645 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm2, %zmm2
646 ; 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]
647 ; AVX512BW-NEXT: vpandq %zmm3, %zmm2, %zmm2
648 ; 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]
649 ; AVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
650 ; AVX512BW-NEXT: vpsllvw {{.*}}(%rip), %zmm1, %zmm1
651 ; 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]
652 ; AVX512BW-NEXT: vpmullw {{.*}}(%rip), %zmm1, %zmm1
653 ; AVX512BW-NEXT: vpandq %zmm3, %zmm1, %zmm1
654 ; AVX512BW-NEXT: vpackuswb %zmm2, %zmm1, %zmm1
655 ; AVX512BW-NEXT: vpsubb %zmm1, %zmm0, %zmm0
656 ; AVX512BW-NEXT: retq
657 %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>