< prev index next >

test/compiler/loopopts/superword/TestReductionWithLoopVariantUse.java

Print this page
rev 11557 : 8132919: use package in compiler tests
Reviewed-by: duke


   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  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  * @bug 8080976
  27  * @summary Loop variant use in reduction should prevent vectorization
  28  * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestReductionWithLoopVariantUse
  29  *
  30  */
  31 


  32 public class TestReductionWithLoopVariantUse {
  33     static int m(int[] array) {
  34         int c = 0;
  35         for (int i = 0; i < 256; i++) {
  36             c += array[i];
  37             array[i] = c;
  38         }
  39         return c;
  40     }
  41 
  42     static public void main(String[] args) {
  43         int[] array = new int[256];
  44         int[] array2 = new int[256];
  45         for (int j = 0; j < 256; j++) {
  46             array2[j] = j;
  47         }
  48         for (int i = 0; i < 20000; i++) {
  49             System.arraycopy(array2, 0, array, 0, 256);
  50             int res = m(array);
  51             boolean success = true;


   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  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  * @bug 8080976
  27  * @summary Loop variant use in reduction should prevent vectorization
  28  * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
  29  *      compiler.loopopts.superword.TestReductionWithLoopVariantUse
  30  */
  31 
  32 package compiler.loopopts.superword;
  33 
  34 public class TestReductionWithLoopVariantUse {
  35     static int m(int[] array) {
  36         int c = 0;
  37         for (int i = 0; i < 256; i++) {
  38             c += array[i];
  39             array[i] = c;
  40         }
  41         return c;
  42     }
  43 
  44     static public void main(String[] args) {
  45         int[] array = new int[256];
  46         int[] array2 = new int[256];
  47         for (int j = 0; j < 256; j++) {
  48             array2[j] = j;
  49         }
  50         for (int i = 0; i < 20000; i++) {
  51             System.arraycopy(array2, 0, array, 0, 256);
  52             int res = m(array);
  53             boolean success = true;
< prev index next >