use of jdk.vm.ci.amd64.AMD64 in project graal by oracle.
the class SubstrateGraalUtils method updateGraalArchitectureWithHostCPUFeatures.
/**
* Updates the architecture in Graal at run-time in order to enable best code generation on the
* given machine.
*
* Note: this method is not synchronized as it only introduces new features to the enum map
* which is backed by an array. If two threads repeat the work nothing can go wrong.
*
* @param graalBackend The graal backend that should be updated.
*/
public static void updateGraalArchitectureWithHostCPUFeatures(Backend graalBackend) {
if (SubstrateUtil.HOSTED) {
throw shouldNotReachHere("Architecture should be updated only at runtime.");
}
if (!architectureInitialized) {
architectureInitialized = true;
AMD64CPUFeatureAccess.verifyHostSupportsArchitecture(graalBackend.getCodeCache().getTarget().arch);
AMD64 architecture = (AMD64) graalBackend.getCodeCache().getTarget().arch;
EnumSet<AMD64.CPUFeature> features = AMD64CPUFeatureAccess.determineHostCPUFeatures();
architecture.getFeatures().addAll(features);
}
}
use of jdk.vm.ci.amd64.AMD64 in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitMul.
@Override
public Variable emitMul(Value a, Value b, boolean setFlags) {
LIRKind resultKind = LIRKind.combine(a, b);
TargetDescription target = getLIRGen().target();
boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
switch((AMD64Kind) a.getPlatformKind()) {
case DWORD:
return emitIMUL(DWORD, a, b);
case QWORD:
return emitIMUL(QWORD, a, b);
case SINGLE:
if (isAvx) {
return emitBinary(resultKind, AVXOp.MUL, SS, true, a, b);
} else {
return emitBinary(resultKind, SSEOp.MUL, SS, true, a, b);
}
case DOUBLE:
if (isAvx) {
return emitBinary(resultKind, AVXOp.MUL, SD, true, a, b);
} else {
return emitBinary(resultKind, SSEOp.MUL, SD, true, a, b);
}
default:
throw GraalError.shouldNotReachHere();
}
}
use of jdk.vm.ci.amd64.AMD64 in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitXor.
@Override
public Variable emitXor(Value a, Value b) {
LIRKind resultKind = LIRKind.combine(a, b);
TargetDescription target = getLIRGen().target();
boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
switch((AMD64Kind) a.getPlatformKind()) {
case DWORD:
return emitBinary(resultKind, XOR, DWORD, true, a, b, false);
case QWORD:
return emitBinary(resultKind, XOR, QWORD, true, a, b, false);
case SINGLE:
if (isAvx) {
return emitBinary(resultKind, AVXOp.XOR, PS, true, a, b);
} else {
return emitBinary(resultKind, SSEOp.XOR, PS, true, a, b);
}
case DOUBLE:
if (isAvx) {
return emitBinary(resultKind, AVXOp.XOR, PD, true, a, b);
} else {
return emitBinary(resultKind, SSEOp.XOR, PD, true, a, b);
}
default:
throw GraalError.shouldNotReachHere();
}
}
use of jdk.vm.ci.amd64.AMD64 in project graal by oracle.
the class AMD64LIRGenerator method emitLogicCompareAndSwap.
@Override
public Variable emitLogicCompareAndSwap(Value address, Value expectedValue, Value newValue, Value trueValue, Value falseValue) {
ValueKind<?> kind = newValue.getValueKind();
assert kind.equals(expectedValue.getValueKind());
AMD64Kind memKind = (AMD64Kind) kind.getPlatformKind();
AMD64AddressValue addressValue = asAddressValue(address);
RegisterValue raxRes = AMD64.rax.asValue(kind);
emitMove(raxRes, expectedValue);
append(new CompareAndSwapOp(memKind, raxRes, addressValue, raxRes, asAllocatable(newValue)));
assert trueValue.getValueKind().equals(falseValue.getValueKind());
Variable result = newVariable(trueValue.getValueKind());
append(new CondMoveOp(result, Condition.EQ, asAllocatable(trueValue), falseValue));
return result;
}
use of jdk.vm.ci.amd64.AMD64 in project graal by oracle.
the class StableArrayReadFoldingTest method testKillWithDifferentTypeUnaligned.
@Test
public void testKillWithDifferentTypeUnaligned() {
Assume.assumeTrue("Only test unaligned access on AMD64", getTarget().arch instanceof AMD64);
ResolvedJavaMethod method = getResolvedJavaMethod("killWithDifferentTypeUnaligned");
testAgainstExpected(method, new Result(true, null), null);
}
Aggregations