< prev index next >

test/compiler/intrinsics/bigInteger/TestSquareToLen.java

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


  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 8081778
  28  * @summary Add C2 x86 intrinsic for BigInteger::squareToLen() method
  29  *
  30  * @run main/othervm/timeout=600 -XX:-TieredCompilation -Xbatch
  31  *      -XX:CompileCommand=exclude,TestSquareToLen::main
  32  *      -XX:CompileCommand=option,TestSquareToLen::base_multiply,ccstr,DisableIntrinsic,_squareToLen
  33  *      -XX:CompileCommand=option,java.math.BigInteger::multiply,ccstr,DisableIntrinsic,_squareToLen
  34  *      -XX:CompileCommand=option,java.math.BigInteger::square,ccstr,DisableIntrinsic,_squareToLen
  35  *      -XX:CompileCommand=option,java.math.BigInteger::squareToLen,ccstr,DisableIntrinsic,_squareToLen
  36  *      -XX:CompileCommand=inline,java.math.BigInteger::multiply
  37  *      -XX:CompileCommand=inline,java.math.BigInteger::square
  38  *      -XX:CompileCommand=inline,java.math.BigInteger::squareToLen TestSquareToLen

  39  */
  40 



  41 import java.util.Random;
  42 import java.math.*;
  43 
  44 public class TestSquareToLen {
  45 
  46     // Avoid intrinsic by preventing inlining multiply() and squareToLen().
  47     public static BigInteger base_multiply(BigInteger op1) {
  48       return op1.multiply(op1);
  49     }
  50 
  51     // Generate squareToLen() intrinsic by inlining multiply().
  52     public static BigInteger new_multiply(BigInteger op1) {
  53       return op1.multiply(op1);
  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])




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

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


< prev index next >