hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java
changeset 25735 990d2378e01d
parent 24003 372cef87666e
child 30604 b8d532cb6420
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java	Sat Jul 19 00:32:23 2014 +0400
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java	Sat Jul 19 00:33:37 2014 +0400
@@ -146,6 +146,10 @@
         }
 
         protected int countCpuInstructions(byte[] nativeCode) {
+            return countCpuInstructions(nativeCode, instrMask, instrPattern);
+        }
+
+        public static int countCpuInstructions(byte[] nativeCode, byte[] instrMask, byte[] instrPattern) {
             int count = 0;
             int patternSize = Math.min(instrMask.length, instrPattern.length);
             boolean found;
@@ -183,4 +187,21 @@
             return "UseBMI1Instructions";
         }
     }
+
+    abstract static class BmiTestCase_x64 extends BmiTestCase {
+        protected byte[] instrMask_x64;
+        protected byte[] instrPattern_x64;
+
+        protected BmiTestCase_x64(Method method) {
+            super(method);
+        }
+
+        protected int countCpuInstructions(byte[] nativeCode) {
+            int cnt = super.countCpuInstructions(nativeCode);
+            if (Platform.isX64()) { // on x64 platform the instruction we search for can be encoded in 2 different ways
+                cnt += countCpuInstructions(nativeCode, instrMask_x64, instrPattern_x64);
+            }
+            return cnt;
+        }
+    }
 }