2424/**
2525* @test
2626* @summary Test vectorization of popcount for Long
27- * @run main/othervm -XX:+UsePopCountInstruction compiler.vectorization.TestPopCountVectorLong
28- * @run main/othervm -XX:+UsePopCountInstruction -XX:MaxVectorSize=8 compiler.vectorization.TestPopCountVectorLong
27+ * @library /test/lib /
28+ * @run driver compiler.vectorization.TestPopCountVectorLong
2929*/
3030
3131package compiler .vectorization ;
32+ import compiler .lib .ir_framework .*;
3233import java .util .Random ;
3334
35+
3436public class TestPopCountVectorLong {
3537 private long [] input ;
3638 private int [] output ;
3739 private static final int LEN = 1024 ;
3840 private Random rng ;
3941
4042 public static void main (String args []) {
41- TestPopCountVectorLong test = new TestPopCountVectorLong ();
42-
43- for (int i = 0 ; i < 10_000 ; ++i ) {
44- test .vectorizeBitCount ();
45- }
46- System .out .println ("Checking popcount result" );
47- test .checkResult ();
48-
49- for (int i = 0 ; i < 10_000 ; ++i ) {
50- test .vectorizeBitCount ();
51- }
52- System .out .println ("Checking popcount result" );
53- test .checkResult ();
43+ TestFramework .run (TestPopCountVectorLong .class );
5444 }
5545
5646 public TestPopCountVectorLong () {
@@ -62,10 +52,14 @@ public TestPopCountVectorLong() {
6252 }
6353 }
6454
55+ @ Test // needs to be run in (fast) debug mode
56+ @ Warmup (10000 )
57+ @ IR (counts = {"PopCountVL" , "9" }) //9 PopCountVL nodes are generated for a long[] of LEN=1024
6558 public void vectorizeBitCount () {
6659 for (int i = 0 ; i < LEN ; ++i ) {
6760 output [i ] = Long .bitCount (input [i ]);
6861 }
62+ checkResult ();
6963 }
7064
7165 public void checkResult () {
0 commit comments