< prev index next >

test/compiler/intrinsics/bigInteger/TestMultiplyToLen.java

Print this page




  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 8055494
  28  * @summary Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
  29  *
  30  * @run main/othervm/timeout=600 -XX:-TieredCompilation -Xbatch
  31  *      -XX:CompileCommand=exclude,TestMultiplyToLen::main
  32  *      -XX:CompileCommand=option,TestMultiplyToLen::base_multiply,ccstr,DisableIntrinsic,_multiplyToLen
  33  *      -XX:CompileCommand=option,java.math.BigInteger::multiply,ccstr,DisableIntrinsic,_multiplyToLen
  34  *      -XX:CompileCommand=inline,java.math.BigInteger::multiply TestMultiplyToLen

  35  */
  36 



  37 import java.util.Arrays;
  38 import java.util.Random;
  39 import java.math.*;
  40 
  41 public class TestMultiplyToLen {
  42 
  43     // Avoid intrinsic by preventing inlining multiply() and multiplyToLen().
  44     public static BigInteger base_multiply(BigInteger op1, BigInteger op2) {
  45       return op1.multiply(op2);
  46     }
  47 
  48     // Generate multiplyToLen() intrinsic by inlining multiply().
  49     public static BigInteger new_multiply(BigInteger op1, BigInteger op2) {
  50       return op1.multiply(op2);
  51     }
  52 
  53     public static boolean bytecompare(BigInteger b1, BigInteger b2) {
  54       byte[] data1 = b1.toByteArray();
  55       byte[] data2 = b2.toByteArray();
  56       if (data1.length != data2.length)
  57         return false;
  58       for (int i = 0; i < data1.length; i++) {
  59         if (data1[i] != data2[i])




  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 8055494
  28  * @summary Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
  29  *
  30  * @run main/othervm/timeout=600 -XX:-TieredCompilation -Xbatch
  31  *      -XX:CompileCommand=exclude,compiler.intrinsics.bigInteger.TestMultiplyToLen::main
  32  *      -XX:CompileCommand=option,compiler.intrinsics.bigInteger.TestMultiplyToLen::base_multiply,ccstr,DisableIntrinsic,_multiplyToLen
  33  *      -XX:CompileCommand=option,java.math.BigInteger::multiply,ccstr,DisableIntrinsic,_multiplyToLen
  34  *      -XX:CompileCommand=inline,java.math.BigInteger::multiply
  35  *      compiler.intrinsics.bigInteger.TestMultiplyToLen
  36  */
  37 
  38 package compiler.intrinsics.bigInteger;
  39 
  40 import java.math.BigInteger;
  41 import java.util.Arrays;
  42 import java.util.Random;

  43 
  44 public class TestMultiplyToLen {
  45 
  46     // Avoid intrinsic by preventing inlining multiply() and multiplyToLen().
  47     public static BigInteger base_multiply(BigInteger op1, BigInteger op2) {
  48       return op1.multiply(op2);
  49     }
  50 
  51     // Generate multiplyToLen() intrinsic by inlining multiply().
  52     public static BigInteger new_multiply(BigInteger op1, BigInteger op2) {
  53       return op1.multiply(op2);
  54     }
  55 
  56     public static boolean bytecompare(BigInteger b1, BigInteger b2) {
  57       byte[] data1 = b1.toByteArray();
  58       byte[] data2 = b2.toByteArray();
  59       if (data1.length != data2.length)
  60         return false;
  61       for (int i = 0; i < data1.length; i++) {
  62         if (data1[i] != data2[i])


< prev index next >