diff --git a/test/compiler/intrinsics/bmi/TestAndnI.java b/test/compiler/intrinsics/bmi/TestAndnI.java index e8cfaa23f0f22964db5cab0a67b540bf60fb651b..1dbea7a7f2204af2d7fccff2b7a1e5bbcbc103e6 100644 --- a/test/compiler/intrinsics/bmi/TestAndnI.java +++ b/test/compiler/intrinsics/bmi/TestAndnI.java @@ -58,15 +58,27 @@ public class TestAndnI { } public int intExpr(int src1, Expr.MemI src2) { - return ~src1 & src2.value; + if (src2 != null) { + return ~src1 & src2.value; + } else { + return 0; + } } public int intExpr(Expr.MemI src1, int src2) { - return ~src1.value & src2; + if (src1 != null) { + return ~src1.value & src2; + } else { + return 0; + } } public int intExpr(Expr.MemI src1, Expr.MemI src2) { - return ~src1.value & src2.value; + if (src1 != null && src2 != null) { + return ~src1.value & src2.value; + } else { + return 0; + } } } @@ -77,15 +89,27 @@ public class TestAndnI { } public int intExpr(int src1, Expr.MemI src2) { - return src1 & ~src2.value; + if (src2 != null) { + return src1 & ~src2.value; + } else { + return 0; + } } public int intExpr(Expr.MemI src1, int src2) { - return src1.value & ~src2; + if (src1 != null) { + return src1.value & ~src2; + } else { + return 0; + } } public int intExpr(Expr.MemI src1, Expr.MemI src2) { - return src1.value & ~src2.value; + if (src1 != null && src2 != null) { + return src1.value & ~src2.value; + } else { + return 0; + } } } } diff --git a/test/compiler/intrinsics/bmi/TestAndnL.java b/test/compiler/intrinsics/bmi/TestAndnL.java index 0dca7aa399ae5a597774126370ec553d43e7c10b..2cc96c5da7e095ff61278f68516b37f16c1f93e9 100644 --- a/test/compiler/intrinsics/bmi/TestAndnL.java +++ b/test/compiler/intrinsics/bmi/TestAndnL.java @@ -58,15 +58,27 @@ public class TestAndnL { } public long longExpr(long src1, Expr.MemL src2) { - return ~src1 & src2.value; + if (src2 != null) { + return ~src1 & src2.value; + } else { + return 0; + } } public long longExpr(Expr.MemL src1, long src2) { - return ~src1.value & src2; + if (src1 != null) { + return ~src1.value & src2; + } else { + return 0; + } } public long longExpr(Expr.MemL src1, Expr.MemL src2) { - return ~src1.value & src2.value; + if (src1 != null && src2 != null) { + return ~src1.value & src2.value; + } else { + return 0; + } } @@ -79,15 +91,27 @@ public class TestAndnL { } public long longExpr(long src1, Expr.MemL src2) { - return src1 & ~src2.value; + if (src2 != null) { + return src1 & ~src2.value; + } else { + return 0; + } } public long longExpr(Expr.MemL src1, long src2) { - return src1.value & ~src2; + if (src1 != null) { + return src1.value & ~src2; + } else { + return 0; + } } public long longExpr(Expr.MemL src1, Expr.MemL src2) { - return src1.value & ~src2.value; + if (src1 != null && src2 != null) { + return src1.value & ~src2.value; + } else { + return 0; + } } } diff --git a/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java b/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java similarity index 84% rename from test/compiler/intrinsics/bmi/verifycode/AddnTestI.java rename to test/compiler/intrinsics/bmi/verifycode/AndnTestI.java index 2a77347a749eb6782031c77b455a910a638c35fd..7cc0232f577a8fb686e169bd14ca88565d9732f9 100644 --- a/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java +++ b/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,17 +25,17 @@ * @test * @bug 8031321 * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. - * @build AddnTestI + * @build AndnTestI * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AddnTestI + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestI */ import java.lang.reflect.Method; -public class AddnTestI extends BmiIntrinsicBase.BmiTestCase { +public class AndnTestI extends BmiIntrinsicBase.BmiTestCase { - protected AddnTestI(Method method) { + protected AndnTestI(Method method) { super(method); // from intel manual VEX.NDS.LZ.0F38.W0 F2 /r, example c4e260f2c2 instrMask = new byte[]{ @@ -51,7 +51,7 @@ public class AddnTestI extends BmiIntrinsicBase.BmiTestCase { } public static void main(String[] args) throws Exception { - BmiIntrinsicBase.verifyTestCase(AddnTestI::new, TestAndnI.AndnIExpr.class.getDeclaredMethods()); - BmiIntrinsicBase.verifyTestCase(AddnTestI::new, TestAndnI.AndnICommutativeExpr.class.getDeclaredMethods()); + BmiIntrinsicBase.verifyTestCase(AndnTestI::new, TestAndnI.AndnIExpr.class.getDeclaredMethods()); + BmiIntrinsicBase.verifyTestCase(AndnTestI::new, TestAndnI.AndnICommutativeExpr.class.getDeclaredMethods()); } } diff --git a/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java b/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java similarity index 82% rename from test/compiler/intrinsics/bmi/verifycode/AddnTestL.java rename to test/compiler/intrinsics/bmi/verifycode/AndnTestL.java index 72da9a04485cff31425c88dfc9f8277e5a34286f..e4493e28e50ce5471f85300480ece8292da5c55a 100644 --- a/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java +++ b/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,23 +25,23 @@ * @test * @bug 8031321 * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. - * @build AddnTestL + * @build AndnTestL * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AddnTestL + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestL */ import java.lang.reflect.Method; -public class AddnTestL extends AddnTestI { +public class AndnTestL extends AndnTestI { - protected AddnTestL(Method method) { + protected AndnTestL(Method method) { super(method); isLongOperation = true; } public static void main(String[] args) throws Exception { - BmiIntrinsicBase.verifyTestCase(AddnTestL::new, TestAndnL.AndnLExpr.class.getDeclaredMethods()); - BmiIntrinsicBase.verifyTestCase(AddnTestL::new, TestAndnL.AndnLCommutativeExpr.class.getDeclaredMethods()); + BmiIntrinsicBase.verifyTestCase(AndnTestL::new, TestAndnL.AndnLExpr.class.getDeclaredMethods()); + BmiIntrinsicBase.verifyTestCase(AndnTestL::new, TestAndnL.AndnLCommutativeExpr.class.getDeclaredMethods()); } } diff --git a/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java b/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java index 0ba76e69bc5b547ef514f6e4d78ed088e71428b0..1f1b5dad6027d498d21972136f66babfedc0d490 100644 --- a/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java +++ b/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java @@ -44,6 +44,8 @@ public class LZcntTestI extends BmiIntrinsicBase.BmiTestCase { public static void main(String[] args) throws Exception { // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods System.out.println("class java.lang.Integer should be loaded. Proof: " + Integer.class); + // Avoid uncommon traps. + System.out.println("Num leading zeroes: " + new TestLzcntI.LzcntIExpr().intExpr(12341341)); BmiIntrinsicBase.verifyTestCase(LZcntTestI::new, TestLzcntI.LzcntIExpr.class.getDeclaredMethods()); } diff --git a/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java b/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java index 5ecfb96d6377c568333a44a36582f70e4750b0c3..9787bf8f9ba45ab4055bb4bac5bb02f0e15fdeeb 100644 --- a/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java +++ b/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java @@ -49,6 +49,8 @@ public class LZcntTestL extends LZcntTestI { public static void main(String[] args) throws Exception { // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods System.out.println("classes java.lang.Long should be loaded. Proof: " + Long.class); + // Avoid uncommon traps. + System.out.println("Num leading zeroes: " + new TestLzcntL.LzcntLExpr().longExpr(12341341)); BmiIntrinsicBase.verifyTestCase(LZcntTestL::new, TestLzcntL.LzcntLExpr.class.getDeclaredMethods()); } } diff --git a/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java b/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java index ad2af2c615a16f587c48db04478f69457f34ca8e..3936c11ece48740de5297adaeb123fe233ec4fe5 100644 --- a/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java +++ b/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java @@ -44,6 +44,8 @@ public class TZcntTestI extends BmiIntrinsicBase.BmiTestCase { public static void main(String[] args) throws Exception { // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods System.out.println("class java.lang.Integer should be loaded. Proof: " + Integer.class); + // Avoid uncommon traps. + System.out.println("Num trailing zeroes: " + new TestTzcntI.TzcntIExpr().intExpr(12341341)); BmiIntrinsicBase.verifyTestCase(TZcntTestI::new, TestTzcntI.TzcntIExpr.class.getDeclaredMethods()); } diff --git a/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java b/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java index 0a856dfa9e281fb8a4198eabc92aefbc07f2cb88..5bd42b4662df0b03a36d213f9202d213bc52cf47 100644 --- a/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java +++ b/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java @@ -50,6 +50,8 @@ public class TZcntTestL extends TZcntTestI { public static void main(String[] args) throws Exception { // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods System.out.println("classes java.lang.Long should be loaded. Proof: " + Long.class); + // Avoid uncommon traps. + System.out.println("Num trailing zeroes: " + new TestTzcntL.TzcntLExpr().longExpr(12341341)); BmiIntrinsicBase.verifyTestCase(TZcntTestL::new, TestTzcntL.TzcntLExpr.class.getDeclaredMethods()); } }