use of jdk.vm.ci.amd64.AMD64Kind in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitAdd.
@Override
public Variable emitAdd(LIRKind resultKind, Value a, Value b, boolean setFlags) {
TargetDescription target = getLIRGen().target();
boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
switch((AMD64Kind) a.getPlatformKind()) {
case DWORD:
if (isJavaConstant(b) && !setFlags) {
long displacement = asJavaConstant(b).asLong();
if (NumUtil.isInt(displacement) && displacement != 1 && displacement != -1) {
return emitBaseOffsetLea(resultKind, a, (int) displacement, OperandSize.DWORD);
}
}
return emitBinary(resultKind, ADD, DWORD, true, a, b, setFlags);
case QWORD:
if (isJavaConstant(b) && !setFlags) {
long displacement = asJavaConstant(b).asLong();
if (NumUtil.isInt(displacement) && displacement != 1 && displacement != -1) {
return emitBaseOffsetLea(resultKind, a, (int) displacement, OperandSize.QWORD);
}
}
return emitBinary(resultKind, ADD, QWORD, true, a, b, setFlags);
case SINGLE:
if (isAvx) {
return emitBinary(resultKind, AVXOp.ADD, SS, true, a, b);
} else {
return emitBinary(resultKind, SSEOp.ADD, SS, true, a, b);
}
case DOUBLE:
if (isAvx) {
return emitBinary(resultKind, AVXOp.ADD, SD, true, a, b);
} else {
return emitBinary(resultKind, SSEOp.ADD, SD, true, a, b);
}
default:
throw GraalError.shouldNotReachHere();
}
}
use of jdk.vm.ci.amd64.AMD64Kind 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.amd64.AMD64Kind in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitSub.
@Override
public Variable emitSub(LIRKind resultKind, Value a, Value b, boolean setFlags) {
TargetDescription target = getLIRGen().target();
boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
switch((AMD64Kind) a.getPlatformKind()) {
case DWORD:
return emitBinary(resultKind, SUB, DWORD, false, a, b, setFlags);
case QWORD:
return emitBinary(resultKind, SUB, QWORD, false, a, b, setFlags);
case SINGLE:
if (isAvx) {
return emitBinary(resultKind, AVXOp.SUB, SS, false, a, b);
} else {
return emitBinary(resultKind, SSEOp.SUB, SS, false, a, b);
}
case DOUBLE:
if (isAvx) {
return emitBinary(resultKind, AVXOp.SUB, SD, false, a, b);
} else {
return emitBinary(resultKind, SSEOp.SUB, SD, false, a, b);
}
default:
throw GraalError.shouldNotReachHere();
}
}
use of jdk.vm.ci.amd64.AMD64Kind in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitOr.
@Override
public Variable emitOr(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, OR, DWORD, true, a, b, false);
case QWORD:
return emitBinary(resultKind, OR, QWORD, true, a, b, false);
case SINGLE:
if (isAvx) {
return emitBinary(resultKind, AVXOp.OR, PS, true, a, b);
} else {
return emitBinary(resultKind, SSEOp.OR, PS, true, a, b);
}
case DOUBLE:
if (isAvx) {
return emitBinary(resultKind, AVXOp.OR, PD, true, a, b);
} else {
return emitBinary(resultKind, SSEOp.OR, PD, true, a, b);
}
default:
throw GraalError.shouldNotReachHere();
}
}
use of jdk.vm.ci.amd64.AMD64Kind in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitAnd.
@Override
public Variable emitAnd(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, AND, DWORD, true, a, b, false);
case QWORD:
return emitBinary(resultKind, AND, QWORD, true, a, b, false);
case SINGLE:
if (isAvx) {
return emitBinary(resultKind, AVXOp.AND, PS, true, a, b);
} else {
return emitBinary(resultKind, SSEOp.AND, PS, true, a, b);
}
case DOUBLE:
if (isAvx) {
return emitBinary(resultKind, AVXOp.AND, PD, true, a, b);
} else {
return emitBinary(resultKind, SSEOp.AND, PD, true, a, b);
}
default:
throw GraalError.shouldNotReachHere();
}
}
Aggregations