use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitMathSin.
@Override
public Value emitMathSin(Value input) {
LIRGenerator gen = getLIRGen();
Variable result = maths.emitSin(gen, input);
if (result == null) {
result = gen.newVariable(LIRKind.combine(input));
AllocatableValue stackSlot = gen.getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(AMD64Kind.QWORD));
gen.append(new AMD64MathIntrinsicUnaryOp(getAMD64LIRGen(), SIN, result, gen.asAllocatable(input), stackSlot));
}
return result;
}
use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitNot.
@Override
public Variable emitNot(Value inputVal) {
AllocatableValue input = getLIRGen().asAllocatable(inputVal);
Variable result = getLIRGen().newVariable(LIRKind.combine(input));
switch((AMD64Kind) input.getPlatformKind()) {
case DWORD:
getLIRGen().append(new AMD64Unary.MOp(NOT, DWORD, result, input));
break;
case QWORD:
getLIRGen().append(new AMD64Unary.MOp(NOT, QWORD, result, input));
break;
default:
throw GraalError.shouldNotReachHere();
}
return result;
}
use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitNegate.
@Override
public Variable emitNegate(Value inputVal) {
AllocatableValue input = getLIRGen().asAllocatable(inputVal);
Variable result = getLIRGen().newVariable(LIRKind.combine(input));
TargetDescription target = getLIRGen().target();
boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
switch((AMD64Kind) input.getPlatformKind()) {
case DWORD:
getLIRGen().append(new AMD64Unary.MOp(NEG, DWORD, result, input));
break;
case QWORD:
getLIRGen().append(new AMD64Unary.MOp(NEG, QWORD, result, input));
break;
case SINGLE:
if (isAvx) {
getLIRGen().append(new AMD64Binary.DataThreeOp(AVXOp.XOR, PS, result, input, JavaConstant.forFloat(Float.intBitsToFloat(0x80000000)), 16));
} else {
getLIRGen().append(new AMD64Binary.DataTwoOp(SSEOp.XOR, PS, result, input, JavaConstant.forFloat(Float.intBitsToFloat(0x80000000)), 16));
}
break;
case DOUBLE:
if (isAvx) {
getLIRGen().append(new AMD64Binary.DataThreeOp(AVXOp.XOR, PD, result, input, JavaConstant.forDouble(Double.longBitsToDouble(0x8000000000000000L)), 16));
} else {
getLIRGen().append(new AMD64Binary.DataTwoOp(SSEOp.XOR, PD, result, input, JavaConstant.forDouble(Double.longBitsToDouble(0x8000000000000000L)), 16));
}
break;
default:
throw GraalError.shouldNotReachHere(input.getPlatformKind().toString());
}
return result;
}
use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitReinterpret.
@Override
public Value emitReinterpret(LIRKind to, Value inputVal) {
ValueKind<?> from = inputVal.getValueKind();
if (to.equals(from)) {
return inputVal;
}
AllocatableValue input = getLIRGen().asAllocatable(inputVal);
/*
* Conversions between integer to floating point types require moves between CPU and FPU
* registers.
*/
AMD64Kind fromKind = (AMD64Kind) from.getPlatformKind();
switch((AMD64Kind) to.getPlatformKind()) {
case DWORD:
switch(fromKind) {
case SINGLE:
return emitConvertOp(to, AMD64MROp.MOVD, DWORD, input);
}
break;
case QWORD:
switch(fromKind) {
case DOUBLE:
return emitConvertOp(to, AMD64MROp.MOVQ, QWORD, input);
}
break;
case SINGLE:
switch(fromKind) {
case DWORD:
return emitConvertOp(to, AMD64RMOp.MOVD, DWORD, input);
}
break;
case DOUBLE:
switch(fromKind) {
case QWORD:
return emitConvertOp(to, AMD64RMOp.MOVQ, QWORD, input);
}
break;
}
throw GraalError.shouldNotReachHere();
}
use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitMathExp.
@Override
public Value emitMathExp(Value input) {
Variable result = getLIRGen().newVariable(LIRKind.combine(input));
AllocatableValue stackSlot = getLIRGen().getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(AMD64Kind.QWORD));
getLIRGen().append(new AMD64MathIntrinsicUnaryOp(getAMD64LIRGen(), EXP, result, getLIRGen().asAllocatable(input), stackSlot));
return result;
}
Aggregations