use of org.graalvm.compiler.lir.aarch64.AArch64ControlFlow.CondMoveOp in project graal by oracle.
the class AArch64LIRGenerator method emitIntegerTestMove.
/**
* Moves trueValue into result if (left & right) == 0, else falseValue.
*
* @param left Integer kind. Non null.
* @param right Integer kind. Non null.
* @param trueValue Integer kind. Non null.
* @param falseValue Integer kind. Non null.
* @return virtual register containing trueValue if (left & right) == 0, else falseValue.
*/
@Override
public Variable emitIntegerTestMove(Value left, Value right, Value trueValue, Value falseValue) {
assert ((AArch64Kind) left.getPlatformKind()).isInteger() && ((AArch64Kind) right.getPlatformKind()).isInteger();
assert ((AArch64Kind) trueValue.getPlatformKind()).isInteger() && ((AArch64Kind) falseValue.getPlatformKind()).isInteger();
((AArch64ArithmeticLIRGenerator) getArithmetic()).emitBinary(left.getValueKind(), AArch64ArithmeticOp.ANDS, true, left, right);
Variable result = newVariable(trueValue.getValueKind());
append(new CondMoveOp(result, ConditionFlag.EQ, load(trueValue), load(falseValue)));
return result;
}
use of org.graalvm.compiler.lir.aarch64.AArch64ControlFlow.CondMoveOp in project graal by oracle.
the class AArch64LIRGenerator method emitConditionalMove.
/**
* Conditionally move trueValue into new variable if cond + unorderedIsTrue is true, else
* falseValue.
*
* @param left Arbitrary value. Has to have same type as right. Non null.
* @param right Arbitrary value. Has to have same type as left. Non null.
* @param cond condition that decides whether to move trueValue or falseValue into result. Non
* null.
* @param unorderedIsTrue defines whether floating-point comparisons consider unordered true or
* not. Ignored for integer comparisons.
* @param trueValue arbitrary value same type as falseValue. Non null.
* @param falseValue arbitrary value same type as trueValue. Non null.
* @return value containing trueValue if cond + unorderedIsTrue is true, else falseValue. Non
* null.
*/
@Override
public Variable emitConditionalMove(PlatformKind cmpKind, Value left, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue) {
boolean mirrored = emitCompare(cmpKind, left, right, cond, unorderedIsTrue);
Condition finalCondition = mirrored ? cond.mirror() : cond;
boolean finalUnorderedIsTrue = mirrored ? !unorderedIsTrue : unorderedIsTrue;
ConditionFlag cmpCondition = toConditionFlag(((AArch64Kind) cmpKind).isInteger(), finalCondition, finalUnorderedIsTrue);
Variable result = newVariable(trueValue.getValueKind());
append(new CondMoveOp(result, cmpCondition, loadReg(trueValue), loadReg(falseValue)));
return result;
}
use of org.graalvm.compiler.lir.aarch64.AArch64ControlFlow.CondMoveOp in project graal by oracle.
the class AArch64LIRGenerator method emitLogicCompareAndSwap.
@Override
public Variable emitLogicCompareAndSwap(Value address, Value expectedValue, Value newValue, Value trueValue, Value falseValue) {
Variable prevValue = newVariable(expectedValue.getValueKind());
Variable scratch = newVariable(LIRKind.value(AArch64Kind.DWORD));
append(new CompareAndSwapOp(prevValue, loadReg(expectedValue), loadReg(newValue), asAllocatable(address), scratch));
assert trueValue.getValueKind().equals(falseValue.getValueKind());
Variable result = newVariable(trueValue.getValueKind());
append(new CondMoveOp(result, ConditionFlag.EQ, asAllocatable(trueValue), asAllocatable(falseValue)));
return result;
}
Aggregations