use of org.graalvm.compiler.asm.sparc.SPARCAssembler.CC in project graal by oracle.
the class SPARCControlFlow method emitBranch.
private static boolean emitBranch(CompilationResultBuilder crb, SPARCMacroAssembler masm, SPARCKind kind, ConditionFlag conditionFlag, LabelRef trueDestination, LabelRef falseDestination, boolean withDelayedNop, double trueDestinationProbability) {
Label actualTarget;
ConditionFlag actualConditionFlag;
boolean needJump;
BranchPredict predictTaken;
if (falseDestination != null && crb.isSuccessorEdge(trueDestination)) {
actualConditionFlag = conditionFlag != null ? conditionFlag.negate() : null;
actualTarget = falseDestination.label();
needJump = false;
predictTaken = trueDestinationProbability < .5d ? PREDICT_TAKEN : PREDICT_NOT_TAKEN;
} else {
actualConditionFlag = conditionFlag;
actualTarget = trueDestination.label();
needJump = falseDestination != null && !crb.isSuccessorEdge(falseDestination);
predictTaken = trueDestinationProbability > .5d ? PREDICT_TAKEN : PREDICT_NOT_TAKEN;
}
if (!withDelayedNop && needJump) {
// We cannot make use of the delay slot when we jump in true-case and false-case
return false;
}
if (kind.isFloat()) {
FBPCC.emit(masm, Fcc0, actualConditionFlag, NOT_ANNUL, predictTaken, actualTarget);
} else {
assert kind.isInteger();
CC cc = kind.equals(WORD) ? Icc : Xcc;
BPCC.emit(masm, cc, actualConditionFlag, NOT_ANNUL, predictTaken, actualTarget);
}
if (withDelayedNop) {
// delay slot
masm.nop();
}
if (needJump) {
masm.jmp(falseDestination.label());
}
return true;
}
use of org.graalvm.compiler.asm.sparc.SPARCAssembler.CC in project graal by oracle.
the class SPARCLIRGenerator method emitIntegerTestMove.
@Override
public Variable emitIntegerTestMove(Value left, Value right, Value trueValue, Value falseValue) {
emitIntegerTest(left, right);
Variable result = newVariable(trueValue.getValueKind());
ConditionFlag flag = SPARCControlFlow.fromCondition(true, Condition.EQ, false);
CC cc = CC.forKind(left.getPlatformKind());
append(new CondMoveOp(MOVicc, cc, flag, loadSimm11(trueValue), loadSimm11(falseValue), result));
return result;
}
use of org.graalvm.compiler.asm.sparc.SPARCAssembler.CC 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;
}
Aggregations