|
| 1 | +/* |
| 2 | + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | + * |
| 5 | + * This code is free software; you can redistribute it and/or modify it |
| 6 | + * under the terms of the GNU General Public License version 2 only, as |
| 7 | + * published by the Free Software Foundation. |
| 8 | + * |
| 9 | + * This code is distributed in the hope that it will be useful, but WITHOUT |
| 10 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 | + * version 2 for more details (a copy is included in the LICENSE file that |
| 13 | + * accompanied this code). |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU General Public License version |
| 16 | + * 2 along with this work; if not, write to the Free Software Foundation, |
| 17 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | + * |
| 19 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 20 | + * or visit www.oracle.com if you need additional information or have any |
| 21 | + * questions. |
| 22 | + */ |
| 23 | +package compiler.vectorapi; |
| 24 | + |
| 25 | +import compiler.lib.ir_framework.*; |
| 26 | +import jdk.incubator.vector.*; |
| 27 | + |
| 28 | +/* |
| 29 | + * @test |
| 30 | + * @bug 8337791 |
| 31 | + * @summary Test byte vector predicated ABS with UseAVX=0 and MaxVectorSize=8 |
| 32 | + * @modules jdk.incubator.vector |
| 33 | + * @library /test/lib / |
| 34 | + * @run driver compiler.vectorapi.TestABSMaskedMaxByteVector |
| 35 | + */ |
| 36 | + |
| 37 | +public class TestABSMaskedMaxByteVector { |
| 38 | + public static final VectorSpecies<Byte> BSP = ByteVector.SPECIES_MAX; |
| 39 | + public static int idx = 0; |
| 40 | + |
| 41 | + public static void main(String[] args) { |
| 42 | + TestFramework.runWithFlags("--add-modules=jdk.incubator.vector", "-ea", "-XX:+IgnoreUnrecognizedVMOptions", "-XX:UseAVX=0", "-XX:MaxVectorSize=8"); |
| 43 | + TestFramework.runWithFlags("--add-modules=jdk.incubator.vector", "-ea"); |
| 44 | + } |
| 45 | + |
| 46 | + @Test |
| 47 | + @IR(failOn = {IRNode.ABS_VB}, applyIfAnd = {"MaxVectorSize", " <= 8 ", "UseAVX", "0"}, applyIfPlatform = {"x64", "true"}, applyIfCPUFeature = {"sse4.1", "true"}) |
| 48 | + @IR(counts = {IRNode.ABS_VB, "1"}, applyIf = {"MaxVectorSize", " > 8 "}, applyIfPlatform = {"x64", "true"}, applyIfCPUFeature = {"sse4.1", "true"}) |
| 49 | + public void test() { |
| 50 | + assert ByteVector.broadcast(BSP, (byte)-4) |
| 51 | + .lanewise(VectorOperators.ABS, VectorMask.fromLong(BSP, 0xF)) |
| 52 | + .lane(idx++ & 3) == 4; |
| 53 | + } |
| 54 | +} |
0 commit comments