test/hotspot/jtreg/compiler/eliminateAutobox/TestFloatBoxing.java
changeset 47216 71c04702a3d5
parent 40059 c2304140ed64
equal deleted inserted replaced
47215:4ebc2e2fb97c 47216:71c04702a3d5
       
     1 /*
       
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     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 6934604
       
    27  * @summary enable parts of EliminateAutoBox by default
       
    28  *
       
    29  * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
       
    30  *                   compiler.eliminateAutobox.TestFloatBoxing
       
    31  * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
       
    32  *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::dummy
       
    33  *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::foo
       
    34  *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::foob
       
    35  *                   compiler.eliminateAutobox.TestFloatBoxing
       
    36  * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox
       
    37  *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::dummy
       
    38  *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::foo
       
    39  *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::foob
       
    40  *                   compiler.eliminateAutobox.TestFloatBoxing
       
    41  */
       
    42 
       
    43 package compiler.eliminateAutobox;
       
    44 
       
    45 public class TestFloatBoxing {
       
    46 
       
    47   static final Float ibc = new Float(1.f);
       
    48 
       
    49   //===============================================
       
    50   // Non-inlined methods to test deoptimization info
       
    51   static void  dummy()       { }
       
    52   static float foo(float i)  { return i; }
       
    53   static Float foob(float i) { return Float.valueOf(i); }
       
    54 
       
    55 
       
    56   static float simple(float i) {
       
    57     Float ib = new Float(i);
       
    58     return ib;
       
    59   }
       
    60 
       
    61   static float simpleb(float i) {
       
    62     Float ib = Float.valueOf(i);
       
    63     return ib;
       
    64   }
       
    65 
       
    66   static float simplec() {
       
    67     Float ib = ibc;
       
    68     return ib;
       
    69   }
       
    70 
       
    71   static float simplef(float i) {
       
    72     Float ib = foob(i);
       
    73     return ib;
       
    74   }
       
    75 
       
    76   static float simplep(Float ib) {
       
    77     return ib;
       
    78   }
       
    79 
       
    80   static float simple2(float i) {
       
    81     Float ib1 = new Float(i);
       
    82     Float ib2 = new Float(i+1.f);
       
    83     return ib1 + ib2;
       
    84   }
       
    85 
       
    86   static float simpleb2(float i) {
       
    87     Float ib1 = Float.valueOf(i);
       
    88     Float ib2 = Float.valueOf(i+1.f);
       
    89     return ib1 + ib2;
       
    90   }
       
    91 
       
    92   static float simplem2(float i) {
       
    93     Float ib1 = new Float(i);
       
    94     Float ib2 = Float.valueOf(i+1.f);
       
    95     return ib1 + ib2;
       
    96   }
       
    97 
       
    98   static float simplep2(float i, Float ib1) {
       
    99     Float ib2 = Float.valueOf(i+1.f);
       
   100     return ib1 + ib2;
       
   101   }
       
   102 
       
   103   static float simplec2(float i) {
       
   104     Float ib1 = ibc;
       
   105     Float ib2 = Float.valueOf(i+1.f);
       
   106     return ib1 + ib2;
       
   107   }
       
   108 
       
   109   //===============================================
       
   110   static float test(float f, int i) {
       
   111     Float ib = new Float(f);
       
   112     if ((i&1) == 0)
       
   113       ib = f+1.f;
       
   114     return ib;
       
   115   }
       
   116 
       
   117   static float testb(float f, int i) {
       
   118     Float ib = f;
       
   119     if ((i&1) == 0)
       
   120       ib = (f+1.f);
       
   121     return ib;
       
   122   }
       
   123 
       
   124   static float testm(float f, int i) {
       
   125     Float ib = f;
       
   126     if ((i&1) == 0)
       
   127       ib = new Float(f+1.f);
       
   128     return ib;
       
   129   }
       
   130 
       
   131   static float testp(float f, int i, Float ib) {
       
   132     if ((i&1) == 0)
       
   133       ib = new Float(f+1.f);
       
   134     return ib;
       
   135   }
       
   136 
       
   137   static float testc(float f, int i) {
       
   138     Float ib = ibc;
       
   139     if ((i&1) == 0)
       
   140       ib = new Float(f+1.f);
       
   141     return ib;
       
   142   }
       
   143 
       
   144   static float test2(float f, int i) {
       
   145     Float ib1 = new Float(f);
       
   146     Float ib2 = new Float(f+1.f);
       
   147     if ((i&1) == 0) {
       
   148       ib1 = new Float(f+1.f);
       
   149       ib2 = new Float(f+2.f);
       
   150     }
       
   151     return ib1+ib2;
       
   152   }
       
   153 
       
   154   static float testb2(float f, int i) {
       
   155     Float ib1 = f;
       
   156     Float ib2 = f+1.f;
       
   157     if ((i&1) == 0) {
       
   158       ib1 = (f+1.f);
       
   159       ib2 = (f+2.f);
       
   160     }
       
   161     return ib1+ib2;
       
   162   }
       
   163 
       
   164   static float testm2(float f, int i) {
       
   165     Float ib1 = new Float(f);
       
   166     Float ib2 = f+1.f;
       
   167     if ((i&1) == 0) {
       
   168       ib1 = new Float(f+1.f);
       
   169       ib2 = (f+2.f);
       
   170     }
       
   171     return ib1+ib2;
       
   172   }
       
   173 
       
   174   static float testp2(float f, int i, Float ib1) {
       
   175     Float ib2 = f+1.f;
       
   176     if ((i&1) == 0) {
       
   177       ib1 = new Float(f+1.f);
       
   178       ib2 = (f+2.f);
       
   179     }
       
   180     return ib1+ib2;
       
   181   }
       
   182 
       
   183   static float testc2(float f, int i) {
       
   184     Float ib1 = ibc;
       
   185     Float ib2 = f+1.f;
       
   186     if ((i&1) == 0) {
       
   187       ib1 = (ibc+1.f);
       
   188       ib2 = (f+2.f);
       
   189     }
       
   190     return ib1+ib2;
       
   191   }
       
   192 
       
   193   //===============================================
       
   194   static float sum(float[] a) {
       
   195     float result = 1.f;
       
   196     for (Float i : a)
       
   197         result += i;
       
   198     return result;
       
   199   }
       
   200 
       
   201   static float sumb(float[] a) {
       
   202     Float result = 1.f;
       
   203     for (Float i : a)
       
   204         result += i;
       
   205     return result;
       
   206   }
       
   207 
       
   208   static float sumc(float[] a) {
       
   209     Float result = ibc;
       
   210     for (Float i : a)
       
   211         result += i;
       
   212     return result;
       
   213   }
       
   214 
       
   215   static float sumf(float[] a) {
       
   216     Float result = foob(1.f);
       
   217     for (Float i : a)
       
   218         result += i;
       
   219     return result;
       
   220   }
       
   221 
       
   222   static float sump(float[] a, Float result) {
       
   223     for (Float i : a)
       
   224         result += i;
       
   225     return result;
       
   226   }
       
   227 
       
   228   static float sum2(float[] a) {
       
   229     float result1 = 1.f;
       
   230     float result2 = 1.f;
       
   231     for (Float i : a) {
       
   232         result1 += i;
       
   233         result2 += i + 1.f;
       
   234     }
       
   235     return result1 + result2;
       
   236   }
       
   237 
       
   238   static float sumb2(float[] a) {
       
   239     Float result1 = 1.f;
       
   240     Float result2 = 1.f;
       
   241     for (Float i : a) {
       
   242         result1 += i;
       
   243         result2 += i + 1.f;
       
   244     }
       
   245     return result1 + result2;
       
   246   }
       
   247 
       
   248   static float summ2(float[] a) {
       
   249     Float result1 = 1.f;
       
   250     Float result2 = new Float(1.f);
       
   251     for (Float i : a) {
       
   252         result1 += i;
       
   253         result2 += new Float(i + 1.f);
       
   254     }
       
   255     return result1 + result2;
       
   256   }
       
   257 
       
   258   static float sump2(float[] a, Float result2) {
       
   259     Float result1 = 1.f;
       
   260     for (Float i : a) {
       
   261         result1 += i;
       
   262         result2 += i + 1.f;
       
   263     }
       
   264     return result1 + result2;
       
   265   }
       
   266 
       
   267   static float sumc2(float[] a) {
       
   268     Float result1 = 1.f;
       
   269     Float result2 = ibc;
       
   270     for (Float i : a) {
       
   271         result1 += i;
       
   272         result2 += i + ibc;
       
   273     }
       
   274     return result1 + result2;
       
   275   }
       
   276 
       
   277   //===============================================
       
   278   static float remi_sum() {
       
   279     Float j = new Float(1.f);
       
   280     for (int i = 0; i< 1000; i++) {
       
   281       j = new Float(j + 1.f);
       
   282     }
       
   283     return j;
       
   284   }
       
   285 
       
   286   static float remi_sumb() {
       
   287     Float j = Float.valueOf(1.f);
       
   288     for (int i = 0; i< 1000; i++) {
       
   289       j = j + 1.f;
       
   290     }
       
   291     return j;
       
   292   }
       
   293 
       
   294   static float remi_sumf() {
       
   295     Float j = foob(1.f);
       
   296     for (int i = 0; i< 1000; i++) {
       
   297       j = j + 1.f;
       
   298     }
       
   299     return j;
       
   300   }
       
   301 
       
   302   static float remi_sump(Float j) {
       
   303     for (int i = 0; i< 1000; i++) {
       
   304       j = new Float(j + 1.f);
       
   305     }
       
   306     return j;
       
   307   }
       
   308 
       
   309   static float remi_sumc() {
       
   310     Float j = ibc;
       
   311     for (int i = 0; i< 1000; i++) {
       
   312       j = j + ibc;
       
   313     }
       
   314     return j;
       
   315   }
       
   316 
       
   317   static float remi_sum2() {
       
   318     Float j1 = new Float(1.f);
       
   319     Float j2 = new Float(1.f);
       
   320     for (int i = 0; i< 1000; i++) {
       
   321       j1 = new Float(j1 + 1.f);
       
   322       j2 = new Float(j2 + 2.f);
       
   323     }
       
   324     return j1 + j2;
       
   325   }
       
   326 
       
   327   static float remi_sumb2() {
       
   328     Float j1 = Float.valueOf(1.f);
       
   329     Float j2 = Float.valueOf(1.f);
       
   330     for (int i = 0; i< 1000; i++) {
       
   331       j1 = j1 + 1.f;
       
   332       j2 = j2 + 2.f;
       
   333     }
       
   334     return j1 + j2;
       
   335   }
       
   336 
       
   337   static float remi_summ2() {
       
   338     Float j1 = new Float(1.f);
       
   339     Float j2 = Float.valueOf(1.f);
       
   340     for (int i = 0; i< 1000; i++) {
       
   341       j1 = new Float(j1 + 1.f);
       
   342       j2 = j2 + 2.f;
       
   343     }
       
   344     return j1 + j2;
       
   345   }
       
   346 
       
   347   static float remi_sump2(Float j1) {
       
   348     Float j2 = Float.valueOf(1.f);
       
   349     for (int i = 0; i< 1000; i++) {
       
   350       j1 = new Float(j1 + 1.f);
       
   351       j2 = j2 + 2.f;
       
   352     }
       
   353     return j1 + j2;
       
   354   }
       
   355 
       
   356   static float remi_sumc2() {
       
   357     Float j1 = ibc;
       
   358     Float j2 = Float.valueOf(1.f);
       
   359     for (int i = 0; i< 1000; i++) {
       
   360       j1 = j1 + ibc;
       
   361       j2 = j2 + 2.f;
       
   362     }
       
   363     return j1 + j2;
       
   364   }
       
   365 
       
   366 
       
   367   //===============================================
       
   368   // Safepointa and debug info for deoptimization
       
   369   static float simple_deop(float i) {
       
   370     Float ib = new Float(foo(i));
       
   371     dummy();
       
   372     return ib;
       
   373   }
       
   374 
       
   375   static float simpleb_deop(float i) {
       
   376     Float ib = Float.valueOf(foo(i));
       
   377     dummy();
       
   378     return ib;
       
   379   }
       
   380 
       
   381   static float simplef_deop(float i) {
       
   382     Float ib = foob(i);
       
   383     dummy();
       
   384     return ib;
       
   385   }
       
   386 
       
   387   static float simplep_deop(Float ib) {
       
   388     dummy();
       
   389     return ib;
       
   390   }
       
   391 
       
   392   static float simplec_deop(float i) {
       
   393     Float ib = ibc;
       
   394     dummy();
       
   395     return ib;
       
   396   }
       
   397 
       
   398   static float test_deop(float f, int i) {
       
   399     Float ib = new Float(foo(f));
       
   400     if ((i&1) == 0)
       
   401       ib = foo(f+1.f);
       
   402     dummy();
       
   403     return ib;
       
   404   }
       
   405 
       
   406   static float testb_deop(float f, int i) {
       
   407     Float ib = foo(f);
       
   408     if ((i&1) == 0)
       
   409       ib = foo(f+1.f);
       
   410     dummy();
       
   411     return ib;
       
   412   }
       
   413 
       
   414   static float testf_deop(float f, int i) {
       
   415     Float ib = foob(f);
       
   416     if ((i&1) == 0)
       
   417       ib = foo(f+1.f);
       
   418     dummy();
       
   419     return ib;
       
   420   }
       
   421 
       
   422   static float testp_deop(float f, int i, Float ib) {
       
   423     if ((i&1) == 0)
       
   424       ib = foo(f+1.f);
       
   425     dummy();
       
   426     return ib;
       
   427   }
       
   428 
       
   429   static float testc_deop(float f, int i) {
       
   430     Float ib = ibc;
       
   431     if ((i&1) == 0)
       
   432       ib = foo(f+1.f);
       
   433     dummy();
       
   434     return ib;
       
   435   }
       
   436 
       
   437   static float sum_deop(float[] a) {
       
   438     float result = 1.f;
       
   439     for (Float i : a)
       
   440         result += foo(i);
       
   441     dummy();
       
   442     return result;
       
   443   }
       
   444 
       
   445   static float sumb_deop(float[] a) {
       
   446     Float result = 1.f;
       
   447     for (Float i : a)
       
   448         result += foo(i);
       
   449     dummy();
       
   450     return result;
       
   451   }
       
   452 
       
   453   static float sumf_deop(float[] a) {
       
   454     Float result = 1.f;
       
   455     for (Float i : a)
       
   456         result += foob(i);
       
   457     dummy();
       
   458     return result;
       
   459   }
       
   460 
       
   461   static float sump_deop(float[] a, Float result) {
       
   462     for (Float i : a)
       
   463         result += foob(i);
       
   464     dummy();
       
   465     return result;
       
   466   }
       
   467 
       
   468   static float sumc_deop(float[] a) {
       
   469     Float result = ibc;
       
   470     for (Float i : a)
       
   471         result += foo(i);
       
   472     dummy();
       
   473     return result;
       
   474   }
       
   475 
       
   476   static float remi_sum_deop() {
       
   477     Float j = new Float(foo(1.f));
       
   478     for (int i = 0; i< 1000; i++) {
       
   479       j = new Float(foo(j + 1.f));
       
   480     }
       
   481     dummy();
       
   482     return j;
       
   483   }
       
   484 
       
   485   static float remi_sumb_deop() {
       
   486     Float j = Float.valueOf(foo(1.f));
       
   487     for (int i = 0; i< 1000; i++) {
       
   488       j = foo(j + 1.f);
       
   489     }
       
   490     dummy();
       
   491     return j;
       
   492   }
       
   493 
       
   494   static float remi_sumf_deop() {
       
   495     Float j = foob(1.f);
       
   496     for (int i = 0; i< 1000; i++) {
       
   497       j = foo(j + 1.f);
       
   498     }
       
   499     dummy();
       
   500     return j;
       
   501   }
       
   502 
       
   503   static float remi_sump_deop(Float j) {
       
   504     for (int i = 0; i< 1000; i++) {
       
   505       j = foo(j + 1.f);
       
   506     }
       
   507     dummy();
       
   508     return j;
       
   509   }
       
   510 
       
   511   static float remi_sumc_deop() {
       
   512     Float j = ibc;
       
   513     for (int i = 0; i< 1000; i++) {
       
   514       j = foo(j + 1.f);
       
   515     }
       
   516     dummy();
       
   517     return j;
       
   518   }
       
   519 
       
   520   //===============================================
       
   521   // Conditional increment
       
   522   static float remi_sum_cond() {
       
   523     Float j = new Float(1.f);
       
   524     for (int i = 0; i< 1000; i++) {
       
   525       if ((i&1) == 0) {
       
   526         j = new Float(j + 1.f);
       
   527       }
       
   528     }
       
   529     return j;
       
   530   }
       
   531 
       
   532   static float remi_sumb_cond() {
       
   533     Float j = Float.valueOf(1.f);
       
   534     for (int i = 0; i< 1000; i++) {
       
   535       if ((i&1) == 0) {
       
   536         j = j + 1.f;
       
   537       }
       
   538     }
       
   539     return j;
       
   540   }
       
   541 
       
   542   static float remi_sumf_cond() {
       
   543     Float j = foob(1.f);
       
   544     for (int i = 0; i< 1000; i++) {
       
   545       if ((i&1) == 0) {
       
   546         j = j + 1.f;
       
   547       }
       
   548     }
       
   549     return j;
       
   550   }
       
   551 
       
   552   static float remi_sump_cond(Float j) {
       
   553     for (int i = 0; i< 1000; i++) {
       
   554       if ((i&1) == 0) {
       
   555         j = j + 1.f;
       
   556       }
       
   557     }
       
   558     return j;
       
   559   }
       
   560 
       
   561   static float remi_sumc_cond() {
       
   562     Float j = ibc;
       
   563     for (int i = 0; i< 1000; i++) {
       
   564       if ((i&1) == 0) {
       
   565         j = j + ibc;
       
   566       }
       
   567     }
       
   568     return j;
       
   569   }
       
   570 
       
   571   static float remi_sum2_cond() {
       
   572     Float j1 = new Float(1.f);
       
   573     Float j2 = new Float(1.f);
       
   574     for (int i = 0; i< 1000; i++) {
       
   575       if ((i&1) == 0) {
       
   576         j1 = new Float(j1 + 1.f);
       
   577       } else {
       
   578         j2 = new Float(j2 + 2.f);
       
   579       }
       
   580     }
       
   581     return j1 + j2;
       
   582   }
       
   583 
       
   584   static float remi_sumb2_cond() {
       
   585     Float j1 = Float.valueOf(1.f);
       
   586     Float j2 = Float.valueOf(1.f);
       
   587     for (int i = 0; i< 1000; i++) {
       
   588       if ((i&1) == 0) {
       
   589         j1 = j1 + 1.f;
       
   590       } else {
       
   591         j2 = j2 + 2.f;
       
   592       }
       
   593     }
       
   594     return j1 + j2;
       
   595   }
       
   596 
       
   597   static float remi_summ2_cond() {
       
   598     Float j1 = new Float(1.f);
       
   599     Float j2 = Float.valueOf(1.f);
       
   600     for (int i = 0; i< 1000; i++) {
       
   601       if ((i&1) == 0) {
       
   602         j1 = new Float(j1 + 1.f);
       
   603       } else {
       
   604         j2 = j2 + 2.f;
       
   605       }
       
   606     }
       
   607     return j1 + j2;
       
   608   }
       
   609 
       
   610   static float remi_sump2_cond(Float j1) {
       
   611     Float j2 = Float.valueOf(1.f);
       
   612     for (int i = 0; i< 1000; i++) {
       
   613       if ((i&1) == 0) {
       
   614         j1 = new Float(j1 + 1.f);
       
   615       } else {
       
   616         j2 = j2 + 2.f;
       
   617       }
       
   618     }
       
   619     return j1 + j2;
       
   620   }
       
   621 
       
   622   static float remi_sumc2_cond() {
       
   623     Float j1 = ibc;
       
   624     Float j2 = Float.valueOf(1.f);
       
   625     for (int i = 0; i< 1000; i++) {
       
   626       if ((i&1) == 0) {
       
   627         j1 = j1 + ibc;
       
   628       } else {
       
   629         j2 = j2 + 2;
       
   630       }
       
   631     }
       
   632     return j1 + j2;
       
   633   }
       
   634 
       
   635 
       
   636   public static void main(String[] args) {
       
   637     final int ntests = 70;
       
   638 
       
   639     String[] test_name = new String[] {
       
   640         "simple",      "simpleb",      "simplec",      "simplef",      "simplep",
       
   641         "simple2",     "simpleb2",     "simplec2",     "simplem2",     "simplep2",
       
   642         "simple_deop", "simpleb_deop", "simplec_deop", "simplef_deop", "simplep_deop",
       
   643         "test",        "testb",        "testc",        "testm",        "testp",
       
   644         "test2",       "testb2",       "testc2",       "testm2",       "testp2",
       
   645         "test_deop",   "testb_deop",   "testc_deop",   "testf_deop",   "testp_deop",
       
   646         "sum",         "sumb",         "sumc",         "sumf",         "sump",
       
   647         "sum2",        "sumb2",        "sumc2",        "summ2",        "sump2",
       
   648         "sum_deop",    "sumb_deop",    "sumc_deop",    "sumf_deop",    "sump_deop",
       
   649         "remi_sum",       "remi_sumb",       "remi_sumc",       "remi_sumf",       "remi_sump",
       
   650         "remi_sum2",      "remi_sumb2",      "remi_sumc2",      "remi_summ2",      "remi_sump2",
       
   651         "remi_sum_deop",  "remi_sumb_deop",  "remi_sumc_deop",  "remi_sumf_deop",  "remi_sump_deop",
       
   652         "remi_sum_cond",  "remi_sumb_cond",  "remi_sumc_cond",  "remi_sumf_cond",  "remi_sump_cond",
       
   653         "remi_sum2_cond", "remi_sumb2_cond", "remi_sumc2_cond", "remi_summ2_cond", "remi_sump2_cond"
       
   654     };
       
   655 
       
   656     final float[] val = new float[] {
       
   657        71990896.f,  71990896.f,    12000.f,  71990896.f,  71990896.f,
       
   658       144000000.f, 144000000.f, 72014896.f, 144000000.f, 144000000.f,
       
   659        71990896.f,  71990896.f,    12000.f,  71990896.f,  71990896.f,
       
   660        72000000.f,  72000000.f, 36004096.f,  72000000.f,  72000000.f,
       
   661       144012288.f, 144012288.f, 72033096.f, 144012288.f, 144012288.f,
       
   662        72000000.f,  72000000.f, 36004096.f,  72000000.f,  72000000.f,
       
   663          499501.f,    499501.f,   499501.f,    499501.f,    499501.f,
       
   664         1000002.f,   1000002.f,  1000002.f,   1000002.f,   1000002.f,
       
   665          499501.f,    499501.f,   499501.f,    499501.f,    499501.f,
       
   666            1001.f,      1001.f,     1001.f,      1001.f,      1001.f,
       
   667            3002.f,      3002.f,     3002.f,      3002.f,      3002.f,
       
   668            1001.f,      1001.f,     1001.f,      1001.f,      1001.f,
       
   669             501.f,       501.f,      501.f,       501.f,       501.f,
       
   670            1502.f,      1502.f,     1502.f,      1502.f,      1502.f
       
   671     };
       
   672 
       
   673     float[] res = new float[ntests];
       
   674     for (int i = 0; i < ntests; i++) {
       
   675       res[i] = 0.f;
       
   676     }
       
   677 
       
   678 
       
   679     for (int i = 0; i < 12000; i++) {
       
   680       res[0] += simple(i);
       
   681       res[1] += simpleb(i);
       
   682       res[2] += simplec();
       
   683       res[3] += simplef(i);
       
   684       res[4] += simplep((float)i);
       
   685 
       
   686       res[5] += simple2((float)i);
       
   687       res[6] += simpleb2((float)i);
       
   688       res[7] += simplec2((float)i);
       
   689       res[8] += simplem2((float)i);
       
   690       res[9] += simplep2((float)i, (float)i);
       
   691 
       
   692       res[10] += simple_deop((float)i);
       
   693       res[11] += simpleb_deop((float)i);
       
   694       res[12] += simplec_deop((float)i);
       
   695       res[13] += simplef_deop((float)i);
       
   696       res[14] += simplep_deop((float)i);
       
   697 
       
   698       res[15] += test((float)i, i);
       
   699       res[16] += testb((float)i, i);
       
   700       res[17] += testc((float)i, i);
       
   701       res[18] += testm((float)i, i);
       
   702       res[19] += testp((float)i, i, (float)i);
       
   703 
       
   704       res[20] += test2((float)i, i);
       
   705       res[21] += testb2((float)i, i);
       
   706       res[22] += testc2((float)i, i);
       
   707       res[23] += testm2((float)i, i);
       
   708       res[24] += testp2((float)i, i, (float)i);
       
   709 
       
   710       res[25] += test_deop((float)i, i);
       
   711       res[26] += testb_deop((float)i, i);
       
   712       res[27] += testc_deop((float)i, i);
       
   713       res[28] += testf_deop((float)i, i);
       
   714       res[29] += testp_deop((float)i, i, (float)i);
       
   715     }
       
   716 
       
   717     float[] ia = new float[1000];
       
   718     for (int i = 0; i < 1000; i++) {
       
   719       ia[i] = i;
       
   720     }
       
   721 
       
   722     for (int i = 0; i < 100; i++) {
       
   723       res[30] = sum(ia);
       
   724       res[31] = sumb(ia);
       
   725       res[32] = sumc(ia);
       
   726       res[33] = sumf(ia);
       
   727       res[34] = sump(ia, 1.f);
       
   728 
       
   729       res[35] = sum2(ia);
       
   730       res[36] = sumb2(ia);
       
   731       res[37] = sumc2(ia);
       
   732       res[38] = summ2(ia);
       
   733       res[39] = sump2(ia, 1.f);
       
   734 
       
   735       res[40] = sum_deop(ia);
       
   736       res[41] = sumb_deop(ia);
       
   737       res[42] = sumc_deop(ia);
       
   738       res[43] = sumf_deop(ia);
       
   739       res[44] = sump_deop(ia, 1.f);
       
   740 
       
   741       res[45] = remi_sum();
       
   742       res[46] = remi_sumb();
       
   743       res[47] = remi_sumc();
       
   744       res[48] = remi_sumf();
       
   745       res[49] = remi_sump(1.f);
       
   746 
       
   747       res[50] = remi_sum2();
       
   748       res[51] = remi_sumb2();
       
   749       res[52] = remi_sumc2();
       
   750       res[53] = remi_summ2();
       
   751       res[54] = remi_sump2(1.f);
       
   752 
       
   753       res[55] = remi_sum_deop();
       
   754       res[56] = remi_sumb_deop();
       
   755       res[57] = remi_sumc_deop();
       
   756       res[58] = remi_sumf_deop();
       
   757       res[59] = remi_sump_deop(1.f);
       
   758 
       
   759       res[60] = remi_sum_cond();
       
   760       res[61] = remi_sumb_cond();
       
   761       res[62] = remi_sumc_cond();
       
   762       res[63] = remi_sumf_cond();
       
   763       res[64] = remi_sump_cond(1.f);
       
   764 
       
   765       res[65] = remi_sum2_cond();
       
   766       res[66] = remi_sumb2_cond();
       
   767       res[67] = remi_sumc2_cond();
       
   768       res[68] = remi_summ2_cond();
       
   769       res[69] = remi_sump2_cond(1.f);
       
   770     }
       
   771 
       
   772     int failed = 0;
       
   773     for (int i = 0; i < ntests; i++) {
       
   774       if (res[i] != val[i]) {
       
   775         System.err.println(test_name[i] + ": " + res[i] + " != " + val[i]);
       
   776         failed++;
       
   777       }
       
   778     }
       
   779     if (failed > 0) {
       
   780       System.err.println("Failed " + failed + " tests.");
       
   781       throw new InternalError();
       
   782     } else {
       
   783       System.out.println("Passed.");
       
   784     }
       
   785   }
       
   786 }