use of org.graalvm.compiler.lir.amd64.AMD64AddressValue 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;
}
use of org.graalvm.compiler.lir.amd64.AMD64AddressValue in project graal by oracle.
the class AMD64LIRGenerator method emitAtomicReadAndAdd.
@Override
public Value emitAtomicReadAndAdd(Value address, Value delta) {
ValueKind<?> kind = delta.getValueKind();
Variable result = newVariable(kind);
AMD64AddressValue addressValue = asAddressValue(address);
append(new AMD64Move.AtomicReadAndAddOp((AMD64Kind) kind.getPlatformKind(), result, addressValue, asAllocatable(delta)));
return result;
}
use of org.graalvm.compiler.lir.amd64.AMD64AddressValue 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.AMD64AddressValue in project graal by oracle.
the class AMD64LIRGenerator method emitAtomicReadAndWrite.
@Override
public Value emitAtomicReadAndWrite(Value address, Value newValue) {
ValueKind<?> kind = newValue.getValueKind();
Variable result = newVariable(kind);
AMD64AddressValue addressValue = asAddressValue(address);
append(new AMD64Move.AtomicReadAndWriteOp((AMD64Kind) kind.getPlatformKind(), result, addressValue, asAllocatable(newValue)));
return result;
}
use of org.graalvm.compiler.lir.amd64.AMD64AddressValue 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;
};
}
}
Aggregations