< prev index next >

test/compiler/c2/TestMultiplyLongHiZero.java

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


   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 /*
  26  * @test
  27  * @bug 6921969
  28  * @summary Tests shorter long multiply sequences when the high 32 bits of long operands are known to be zero on x86_32
  29  * @run main/othervm -Xbatch -XX:-Inline -XX:CompileOnly=.testNormal,.testLeftOptimized,.testRightOptimized,.testOptimized,.testLeftOptimized_LoadUI2L,.testRightOptimized_LoadUI2L,.testOptimized_LoadUI2L TestMultiplyLongHiZero








  30  */
  31 
  32 // This test must run without any command line arguments.
  33 

  34 public class TestMultiplyLongHiZero {
  35 
  36   private static void check(long leftFactor, long rightFactor, long optimizedProduct, long constantProduct) {
  37     long normalProduct = leftFactor * rightFactor; // unaffected by the new optimization
  38     if (optimizedProduct != constantProduct || normalProduct != constantProduct) {
  39       throw new RuntimeException("Not all three products are equal: " +
  40                                  Long.toHexString(normalProduct) + ", " +
  41                                  Long.toHexString(optimizedProduct) + ", " +
  42                                  Long.toHexString(constantProduct));
  43     }
  44   }
  45 
  46   private static int initInt(String[] args, int v) {
  47     if (args.length > 0) {
  48       try {
  49         return Integer.valueOf(args[0]);
  50       } catch (NumberFormatException e) { }
  51     }
  52     return v;
  53   }




   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 /*
  26  * @test
  27  * @bug 6921969
  28  * @summary Tests shorter long multiply sequences when the high 32 bits of long operands are known to be zero on x86_32
  29  * @run main/othervm -Xbatch -XX:-Inline
  30  *    -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testNormal
  31  *    -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testLeftOptimized
  32  *    -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testRightOptimized
  33  *    -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testOptimized
  34  *    -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testLeftOptimized_LoadUI2L
  35  *    -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testRightOptimized_LoadUI2L
  36  *    -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testOptimized_LoadUI2L
  37  *    compiler.c2.TestMultiplyLongHiZero
  38  */
  39 
  40 package compiler.c2;
  41 
  42 // This test must run without any command line arguments.
  43 public class TestMultiplyLongHiZero {
  44 
  45   private static void check(long leftFactor, long rightFactor, long optimizedProduct, long constantProduct) {
  46     long normalProduct = leftFactor * rightFactor; // unaffected by the new optimization
  47     if (optimizedProduct != constantProduct || normalProduct != constantProduct) {
  48       throw new RuntimeException("Not all three products are equal: " +
  49                                  Long.toHexString(normalProduct) + ", " +
  50                                  Long.toHexString(optimizedProduct) + ", " +
  51                                  Long.toHexString(constantProduct));
  52     }
  53   }
  54 
  55   private static int initInt(String[] args, int v) {
  56     if (args.length > 0) {
  57       try {
  58         return Integer.valueOf(args[0]);
  59       } catch (NumberFormatException e) { }
  60     }
  61     return v;
  62   }


< prev index next >