4242 * @key randomness
4343 * @library /test/lib /
4444 * @requires vm.compiler2.enabled
45- * @requires vm.cpu.features ~= ".*asimd.*"
45+ * @requires (os.simpleArch == "aarch64" & vm.cpu.features ~= ".*asimd.*") | (os.simpleArch == "riscv64" & vm.cpu.features ~= ".*zvbb.*")
4646 * @summary AArch64: [vector] Make all bits set vector sharable for match rules
4747 * @modules jdk.incubator.vector
4848 *
@@ -59,6 +59,9 @@ public class AllBitsSetVectorMatchRuleTest {
5959 private static int [] ia ;
6060 private static int [] ib ;
6161 private static int [] ir ;
62+ private static long [] la ;
63+ private static long [] lb ;
64+ private static long [] lr ;
6265 private static boolean [] ma ;
6366 private static boolean [] mb ;
6467 private static boolean [] mc ;
@@ -68,6 +71,9 @@ public class AllBitsSetVectorMatchRuleTest {
6871 ia = new int [LENGTH ];
6972 ib = new int [LENGTH ];
7073 ir = new int [LENGTH ];
74+ la = new long [LENGTH ];
75+ lb = new long [LENGTH ];
76+ lr = new long [LENGTH ];
7177 ma = new boolean [LENGTH ];
7278 mb = new boolean [LENGTH ];
7379 mc = new boolean [LENGTH ];
@@ -76,6 +82,8 @@ public class AllBitsSetVectorMatchRuleTest {
7682 for (int i = 0 ; i < LENGTH ; i ++) {
7783 ia [i ] = RD .nextInt (25 );
7884 ib [i ] = RD .nextInt (25 );
85+ la [i ] = RD .nextLong (25 );
86+ lb [i ] = RD .nextLong (25 );
7987 ma [i ] = RD .nextBoolean ();
8088 mb [i ] = RD .nextBoolean ();
8189 mc [i ] = RD .nextBoolean ();
@@ -98,8 +106,58 @@ public static void testAllBitsSetVector() {
98106
99107 @ Test
100108 @ Warmup (10000 )
101- @ IR (counts = { IRNode .VAND_NOT_L , " >= 1" }, applyIf = {"UseSVE" , "0" })
102- @ IR (counts = { IRNode .VMASK_AND_NOT_L , " >= 1" }, applyIf = {"UseSVE" , "> 0" })
109+ @ IR (counts = { IRNode .VAND_NOT_L , " >= 1" })
110+ public static void testVectorVAndNotL () {
111+ LongVector av = LongVector .fromArray (L_SPECIES , la , 0 );
112+ LongVector bv = LongVector .fromArray (L_SPECIES , lb , 0 );
113+ av .not ().lanewise (VectorOperators .AND_NOT , bv ).intoArray (lr , 0 );
114+
115+ // Verify results
116+ for (int i = 0 ; i < L_SPECIES .length (); i ++) {
117+ Asserts .assertEquals ((~la [i ]) & (~lb [i ]), lr [i ]);
118+ }
119+ }
120+
121+ @ Test
122+ @ Warmup (10000 )
123+ @ IR (counts = { IRNode .VAND_NOT_I_MASKED , " >= 1" }, applyIfPlatform = {"aarch64" , "true" }, applyIf = {"UseSVE" , "> 0" })
124+ @ IR (counts = { IRNode .VAND_NOT_I_MASKED , " >= 1" }, applyIfPlatform = {"riscv64" , "true" })
125+ public static void testVectorVAndNotIMasked () {
126+ VectorMask <Integer > avm = VectorMask .fromArray (I_SPECIES , ma , 0 );
127+ IntVector av = IntVector .fromArray (I_SPECIES , ia , 0 );
128+ IntVector bv = IntVector .fromArray (I_SPECIES , ib , 0 );
129+ av .not ().lanewise (VectorOperators .AND_NOT , bv , avm ).intoArray (ir , 0 );
130+
131+ // Verify results
132+ for (int i = 0 ; i < I_SPECIES .length (); i ++) {
133+ if (ma [i ] == true ) {
134+ Asserts .assertEquals ((~ia [i ]) & (~ib [i ]), ir [i ]);
135+ }
136+ }
137+ }
138+
139+ @ Test
140+ @ Warmup (10000 )
141+ @ IR (counts = { IRNode .VAND_NOT_L_MASKED , " >= 1" }, applyIfPlatform = {"aarch64" , "true" }, applyIf = {"UseSVE" , "> 0" })
142+ @ IR (counts = { IRNode .VAND_NOT_L_MASKED , " >= 1" }, applyIfPlatform = {"riscv64" , "true" })
143+ public static void testVectorVAndNotLMasked () {
144+ VectorMask <Long > avm = VectorMask .fromArray (L_SPECIES , ma , 0 );
145+ LongVector av = LongVector .fromArray (L_SPECIES , la , 0 );
146+ LongVector bv = LongVector .fromArray (L_SPECIES , lb , 0 );
147+ av .not ().lanewise (VectorOperators .AND_NOT , bv , avm ).intoArray (lr , 0 );
148+
149+ // Verify results
150+ for (int i = 0 ; i < L_SPECIES .length (); i ++) {
151+ if (ma [i ] == true ) {
152+ Asserts .assertEquals ((~la [i ]) & (~lb [i ]), lr [i ]);
153+ }
154+ }
155+ }
156+
157+ @ Test
158+ @ Warmup (10000 )
159+ @ IR (counts = { IRNode .VAND_NOT_L , " >= 1" }, applyIfPlatform = {"aarch64" , "true" }, applyIf = {"UseSVE" , "0" })
160+ @ IR (counts = { IRNode .VMASK_AND_NOT_L , " >= 1" }, applyIfPlatform = {"aarch64" , "true" }, applyIf = {"UseSVE" , "> 0" })
103161 public static void testAllBitsSetMask () {
104162 VectorMask <Long > avm = VectorMask .fromArray (L_SPECIES , ma , 0 );
105163 VectorMask <Long > bvm = VectorMask .fromArray (L_SPECIES , mb , 0 );
0 commit comments