< prev index next >

test/hotspot/jtreg/compiler/loopopts/superword/TestMulAddS2I.java

Print this page

143 
144     @Test
145     @IR(applyIfCPUFeature = {"sse2", "true"},
146         applyIfPlatform = {"64-bit", "true"},
147         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
148     @IR(applyIfCPUFeature = {"asimd", "true"},
149         applyIf = {"MaxVectorSize", "16"}, // AD file requires vector_length = 16
150         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
151     @IR(applyIfCPUFeature = {"avx512_vnni", "true"},
152         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI_VNNI, "> 0"})
153     public static int[] testc(int[] out) {
154         for (int i = 0; i < ITER; i++) {
155             out[i] += ((sArr1[2*i] * sArr2[2*i]) + (sArr1[2*i+1] * sArr2[2*i+1]));
156         }
157         return out;
158     }
159 
160     @Test
161     @IR(applyIfCPUFeature = {"sse2", "true"},
162         applyIfPlatform = {"64-bit", "true"},

163         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
164     @IR(applyIfCPUFeature = {"asimd", "true"},
165         applyIf = {"MaxVectorSize", "16"}, // AD file requires vector_length = 16
166         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
167     @IR(applyIfCPUFeature = {"avx512_vnni", "true"},

168         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI_VNNI, "> 0"})
169     public static int[] testd(int[] out) {
170         for (int i = 0; i < ITER-2; i+=2) {
171             // Unrolled, with the same structure.
172             out[i+0] += ((sArr1[2*i+0] * sArr2[2*i+0]) + (sArr1[2*i+1] * sArr2[2*i+1]));
173             out[i+1] += ((sArr1[2*i+2] * sArr2[2*i+2]) + (sArr1[2*i+3] * sArr2[2*i+3]));
174         }
175         return out;
176     }
177 
178     @Test
179     @IR(applyIfCPUFeature = {"sse2", "true"},
180         applyIfPlatform = {"64-bit", "true"},

181         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
182     @IR(applyIfCPUFeature = {"asimd", "true"},
183         applyIf = {"MaxVectorSize", "16"}, // AD file requires vector_length = 16
184         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
185     @IR(applyIfCPUFeature = {"avx512_vnni", "true"},

186         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI_VNNI, "> 0"})
187     public static int[] teste(int[] out) {
188         for (int i = 0; i < ITER-2; i+=2) {
189             // Unrolled, with some swaps.
190             out[i+0] += ((sArr1[2*i+0] * sArr2[2*i+0]) + (sArr1[2*i+1] * sArr2[2*i+1]));
191             out[i+1] += ((sArr2[2*i+2] * sArr1[2*i+2]) + (sArr1[2*i+3] * sArr2[2*i+3])); // swap(1 2)
192         }
193         return out;
194     }
195 
196     @Test
197     @IR(applyIfCPUFeature = {"sse2", "true"},
198         applyIfPlatform = {"64-bit", "true"},

199         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
200     @IR(applyIfCPUFeature = {"asimd", "true"},
201         applyIf = {"MaxVectorSize", "16"}, // AD file requires vector_length = 16
202         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
203     @IR(applyIfCPUFeature = {"avx512_vnni", "true"},

204         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI_VNNI, "> 0"})
205     public static int[] testf(int[] out) {
206         for (int i = 0; i < ITER-2; i+=2) {
207             // Unrolled, with some swaps.
208             out[i+0] += ((sArr1[2*i+0] * sArr2[2*i+0]) + (sArr1[2*i+1] * sArr2[2*i+1]));
209             out[i+1] += ((sArr2[2*i+2] * sArr1[2*i+2]) + (sArr2[2*i+3] * sArr1[2*i+3])); // swap(1 2), swap(3 4)
210         }
211         return out;
212     }
213 
214     @Test
215     @IR(applyIfCPUFeature = {"sse2", "true"},
216         applyIfPlatform = {"64-bit", "true"},

217         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
218     @IR(applyIfCPUFeature = {"asimd", "true"},
219         applyIf = {"MaxVectorSize", "16"}, // AD file requires vector_length = 16
220         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
221     @IR(applyIfCPUFeature = {"avx512_vnni", "true"},

222         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI_VNNI, "> 0"})
223     public static int[] testg(int[] out) {
224         for (int i = 0; i < ITER-2; i+=2) {
225             // Unrolled, with some swaps.
226             out[i+0] += ((sArr1[2*i+0] * sArr2[2*i+0]) + (sArr1[2*i+1] * sArr2[2*i+1]));
227             out[i+1] += ((sArr1[2*i+3] * sArr2[2*i+3]) + (sArr1[2*i+2] * sArr2[2*i+2])); // swap(1 3), swap(2 4)
228         }
229         return out;
230     }
231 
232     @Test
233     @IR(applyIfCPUFeature = {"sse2", "true"},
234         applyIfPlatform = {"64-bit", "true"},

235         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
236     @IR(applyIfCPUFeature = {"asimd", "true"},
237         applyIf = {"MaxVectorSize", "16"}, // AD file requires vector_length = 16
238         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
239     @IR(applyIfCPUFeature = {"avx512_vnni", "true"},

240         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI_VNNI, "> 0"})
241     public static int[] testh(int[] out) {
242         for (int i = 0; i < ITER-2; i+=2) {
243             // Unrolled, with some swaps.
244             out[i+0] += ((sArr1[2*i+0] * sArr2[2*i+0]) + (sArr1[2*i+1] * sArr2[2*i+1]));
245             out[i+1] += ((sArr2[2*i+3] * sArr1[2*i+3]) + (sArr2[2*i+2] * sArr1[2*i+2])); // swap(1 4), swap(2 3)
246         }
247         return out;
248     }
249 
250     @Test
251     @IR(counts = {IRNode.MUL_ADD_S2I, "> 0"},
252         applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
253     @IR(counts = {IRNode.MUL_ADD_VS2VI, "= 0"})
254     public static int[] testi(int[] out) {
255         for (int i = 0; i < ITER-2; i+=2) {
256             // Unrolled, with some swaps that prevent vectorization.
257             out[i+0] += ((sArr1[2*i+0] * sArr2[2*i+0]) + (sArr1[2*i+1] * sArr2[2*i+1])); // ok
258             out[i+1] += ((sArr1[2*i+2] * sArr2[2*i+3]) + (sArr1[2*i+3] * sArr2[2*i+2])); // bad
259         }

143 
144     @Test
145     @IR(applyIfCPUFeature = {"sse2", "true"},
146         applyIfPlatform = {"64-bit", "true"},
147         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
148     @IR(applyIfCPUFeature = {"asimd", "true"},
149         applyIf = {"MaxVectorSize", "16"}, // AD file requires vector_length = 16
150         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
151     @IR(applyIfCPUFeature = {"avx512_vnni", "true"},
152         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI_VNNI, "> 0"})
153     public static int[] testc(int[] out) {
154         for (int i = 0; i < ITER; i++) {
155             out[i] += ((sArr1[2*i] * sArr2[2*i]) + (sArr1[2*i+1] * sArr2[2*i+1]));
156         }
157         return out;
158     }
159 
160     @Test
161     @IR(applyIfCPUFeature = {"sse2", "true"},
162         applyIfPlatform = {"64-bit", "true"},
163         applyIf = { "UseCompactObjectHeaders", "false" },
164         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
165     @IR(applyIfCPUFeature = {"asimd", "true"},
166         applyIfAnd = {"MaxVectorSize", "16", "UseCompactObjectHeaders", "false" }, // AD file requires vector_length = 16
167         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
168     @IR(applyIfCPUFeature = {"avx512_vnni", "true"},
169         applyIf = { "UseCompactObjectHeaders", "false" },
170         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI_VNNI, "> 0"})
171     public static int[] testd(int[] out) {
172         for (int i = 0; i < ITER-2; i+=2) {
173             // Unrolled, with the same structure.
174             out[i+0] += ((sArr1[2*i+0] * sArr2[2*i+0]) + (sArr1[2*i+1] * sArr2[2*i+1]));
175             out[i+1] += ((sArr1[2*i+2] * sArr2[2*i+2]) + (sArr1[2*i+3] * sArr2[2*i+3]));
176         }
177         return out;
178     }
179 
180     @Test
181     @IR(applyIfCPUFeature = {"sse2", "true"},
182         applyIfPlatform = {"64-bit", "true"},
183         applyIf = { "UseCompactObjectHeaders", "false" },
184         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
185     @IR(applyIfCPUFeature = {"asimd", "true"},
186         applyIfAnd = {"MaxVectorSize", "16", "UseCompactObjectHeaders", "false" }, // AD file requires vector_length = 16
187         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
188     @IR(applyIfCPUFeature = {"avx512_vnni", "true"},
189         applyIf = { "UseCompactObjectHeaders", "false" },
190         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI_VNNI, "> 0"})
191     public static int[] teste(int[] out) {
192         for (int i = 0; i < ITER-2; i+=2) {
193             // Unrolled, with some swaps.
194             out[i+0] += ((sArr1[2*i+0] * sArr2[2*i+0]) + (sArr1[2*i+1] * sArr2[2*i+1]));
195             out[i+1] += ((sArr2[2*i+2] * sArr1[2*i+2]) + (sArr1[2*i+3] * sArr2[2*i+3])); // swap(1 2)
196         }
197         return out;
198     }
199 
200     @Test
201     @IR(applyIfCPUFeature = {"sse2", "true"},
202         applyIfPlatform = {"64-bit", "true"},
203         applyIf = { "UseCompactObjectHeaders", "false" },
204         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
205     @IR(applyIfCPUFeature = {"asimd", "true"},
206         applyIfAnd = {"MaxVectorSize", "16", "UseCompactObjectHeaders", "false" }, // AD file requires vector_length = 16
207         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
208     @IR(applyIfCPUFeature = {"avx512_vnni", "true"},
209         applyIf = { "UseCompactObjectHeaders", "false" },
210         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI_VNNI, "> 0"})
211     public static int[] testf(int[] out) {
212         for (int i = 0; i < ITER-2; i+=2) {
213             // Unrolled, with some swaps.
214             out[i+0] += ((sArr1[2*i+0] * sArr2[2*i+0]) + (sArr1[2*i+1] * sArr2[2*i+1]));
215             out[i+1] += ((sArr2[2*i+2] * sArr1[2*i+2]) + (sArr2[2*i+3] * sArr1[2*i+3])); // swap(1 2), swap(3 4)
216         }
217         return out;
218     }
219 
220     @Test
221     @IR(applyIfCPUFeature = {"sse2", "true"},
222         applyIfPlatform = {"64-bit", "true"},
223         applyIf = { "UseCompactObjectHeaders", "false" },
224         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
225     @IR(applyIfCPUFeature = {"asimd", "true"},
226         applyIfAnd = {"MaxVectorSize", "16", "UseCompactObjectHeaders", "false" }, // AD file requires vector_length = 16
227         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
228     @IR(applyIfCPUFeature = {"avx512_vnni", "true"},
229         applyIf = { "UseCompactObjectHeaders", "false" },
230         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI_VNNI, "> 0"})
231     public static int[] testg(int[] out) {
232         for (int i = 0; i < ITER-2; i+=2) {
233             // Unrolled, with some swaps.
234             out[i+0] += ((sArr1[2*i+0] * sArr2[2*i+0]) + (sArr1[2*i+1] * sArr2[2*i+1]));
235             out[i+1] += ((sArr1[2*i+3] * sArr2[2*i+3]) + (sArr1[2*i+2] * sArr2[2*i+2])); // swap(1 3), swap(2 4)
236         }
237         return out;
238     }
239 
240     @Test
241     @IR(applyIfCPUFeature = {"sse2", "true"},
242         applyIfPlatform = {"64-bit", "true"},
243         applyIf = { "UseCompactObjectHeaders", "false" },
244         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
245     @IR(applyIfCPUFeature = {"asimd", "true"},
246         applyIfAnd = {"MaxVectorSize", "16", "UseCompactObjectHeaders", "false" }, // AD file requires vector_length = 16
247         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI, "> 0"})
248     @IR(applyIfCPUFeature = {"avx512_vnni", "true"},
249         applyIf = { "UseCompactObjectHeaders", "false" },
250         counts = {IRNode.MUL_ADD_S2I, "> 0", IRNode.MUL_ADD_VS2VI_VNNI, "> 0"})
251     public static int[] testh(int[] out) {
252         for (int i = 0; i < ITER-2; i+=2) {
253             // Unrolled, with some swaps.
254             out[i+0] += ((sArr1[2*i+0] * sArr2[2*i+0]) + (sArr1[2*i+1] * sArr2[2*i+1]));
255             out[i+1] += ((sArr2[2*i+3] * sArr1[2*i+3]) + (sArr2[2*i+2] * sArr1[2*i+2])); // swap(1 4), swap(2 3)
256         }
257         return out;
258     }
259 
260     @Test
261     @IR(counts = {IRNode.MUL_ADD_S2I, "> 0"},
262         applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
263     @IR(counts = {IRNode.MUL_ADD_VS2VI, "= 0"})
264     public static int[] testi(int[] out) {
265         for (int i = 0; i < ITER-2; i+=2) {
266             // Unrolled, with some swaps that prevent vectorization.
267             out[i+0] += ((sArr1[2*i+0] * sArr2[2*i+0]) + (sArr1[2*i+1] * sArr2[2*i+1])); // ok
268             out[i+1] += ((sArr1[2*i+2] * sArr2[2*i+3]) + (sArr1[2*i+3] * sArr2[2*i+2])); // bad
269         }
< prev index next >