Search in sources :

Example 21 with AMD64Kind

use of jdk.vm.ci.amd64.AMD64Kind 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 22 with AMD64Kind

use of jdk.vm.ci.amd64.AMD64Kind 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)

Example 23 with AMD64Kind

use of jdk.vm.ci.amd64.AMD64Kind in project graal by oracle.

the class AMD64MoveFactoryBase method createStackMove.

@Override
public final AMD64LIRInstruction createStackMove(AllocatableValue result, AllocatableValue input) {
    AMD64Kind kind = (AMD64Kind) result.getPlatformKind();
    switch(kind.getSizeInBytes()) {
        case 2:
            return new AMD64PushPopStackMove(WORD, result, input);
        case 8:
            return new AMD64PushPopStackMove(QWORD, result, input);
        default:
            RegisterBackupPair backup = backupSlotProvider.getScratchRegister(input.getPlatformKind());
            Register scratchRegister = backup.register;
            VirtualStackSlot backupSlot = backup.backupSlot;
            return createStackMove(result, input, scratchRegister, backupSlot);
    }
}
Also used : AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) Register(jdk.vm.ci.code.Register) AMD64PushPopStackMove(org.graalvm.compiler.lir.amd64.AMD64Move.AMD64PushPopStackMove) VirtualStackSlot(org.graalvm.compiler.lir.VirtualStackSlot)

Example 24 with AMD64Kind

use of jdk.vm.ci.amd64.AMD64Kind in project graal by oracle.

the class AMD64ArithmeticLIRGenerator method emitDiv.

@Override
public Value emitDiv(Value a, Value b, LIRFrameState state) {
    TargetDescription target = getLIRGen().target();
    boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
    LIRKind resultKind = LIRKind.combine(a, b);
    switch((AMD64Kind) a.getPlatformKind()) {
        case DWORD:
            AMD64MulDivOp op = emitIDIV(DWORD, a, b, state);
            return getLIRGen().emitMove(op.getQuotient());
        case QWORD:
            AMD64MulDivOp lop = emitIDIV(QWORD, a, b, state);
            return getLIRGen().emitMove(lop.getQuotient());
        case SINGLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.DIV, SS, false, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.DIV, SS, false, a, b);
            }
        case DOUBLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.DIV, SD, false, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.DIV, SD, false, a, b);
            }
        default:
            throw GraalError.shouldNotReachHere();
    }
}
Also used : AMD64MulDivOp(org.graalvm.compiler.lir.amd64.AMD64MulDivOp) AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) TargetDescription(jdk.vm.ci.code.TargetDescription) LIRKind(org.graalvm.compiler.core.common.LIRKind)

Aggregations

AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)24 TargetDescription (jdk.vm.ci.code.TargetDescription)9 AMD64AddressValue (org.graalvm.compiler.lir.amd64.AMD64AddressValue)8 Variable (org.graalvm.compiler.lir.Variable)7 LIRKind (org.graalvm.compiler.core.common.LIRKind)6 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)5 RegisterValue (jdk.vm.ci.code.RegisterValue)3 Register (jdk.vm.ci.code.Register)2 JavaConstant (jdk.vm.ci.meta.JavaConstant)2 Value (jdk.vm.ci.meta.Value)2 AMD64Address (org.graalvm.compiler.asm.amd64.AMD64Address)2 AMD64RMOp (org.graalvm.compiler.asm.amd64.AMD64Assembler.AMD64RMOp)2 OperandSize (org.graalvm.compiler.asm.amd64.AMD64Assembler.OperandSize)2 CanonicalCondition (org.graalvm.compiler.core.common.calc.CanonicalCondition)2 Condition (org.graalvm.compiler.core.common.calc.Condition)2 NodeLIRBuilder (org.graalvm.compiler.core.gen.NodeLIRBuilder)2 ComplexMatchResult (org.graalvm.compiler.core.match.ComplexMatchResult)2 LabelRef (org.graalvm.compiler.lir.LabelRef)2 AMD64Move (org.graalvm.compiler.lir.amd64.AMD64Move)2 CompareAndSwapOp (org.graalvm.compiler.lir.amd64.AMD64Move.CompareAndSwapOp)2