Search in sources :

Example 1 with CompareAndSwapOp

use of org.graalvm.compiler.lir.amd64.AMD64Move.CompareAndSwapOp in project graal by oracle.

the class AMD64LIRGenerator method emitLogicCompareAndSwap.

@Override
public Variable emitLogicCompareAndSwap(Value address, Value expectedValue, Value newValue, Value trueValue, Value falseValue) {
    ValueKind<?> kind = newValue.getValueKind();
    assert kind.equals(expectedValue.getValueKind());
    AMD64Kind memKind = (AMD64Kind) kind.getPlatformKind();
    AMD64AddressValue addressValue = asAddressValue(address);
    RegisterValue raxRes = AMD64.rax.asValue(kind);
    emitMove(raxRes, expectedValue);
    append(new CompareAndSwapOp(memKind, raxRes, addressValue, raxRes, asAllocatable(newValue)));
    assert trueValue.getValueKind().equals(falseValue.getValueKind());
    Variable result = newVariable(trueValue.getValueKind());
    append(new CondMoveOp(result, Condition.EQ, asAllocatable(trueValue), falseValue));
    return result;
}
Also used : AMD64AddressValue(org.graalvm.compiler.lir.amd64.AMD64AddressValue) RegisterValue(jdk.vm.ci.code.RegisterValue) AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) Variable(org.graalvm.compiler.lir.Variable) CompareAndSwapOp(org.graalvm.compiler.lir.amd64.AMD64Move.CompareAndSwapOp) CondMoveOp(org.graalvm.compiler.lir.amd64.AMD64ControlFlow.CondMoveOp) FloatCondMoveOp(org.graalvm.compiler.lir.amd64.AMD64ControlFlow.FloatCondMoveOp)

Example 2 with CompareAndSwapOp

use of org.graalvm.compiler.lir.amd64.AMD64Move.CompareAndSwapOp 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));
}
Also used : RegisterValue(jdk.vm.ci.code.RegisterValue) AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) BranchOp(org.graalvm.compiler.lir.amd64.AMD64ControlFlow.BranchOp) FloatBranchOp(org.graalvm.compiler.lir.amd64.AMD64ControlFlow.FloatBranchOp) CompareAndSwapOp(org.graalvm.compiler.lir.amd64.AMD64Move.CompareAndSwapOp)

Example 3 with CompareAndSwapOp

use of org.graalvm.compiler.lir.amd64.AMD64Move.CompareAndSwapOp in project graal by oracle.

the class AMD64LIRGenerator method emitValueCompareAndSwap.

@Override
public Value emitValueCompareAndSwap(Value address, Value expectedValue, Value newValue) {
    ValueKind<?> kind = newValue.getValueKind();
    assert kind.equals(expectedValue.getValueKind());
    AMD64Kind memKind = (AMD64Kind) kind.getPlatformKind();
    AMD64AddressValue addressValue = asAddressValue(address);
    RegisterValue raxRes = AMD64.rax.asValue(kind);
    emitMove(raxRes, expectedValue);
    append(new CompareAndSwapOp(memKind, raxRes, addressValue, raxRes, asAllocatable(newValue)));
    Variable result = newVariable(kind);
    emitMove(result, raxRes);
    return result;
}
Also used : AMD64AddressValue(org.graalvm.compiler.lir.amd64.AMD64AddressValue) RegisterValue(jdk.vm.ci.code.RegisterValue) AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) Variable(org.graalvm.compiler.lir.Variable) CompareAndSwapOp(org.graalvm.compiler.lir.amd64.AMD64Move.CompareAndSwapOp)

Aggregations

AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)3 RegisterValue (jdk.vm.ci.code.RegisterValue)3 CompareAndSwapOp (org.graalvm.compiler.lir.amd64.AMD64Move.CompareAndSwapOp)3 Variable (org.graalvm.compiler.lir.Variable)2 AMD64AddressValue (org.graalvm.compiler.lir.amd64.AMD64AddressValue)2 BranchOp (org.graalvm.compiler.lir.amd64.AMD64ControlFlow.BranchOp)1 CondMoveOp (org.graalvm.compiler.lir.amd64.AMD64ControlFlow.CondMoveOp)1 FloatBranchOp (org.graalvm.compiler.lir.amd64.AMD64ControlFlow.FloatBranchOp)1 FloatCondMoveOp (org.graalvm.compiler.lir.amd64.AMD64ControlFlow.FloatCondMoveOp)1