< prev index next >

test/jdk/jdk/incubator/vector/templates/Perf-Scalar-Gather-op.template

Print this page
rev 55606 : 8221812: Fine-tune jmh test for vector api
Summary: To compare performance of vector api and auto vectorization, vector
api and scalar test cases are updated to keep aligned.
Reviewed-by: duke

@@ -1,53 +1,57 @@
     @Benchmark
-    public Object gatherBase0() {
+    public void gatherBase0(Blackhole bh) {
         $type$[] as = fa.apply(size);
         int[] is    = fs.apply(size);
         $type$[] rs = fr.apply(size);
 
+        for (int ic = 0; ic < INVOC_COUNT; ic++) {
         for (int i = 0; i < as.length; i++) {
             int ix = 0 + is[i];
             rs[i] = as[ix];
         }
+        }
 
-        return rs;
+        bh.consume(rs);
     }
 
 
-    Object gather(int window) {
+    void gather(int window, Blackhole bh) {
         $type$[] as = fa.apply(size);
         int[] is    = fs.apply(size);
         $type$[] rs = fr.apply(size);
 
+        for (int ic = 0; ic < INVOC_COUNT; ic++) {
         for (int i = 0; i < as.length; i += window) {
             for (int j = 0; j < window; j++) {
                 int ix = i + is[i + j];
                 rs[i + j] = as[ix];
             }
         }
+        }
 
-        return rs;
+        bh.consume(rs);
     }
 
     @Benchmark
-    public Object gather064() {
+    public void gather064(Blackhole bh) {
         int window = 64 / $Wideboxtype$.SIZE;
-        return gather(window);
+        gather(window, bh);
     }
 
     @Benchmark
-    public Object gather128() {
+    public void gather128(Blackhole bh) {
         int window = 128 / $Wideboxtype$.SIZE;
-        return gather(window);
+        gather(window, bh);
     }
 
     @Benchmark
-    public Object gather256() {
+    public void gather256(Blackhole bh) {
         int window = 256 / $Wideboxtype$.SIZE;
-        return gather(window);
+        gather(window, bh);
     }
 
     @Benchmark
-    public Object gather512() {
+    public void gather512(Blackhole bh) {
         int window = 512 / $Wideboxtype$.SIZE;
-        return gather(window);
+        gather(window, bh);
     }
< prev index next >