8049348: compiler/intrinsics/bmi/verifycode tests on lzcnt and tzcnt use incorrect assumption about REXB prefix usage
Reviewed-by: kvn
This commit is contained in:
parent
1f29a205e2
commit
4f7af5c597
hotspot/test/compiler/intrinsics/bmi/verifycode
@ -146,6 +146,10 @@ public class BmiIntrinsicBase extends CompilerWhiteBoxTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected int countCpuInstructions(byte[] nativeCode) {
|
protected int countCpuInstructions(byte[] nativeCode) {
|
||||||
|
return countCpuInstructions(nativeCode, instrMask, instrPattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int countCpuInstructions(byte[] nativeCode, byte[] instrMask, byte[] instrPattern) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int patternSize = Math.min(instrMask.length, instrPattern.length);
|
int patternSize = Math.min(instrMask.length, instrPattern.length);
|
||||||
boolean found;
|
boolean found;
|
||||||
@ -183,4 +187,21 @@ public class BmiIntrinsicBase extends CompilerWhiteBoxTest {
|
|||||||
return "UseBMI1Instructions";
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,12 +33,15 @@
|
|||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public class LZcntTestI extends BmiIntrinsicBase.BmiTestCase {
|
public class LZcntTestI extends BmiIntrinsicBase.BmiTestCase_x64 {
|
||||||
|
|
||||||
protected LZcntTestI(Method method) {
|
protected LZcntTestI(Method method) {
|
||||||
super(method);
|
super(method);
|
||||||
instrMask = new byte[]{(byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
|
instrMask = new byte[]{(byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
|
||||||
instrPattern = new byte[]{(byte) 0xF3, (byte) 0x0F, (byte) 0xBD};
|
instrPattern = new byte[]{(byte) 0xF3, (byte) 0x0F, (byte) 0xBD};
|
||||||
|
|
||||||
|
instrMask_x64 = new byte[]{(byte) 0xFF, (byte) 0x00, (byte) 0xFF, (byte) 0xFF};
|
||||||
|
instrPattern_x64 = new byte[]{(byte) 0xF3, (byte) 0x00, (byte) 0x0F, (byte) 0xBD};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
@ -31,8 +31,6 @@
|
|||||||
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountLeadingZerosInstruction LZcntTestL
|
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountLeadingZerosInstruction LZcntTestL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.oracle.java.testlibrary.Platform;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public class LZcntTestL extends LZcntTestI {
|
public class LZcntTestL extends LZcntTestI {
|
||||||
@ -40,10 +38,6 @@ public class LZcntTestL extends LZcntTestI {
|
|||||||
protected LZcntTestL(Method method) {
|
protected LZcntTestL(Method method) {
|
||||||
super(method);
|
super(method);
|
||||||
isLongOperation = true;
|
isLongOperation = true;
|
||||||
if (Platform.isX64()) {
|
|
||||||
instrMask = new byte[]{(byte) 0xFF, (byte) 0x00, (byte) 0xFF, (byte) 0xFF};
|
|
||||||
instrPattern = new byte[]{(byte) 0xF3, (byte) 0x00, (byte) 0x0F, (byte) 0xBD};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
@ -33,12 +33,15 @@
|
|||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public class TZcntTestI extends BmiIntrinsicBase.BmiTestCase {
|
public class TZcntTestI extends BmiIntrinsicBase.BmiTestCase_x64 {
|
||||||
|
|
||||||
protected TZcntTestI(Method method) {
|
protected TZcntTestI(Method method) {
|
||||||
super(method);
|
super(method);
|
||||||
instrMask = new byte[]{(byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
|
instrMask = new byte[]{(byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
|
||||||
instrPattern = new byte[]{(byte) 0xF3, (byte) 0x0F, (byte) 0xBC};
|
instrPattern = new byte[]{(byte) 0xF3, (byte) 0x0F, (byte) 0xBC};
|
||||||
|
|
||||||
|
instrMask_x64 = new byte[]{(byte) 0xFF, (byte) 0x00, (byte) 0xFF, (byte) 0xFF};
|
||||||
|
instrPattern_x64 = new byte[]{(byte) 0xF3, (byte) 0x00, (byte) 0x0F, (byte) 0xBC};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
@ -31,8 +31,6 @@
|
|||||||
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountTrailingZerosInstruction TZcntTestL
|
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountTrailingZerosInstruction TZcntTestL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.oracle.java.testlibrary.Platform;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public class TZcntTestL extends TZcntTestI {
|
public class TZcntTestL extends TZcntTestI {
|
||||||
@ -40,11 +38,6 @@ public class TZcntTestL extends TZcntTestI {
|
|||||||
protected TZcntTestL(Method method) {
|
protected TZcntTestL(Method method) {
|
||||||
super(method);
|
super(method);
|
||||||
isLongOperation = true;
|
isLongOperation = true;
|
||||||
if (Platform.isX64()) {
|
|
||||||
instrMask = new byte[]{(byte) 0xFF, (byte) 0x00, (byte) 0xFF, (byte) 0xFF};
|
|
||||||
instrPattern = new byte[]{(byte) 0xF3, (byte) 0x00, (byte) 0x0F, (byte) 0xBC};
|
|
||||||
}
|
|
||||||
isLongOperation = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user