< prev index next >

test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2018, 2025, 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
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -61,10 +61,12 @@
      static final VectorSpecies<Short> SPECIES =
                  ShortVector.SPECIES_MAX;
  
      static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
  
+     static ShortVector bcast_vec = ShortVector.broadcast(SPECIES, (short)10);
+ 
      static VectorShape getMaxBit() {
          return VectorShape.S_Max_BIT;
      }
  
      private static final int Max = 256;  // juts so we can do N/Max

@@ -3026,110 +3028,98 @@
  
          assertShiftConstEquals(r, a, mask, ShortMaxVectorTests::ROL_binary_const);
      }
  
  
-     static ShortVector bv_MIN = ShortVector.broadcast(SPECIES, (short)10);
- 
      @Test(dataProvider = "shortUnaryOpProvider")
      static void MINShortMaxVectorTestsWithMemOp(IntFunction<short[]> fa) {
          short[] a = fa.apply(SPECIES.length());
          short[] r = fr.apply(SPECIES.length());
  
          for (int ic = 0; ic < INVOC_COUNT; ic++) {
              for (int i = 0; i < a.length; i += SPECIES.length()) {
                  ShortVector av = ShortVector.fromArray(SPECIES, a, i);
-                 av.lanewise(VectorOperators.MIN, bv_MIN).intoArray(r, i);
+                 av.lanewise(VectorOperators.MIN, bcast_vec).intoArray(r, i);
              }
          }
  
          assertArraysEquals(r, a, (short)10, ShortMaxVectorTests::MIN);
      }
  
-     static ShortVector bv_min = ShortVector.broadcast(SPECIES, (short)10);
- 
      @Test(dataProvider = "shortUnaryOpProvider")
      static void minShortMaxVectorTestsWithMemOp(IntFunction<short[]> fa) {
          short[] a = fa.apply(SPECIES.length());
          short[] r = fr.apply(SPECIES.length());
  
          for (int ic = 0; ic < INVOC_COUNT; ic++) {
              for (int i = 0; i < a.length; i += SPECIES.length()) {
                  ShortVector av = ShortVector.fromArray(SPECIES, a, i);
-                 av.min(bv_min).intoArray(r, i);
+                 av.min(bcast_vec).intoArray(r, i);
              }
          }
  
          assertArraysEquals(r, a, (short)10, ShortMaxVectorTests::min);
      }
  
-     static ShortVector bv_MIN_M = ShortVector.broadcast(SPECIES, (short)10);
- 
      @Test(dataProvider = "shortUnaryOpMaskProvider")
      static void MINShortMaxVectorTestsMaskedWithMemOp(IntFunction<short[]> fa, IntFunction<boolean[]> fm) {
          short[] a = fa.apply(SPECIES.length());
          short[] r = fr.apply(SPECIES.length());
          boolean[] mask = fm.apply(SPECIES.length());
          VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
  
          for (int ic = 0; ic < INVOC_COUNT; ic++) {
              for (int i = 0; i < a.length; i += SPECIES.length()) {
                  ShortVector av = ShortVector.fromArray(SPECIES, a, i);
-                 av.lanewise(VectorOperators.MIN, bv_MIN_M, vmask).intoArray(r, i);
+                 av.lanewise(VectorOperators.MIN, bcast_vec, vmask).intoArray(r, i);
              }
          }
  
          assertArraysEquals(r, a, (short)10, mask, ShortMaxVectorTests::MIN);
      }
  
-     static ShortVector bv_MAX = ShortVector.broadcast(SPECIES, (short)10);
- 
      @Test(dataProvider = "shortUnaryOpProvider")
      static void MAXShortMaxVectorTestsWithMemOp(IntFunction<short[]> fa) {
          short[] a = fa.apply(SPECIES.length());
          short[] r = fr.apply(SPECIES.length());
  
          for (int ic = 0; ic < INVOC_COUNT; ic++) {
              for (int i = 0; i < a.length; i += SPECIES.length()) {
                  ShortVector av = ShortVector.fromArray(SPECIES, a, i);
-                 av.lanewise(VectorOperators.MAX, bv_MAX).intoArray(r, i);
+                 av.lanewise(VectorOperators.MAX, bcast_vec).intoArray(r, i);
              }
          }
  
          assertArraysEquals(r, a, (short)10, ShortMaxVectorTests::MAX);
      }
  
-     static ShortVector bv_max = ShortVector.broadcast(SPECIES, (short)10);
- 
      @Test(dataProvider = "shortUnaryOpProvider")
      static void maxShortMaxVectorTestsWithMemOp(IntFunction<short[]> fa) {
          short[] a = fa.apply(SPECIES.length());
          short[] r = fr.apply(SPECIES.length());
  
          for (int ic = 0; ic < INVOC_COUNT; ic++) {
              for (int i = 0; i < a.length; i += SPECIES.length()) {
                  ShortVector av = ShortVector.fromArray(SPECIES, a, i);
-                 av.max(bv_max).intoArray(r, i);
+                 av.max(bcast_vec).intoArray(r, i);
              }
          }
  
          assertArraysEquals(r, a, (short)10, ShortMaxVectorTests::max);
      }
  
-     static ShortVector bv_MAX_M = ShortVector.broadcast(SPECIES, (short)10);
- 
      @Test(dataProvider = "shortUnaryOpMaskProvider")
      static void MAXShortMaxVectorTestsMaskedWithMemOp(IntFunction<short[]> fa, IntFunction<boolean[]> fm) {
          short[] a = fa.apply(SPECIES.length());
          short[] r = fr.apply(SPECIES.length());
          boolean[] mask = fm.apply(SPECIES.length());
          VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, mask, 0);
  
          for (int ic = 0; ic < INVOC_COUNT; ic++) {
              for (int i = 0; i < a.length; i += SPECIES.length()) {
                  ShortVector av = ShortVector.fromArray(SPECIES, a, i);
-                 av.lanewise(VectorOperators.MAX, bv_MAX_M, vmask).intoArray(r, i);
+                 av.lanewise(VectorOperators.MAX, bcast_vec, vmask).intoArray(r, i);
              }
          }
  
          assertArraysEquals(r, a, (short)10, mask, ShortMaxVectorTests::MAX);
      }
< prev index next >