Skip to content

Commit e84c6bd

Browse files
committed
Update popcount long test to use IR framework
1 parent 67f2a71 commit e84c6bd

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

src/hotspot/share/opto/superword.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* questions.
2222
*/
2323

24-
#include <iostream>
2524
#include "precompiled.hpp"
2625
#include "compiler/compileLog.hpp"
2726
#include "libadt/vectset.hpp"

test/hotspot/jtreg/compiler/vectorization/TestPopCountVectorLong.java

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,23 @@
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

3131
package compiler.vectorization;
32+
import compiler.lib.ir_framework.*;
3233
import java.util.Random;
3334

35+
3436
public 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

Comments
 (0)