use of jdk.vm.ci.sparc.SPARCKind in project graal by oracle.
the class SPARCArithmeticLIRGenerator method emitReinterpret.
@Override
public AllocatableValue emitReinterpret(LIRKind to, Value inputVal) {
SPARCKind fromKind = (SPARCKind) inputVal.getPlatformKind();
SPARCKind toKind = (SPARCKind) to.getPlatformKind();
AllocatableValue input = getLIRGen().asAllocatable(inputVal);
Variable result = getLIRGen().newVariable(to);
// These cases require a move between CPU and FPU registers:
if (fromKind.isFloat() != toKind.isFloat()) {
moveBetweenFpGp(result, input);
return result;
} else {
// Consequently, there is no need for a special zero-extension move.
return emitConvertMove(to, input);
}
}
use of jdk.vm.ci.sparc.SPARCKind in project graal by oracle.
the class SPARCLIRGenerator method emitConditionalMove.
@Override
public Variable emitConditionalMove(PlatformKind cmpKind, Value left, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue) {
// Emit compare
SPARCKind cmpSPARCKind = (SPARCKind) cmpKind;
boolean mirrored = emitCompare(cmpSPARCKind, left, right);
// Emit move
Value actualTrueValue = trueValue;
Value actualFalseValue = falseValue;
SPARCKind valueKind = (SPARCKind) trueValue.getPlatformKind();
CMOV cmove;
if (valueKind.isFloat()) {
// Floats cannot be immediate at all
actualTrueValue = load(trueValue);
actualFalseValue = load(falseValue);
cmove = valueKind.equals(SINGLE) ? FMOVSCC : FMOVDCC;
} else if (valueKind.isInteger()) {
actualTrueValue = loadSimm11(trueValue);
actualFalseValue = loadSimm11(falseValue);
cmove = MOVicc;
} else {
throw GraalError.shouldNotReachHere();
}
Variable result = newVariable(trueValue.getValueKind());
ConditionFlag finalCondition = SPARCControlFlow.fromCondition(cmpSPARCKind.isInteger(), mirrored ? cond.mirror() : cond, unorderedIsTrue);
CC cc = CC.forKind(cmpSPARCKind);
append(new CondMoveOp(cmove, cc, finalCondition, actualTrueValue, actualFalseValue, result));
return result;
}
use of jdk.vm.ci.sparc.SPARCKind in project graal by oracle.
the class SPARCLIRGenerator method emitCompareBranch.
@Override
public void emitCompareBranch(PlatformKind cmpKind, Value x, Value y, Condition cond, boolean unorderedIsTrue, LabelRef trueDestination, LabelRef falseDestination, double trueDestinationProbability) {
AllocatableValue left;
Value right;
Condition actualCondition;
if (isJavaConstant(x)) {
left = load(y);
right = loadSimm13(x);
actualCondition = cond.mirror();
} else {
left = load(x);
right = loadSimm13(y);
actualCondition = cond;
}
SPARCKind actualCmpKind = (SPARCKind) cmpKind;
if (actualCmpKind.isInteger()) {
assert actualCmpKind.equals(XWORD) || actualCmpKind.equals(WORD) : "SPARC does not support compare of: " + actualCmpKind;
append(new SPARCControlFlow.CompareBranchOp(left, right, actualCondition, trueDestination, falseDestination, actualCmpKind, unorderedIsTrue, trueDestinationProbability));
} else if (actualCmpKind.isFloat()) {
emitFloatCompare(actualCmpKind, x, y, Fcc0);
ConditionFlag cf = SPARCControlFlow.fromCondition(false, cond, unorderedIsTrue);
append(new SPARCControlFlow.BranchOp(cf, trueDestination, falseDestination, actualCmpKind, trueDestinationProbability));
} else {
throw GraalError.shouldNotReachHere();
}
}
use of jdk.vm.ci.sparc.SPARCKind in project graal by oracle.
the class SPARCLIRGenerator method emitOverflowCheckBranch.
@Override
public void emitOverflowCheckBranch(LabelRef overflow, LabelRef noOverflow, LIRKind cmpLIRKind, double overflowProbability) {
SPARCKind cmpKind = (SPARCKind) cmpLIRKind.getPlatformKind();
append(new BranchOp(ConditionFlag.OverflowSet, overflow, noOverflow, cmpKind, overflowProbability));
}
use of jdk.vm.ci.sparc.SPARCKind in project graal by oracle.
the class SPARCByteSwapOp method emitCode.
@Override
public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
SPARCAddress addr = (SPARCAddress) crb.asAddress(tmpSlot);
SPARCMove.emitStore(input, addr, result.getPlatformKind(), SPARCDelayedControlTransfer.DUMMY, null, crb, masm);
if (addr.getIndex().equals(Register.None)) {
Register tempReg = ValueUtil.asRegister(tempIndex, XWORD);
masm.setx(addr.getDisplacement(), tempReg, false);
addr = new SPARCAddress(addr.getBase(), tempReg);
}
getDelayedControlTransfer().emitControlTransfer(crb, masm);
switch((SPARCKind) input.getPlatformKind()) {
case WORD:
masm.lduwa(addr.getBase(), addr.getIndex(), asRegister(result, WORD), Asi.ASI_PRIMARY_LITTLE);
break;
case XWORD:
masm.ldxa(addr.getBase(), addr.getIndex(), asRegister(result, XWORD), Asi.ASI_PRIMARY_LITTLE);
break;
default:
throw GraalError.shouldNotReachHere();
}
}
Aggregations