use of org.graalvm.compiler.lir.amd64.AMD64ControlFlow.BranchOp in project graal by oracle.
the class AMD64LIRGenerator method emitCompareBranchMemory.
public void emitCompareBranchMemory(AMD64Kind cmpKind, Value left, AMD64AddressValue right, LIRFrameState state, Condition cond, boolean unorderedIsTrue, LabelRef trueLabel, LabelRef falseLabel, double trueLabelProbability) {
boolean mirrored = emitCompareMemory(cmpKind, left, right, state);
Condition finalCondition = mirrored ? cond.mirror() : cond;
if (cmpKind.isXMM()) {
append(new FloatBranchOp(finalCondition, unorderedIsTrue, trueLabel, falseLabel, trueLabelProbability));
} else {
append(new BranchOp(finalCondition, trueLabel, falseLabel, trueLabelProbability));
}
}
use of org.graalvm.compiler.lir.amd64.AMD64ControlFlow.BranchOp in project graal by oracle.
the class AMD64NodeMatchRules method emitIntegerTestBranchMemory.
private ComplexMatchResult emitIntegerTestBranchMemory(IfNode x, ValueNode value, LIRLowerableAccess access) {
LabelRef trueLabel = getLIRBlock(x.trueSuccessor());
LabelRef falseLabel = getLIRBlock(x.falseSuccessor());
double trueLabelProbability = x.probability(x.trueSuccessor());
AMD64Kind kind = getMemoryKind(access);
OperandSize size = kind == AMD64Kind.QWORD ? QWORD : DWORD;
if (value.isConstant()) {
JavaConstant constant = value.asJavaConstant();
if (constant != null && kind == AMD64Kind.QWORD && !NumUtil.isInt(constant.asLong())) {
// Only imm32 as long
return null;
}
return builder -> {
AMD64AddressValue address = (AMD64AddressValue) operand(access.getAddress());
gen.append(new AMD64BinaryConsumer.MemoryConstOp(AMD64MIOp.TEST, size, address, (int) constant.asLong(), getState(access)));
gen.append(new BranchOp(Condition.EQ, trueLabel, falseLabel, trueLabelProbability));
return null;
};
} else {
return builder -> {
AMD64AddressValue address = (AMD64AddressValue) operand(access.getAddress());
gen.append(new AMD64BinaryConsumer.MemoryRMOp(AMD64RMOp.TEST, size, gen.asAllocatable(operand(value)), address, getState(access)));
gen.append(new BranchOp(Condition.EQ, trueLabel, falseLabel, trueLabelProbability));
return null;
};
}
}
use of org.graalvm.compiler.lir.amd64.AMD64ControlFlow.BranchOp in project graal by oracle.
the class AMD64LIRGenerator method emitCompareAndSwapBranch.
public void emitCompareAndSwapBranch(ValueKind<?> kind, AMD64AddressValue address, Value expectedValue, Value newValue, Condition condition, LabelRef trueLabel, LabelRef falseLabel, double trueLabelProbability) {
assert kind.equals(expectedValue.getValueKind());
assert kind.equals(newValue.getValueKind());
assert condition == Condition.EQ || condition == Condition.NE;
AMD64Kind memKind = (AMD64Kind) kind.getPlatformKind();
RegisterValue raxValue = AMD64.rax.asValue(kind);
emitMove(raxValue, expectedValue);
append(new CompareAndSwapOp(memKind, raxValue, address, raxValue, asAllocatable(newValue)));
append(new BranchOp(condition, trueLabel, falseLabel, trueLabelProbability));
}
use of org.graalvm.compiler.lir.amd64.AMD64ControlFlow.BranchOp in project graal by oracle.
the class AMD64LIRGenerator method emitIntegerTestBranch.
@Override
public void emitIntegerTestBranch(Value left, Value right, LabelRef trueDestination, LabelRef falseDestination, double trueDestinationProbability) {
emitIntegerTest(left, right);
append(new BranchOp(Condition.EQ, trueDestination, falseDestination, trueDestinationProbability));
}
Aggregations