< prev index next >

test/jdk/jdk/incubator/vector/AddTest.java

Print this page
rev 54658 : refactored mask and shuffle creation methods, moved classes to top-level


  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @modules jdk.incubator.vector
  27  */
  28 
  29 import jdk.incubator.vector.FloatVector;
  30 import jdk.incubator.vector.Vector.Shape;
  31 import jdk.incubator.vector.Vector.Species;
  32 import jdk.incubator.vector.Vector;
  33 
  34 import java.util.Arrays;
  35 import java.util.stream.IntStream;
  36 
  37 public class AddTest {
  38     static final Species<Float> SPECIES =
  39             FloatVector.SPECIES_256;
  40 
  41     static final int SIZE = 1024;
  42     static float[] a = new float[SIZE];
  43     static float[] b = new float[SIZE];
  44     static float[] c = new float[SIZE];
  45 
  46     static {
  47         for (int i = 0; i < SIZE; i++) {
  48             a[i] = 1f;
  49             b[i] = 2f;
  50         }
  51     }
  52 
  53     static void workload() {
  54         for (int i = 0; i < a.length; i += SPECIES.length()) {
  55             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
  56             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
  57             av.add(bv).intoArray(c, i);
  58         }




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @modules jdk.incubator.vector
  27  */
  28 
  29 import jdk.incubator.vector.FloatVector;
  30 import jdk.incubator.vector.VectorShape;
  31 import jdk.incubator.vector.VectorSpecies;
  32 import jdk.incubator.vector.Vector;
  33 
  34 import java.util.Arrays;
  35 import java.util.stream.IntStream;
  36 
  37 public class AddTest {
  38     static final VectorSpecies<Float> SPECIES =
  39             FloatVector.SPECIES_256;
  40 
  41     static final int SIZE = 1024;
  42     static float[] a = new float[SIZE];
  43     static float[] b = new float[SIZE];
  44     static float[] c = new float[SIZE];
  45 
  46     static {
  47         for (int i = 0; i < SIZE; i++) {
  48             a[i] = 1f;
  49             b[i] = 2f;
  50         }
  51     }
  52 
  53     static void workload() {
  54         for (int i = 0; i < a.length; i += SPECIES.length()) {
  55             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
  56             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
  57             av.add(bv).intoArray(c, i);
  58         }


< prev index next >