Search in sources :

Example 1 with CompareAndSwapOp

use of org.graalvm.compiler.lir.aarch64.AArch64Move.CompareAndSwapOp in project graal by oracle.

the class AArch64LIRGenerator method emitValueCompareAndSwap.

@Override
public Variable emitValueCompareAndSwap(Value address, Value expectedValue, Value newValue) {
    Variable result = newVariable(newValue.getValueKind());
    Variable scratch = newVariable(LIRKind.value(AArch64Kind.WORD));
    append(new CompareAndSwapOp(result, loadNonCompareConst(expectedValue), loadReg(newValue), asAllocatable(address), scratch));
    return result;
}
Also used : Variable(org.graalvm.compiler.lir.Variable) CompareAndSwapOp(org.graalvm.compiler.lir.aarch64.AArch64Move.CompareAndSwapOp)

Example 2 with CompareAndSwapOp

use of org.graalvm.compiler.lir.aarch64.AArch64Move.CompareAndSwapOp 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;
}
Also used : Variable(org.graalvm.compiler.lir.Variable) CompareAndSwapOp(org.graalvm.compiler.lir.aarch64.AArch64Move.CompareAndSwapOp) CondMoveOp(org.graalvm.compiler.lir.aarch64.AArch64ControlFlow.CondMoveOp)

Aggregations

Variable (org.graalvm.compiler.lir.Variable)2 CompareAndSwapOp (org.graalvm.compiler.lir.aarch64.AArch64Move.CompareAndSwapOp)2 CondMoveOp (org.graalvm.compiler.lir.aarch64.AArch64ControlFlow.CondMoveOp)1