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
@ -146,6 +146,10 @@ public class BmiIntrinsicBase extends CompilerWhiteBoxTest {
|
||||
}
|
||||
|
||||
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 @@ public class BmiIntrinsicBase extends CompilerWhiteBoxTest {
|
||||
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;
|
||||
|
||||
public class LZcntTestI extends BmiIntrinsicBase.BmiTestCase {
|
||||
public class LZcntTestI extends BmiIntrinsicBase.BmiTestCase_x64 {
|
||||
|
||||
protected LZcntTestI(Method method) {
|
||||
super(method);
|
||||
instrMask = new byte[]{(byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
|
||||
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 {
|
||||
|
@ -31,8 +31,6 @@
|
||||
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountLeadingZerosInstruction LZcntTestL
|
||||
*/
|
||||
|
||||
import com.oracle.java.testlibrary.Platform;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class LZcntTestL extends LZcntTestI {
|
||||
@ -40,10 +38,6 @@ public class LZcntTestL extends LZcntTestI {
|
||||
protected LZcntTestL(Method method) {
|
||||
super(method);
|
||||
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 {
|
||||
|
@ -33,12 +33,15 @@
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class TZcntTestI extends BmiIntrinsicBase.BmiTestCase {
|
||||
public class TZcntTestI extends BmiIntrinsicBase.BmiTestCase_x64 {
|
||||
|
||||
protected TZcntTestI(Method method) {
|
||||
super(method);
|
||||
instrMask = new byte[]{(byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
|
||||
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 {
|
||||
|
@ -31,8 +31,6 @@
|
||||
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountTrailingZerosInstruction TZcntTestL
|
||||
*/
|
||||
|
||||
import com.oracle.java.testlibrary.Platform;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class TZcntTestL extends TZcntTestI {
|
||||
@ -40,11 +38,6 @@ public class TZcntTestL extends TZcntTestI {
|
||||
protected TZcntTestL(Method method) {
|
||||
super(method);
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user