changeset 58915:d7b52a030a56 vectorIntrinsics

8221808: Fix jmh build failure about SumOfUnsignedBytes.java Reviewed-by: vlivanov
author yzhang
date Thu, 11 Apr 2019 16:17:02 +0800
parents 21f94abc4b32
children 3c473783c152 bbc198e97943
files test/jdk/jdk/incubator/vector/benchmark/src/main/java/benchmark/jdk/incubator/vector/SumOfUnsignedBytes.java
diffstat 1 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/jdk/incubator/vector/benchmark/src/main/java/benchmark/jdk/incubator/vector/SumOfUnsignedBytes.java	Wed Apr 10 12:05:46 2019 -0700
+++ b/test/jdk/jdk/incubator/vector/benchmark/src/main/java/benchmark/jdk/incubator/vector/SumOfUnsignedBytes.java	Thu Apr 11 16:17:02 2019 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
 @Fork(value = 1, jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"})
 public class SumOfUnsignedBytes extends AbstractVectorBenchmark {
 
-    @Param({"64", "1024", "65536"})
+    @Param({"64", "1024", "4096"})
     int size;
 
     private byte[] data;
@@ -150,23 +150,25 @@
     // Helpers
     /*
     static ByteVector addSaturated(ByteVector va, ByteVector vb) {
-        return ByteVectorHelper.map(va, vb, (i, a, b) -> {
-            if ((a & 0xFF) + (b & 0xFF) < 0xFF) {
-                return (byte) (a + b);
+        var vc = ByteVector.zero(B256);
+        for (int i = 0; i < B256.length(); i++) {
+            if ((va.get(i) & 0xFF) + (vb.get(i) & 0xFF) < 0xFF) {
+                vc = vc.with(i, (byte)(va.get(i) + vb.get(i)));
             } else {
-                return (byte)0xFF;
+                vc = vc.with(i, (byte)0xFF);
             }
-        });
+        }
+        return vc;
     }
-
     IntVector sumOfAbsoluteDifferences(ByteVector va, ByteVector vb) {
-        var vc = ByteVectorHelper.map(va, vb, (i, a, b) -> {
-            if ((a & 0xFF) > (b & 0xFF)) {
-                return (byte)(a - b);
+        var vc = ByteVector.zero(B256);
+        for (int i = 0; i < B256.length(); i++) {
+            if ((va.get(i) & 0xFF) > (vb.get(i) & 0xFF)) {
+                vc = vc.with(i, (byte)(va.get(i) - vb.get(i)));
             } else {
-                return (byte)(b - a);
+                vc = vc.with(i, (byte)(vb.get(i) - va.get(i)));
             }
-        });
+        }
         return sum(vc);
     } */
 }