< prev index next >

test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java

Print this page




  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 8026844
  27  * @summary Test repeating multiplyExact
  28  * @library /testlibrary
  29  * @modules java.base/sun.misc
  30  *          java.management
  31  * @compile MulExactIRepeatTest.java Verify.java
  32  * @run main MulExactIRepeatTest
  33  *
  34  */
  35 
  36 import com.oracle.java.testlibrary.Utils;
  37 import java.util.Random;
  38 
  39 public class MulExactIRepeatTest {
  40     public static void main(String[] args) {
  41         runTest(new Verify.MulExactI());
  42     }
  43 
  44     public static int nonExact(int x, int y, Verify.BinaryMethod method) {
  45         int result = method.unchecked(x, y);
  46         result += method.unchecked(x, y);
  47         result += method.unchecked(x, y);
  48         result += method.unchecked(x, y);
  49         return result;
  50     }
  51 
  52     public static void runTest(Verify.BinaryMethod method) {
  53         Random rnd = Utils.getRandomInstance();
  54         for (int i = 0; i < 50000; ++i) {
  55             int x = Integer.MAX_VALUE - 10;
  56             int y = Integer.MAX_VALUE - 10 + rnd.nextInt(5);




  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 8026844
  27  * @summary Test repeating multiplyExact
  28  * @library /testlibrary
  29  * @modules java.base/sun.misc
  30  *          java.management
  31  * @compile MulExactIRepeatTest.java Verify.java
  32  * @run main MulExactIRepeatTest
  33  *
  34  */
  35 
  36 import jdk.test.lib.Utils;
  37 import java.util.Random;
  38 
  39 public class MulExactIRepeatTest {
  40     public static void main(String[] args) {
  41         runTest(new Verify.MulExactI());
  42     }
  43 
  44     public static int nonExact(int x, int y, Verify.BinaryMethod method) {
  45         int result = method.unchecked(x, y);
  46         result += method.unchecked(x, y);
  47         result += method.unchecked(x, y);
  48         result += method.unchecked(x, y);
  49         return result;
  50     }
  51 
  52     public static void runTest(Verify.BinaryMethod method) {
  53         Random rnd = Utils.getRandomInstance();
  54         for (int i = 0; i < 50000; ++i) {
  55             int x = Integer.MAX_VALUE - 10;
  56             int y = Integer.MAX_VALUE - 10 + rnd.nextInt(5);


< prev index next >