Search in sources :

Example 16 with AMD64.rbx

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

the class AMD64ArithmeticLIRGenerator method emitOr.

@Override
public Variable emitOr(Value a, Value b) {
    LIRKind resultKind = LIRKind.combine(a, b);
    TargetDescription target = getLIRGen().target();
    boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
    switch((AMD64Kind) a.getPlatformKind()) {
        case DWORD:
            return emitBinary(resultKind, OR, DWORD, true, a, b, false);
        case QWORD:
            return emitBinary(resultKind, OR, QWORD, true, a, b, false);
        case SINGLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.OR, PS, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.OR, PS, true, a, b);
            }
        case DOUBLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.OR, PD, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.OR, PD, true, a, b);
            }
        default:
            throw GraalError.shouldNotReachHere();
    }
}
Also used : AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) TargetDescription(jdk.vm.ci.code.TargetDescription) LIRKind(org.graalvm.compiler.core.common.LIRKind)

Example 17 with AMD64.rbx

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

the class AMD64ArithmeticLIRGenerator method emitAnd.

@Override
public Variable emitAnd(Value a, Value b) {
    LIRKind resultKind = LIRKind.combine(a, b);
    TargetDescription target = getLIRGen().target();
    boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
    switch((AMD64Kind) a.getPlatformKind()) {
        case DWORD:
            return emitBinary(resultKind, AND, DWORD, true, a, b, false);
        case QWORD:
            return emitBinary(resultKind, AND, QWORD, true, a, b, false);
        case SINGLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.AND, PS, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.AND, PS, true, a, b);
            }
        case DOUBLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.AND, PD, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.AND, PD, true, a, b);
            }
        default:
            throw GraalError.shouldNotReachHere();
    }
}
Also used : AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) TargetDescription(jdk.vm.ci.code.TargetDescription) LIRKind(org.graalvm.compiler.core.common.LIRKind)

Example 18 with AMD64.rbx

use of jdk.vm.ci.amd64.AMD64.rbx 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 19 with AMD64.rbx

use of jdk.vm.ci.amd64.AMD64.rbx 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 20 with AMD64.rbx

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

the class AMD64AddressLoweringTest method checkAMD64.

@Before
public void checkAMD64() {
    assumeTrue("skipping AMD64 specific test", getTarget().arch instanceof AMD64);
    graph = new StructuredGraph.Builder(getInitialOptions(), getDebugContext()).build();
    lowering = new AMD64AddressLowering();
}
Also used : AMD64(jdk.vm.ci.amd64.AMD64) AMD64AddressLowering(org.graalvm.compiler.core.amd64.AMD64AddressLowering) Before(org.junit.Before)

Aggregations

AMD64 (jdk.vm.ci.amd64.AMD64)13 AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)11 TargetDescription (jdk.vm.ci.code.TargetDescription)9 Test (org.junit.Test)6 Architecture (jdk.vm.ci.code.Architecture)5 LIRKind (org.graalvm.compiler.core.common.LIRKind)5 SPARC (jdk.vm.ci.sparc.SPARC)4 GraalCompilerTest (org.graalvm.compiler.core.test.GraalCompilerTest)4 ValueNode (org.graalvm.compiler.nodes.ValueNode)4 RegisterValue (jdk.vm.ci.code.RegisterValue)3 Variable (org.graalvm.compiler.lir.Variable)3 CompareAndSwapOp (org.graalvm.compiler.lir.amd64.AMD64Move.CompareAndSwapOp)3 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)2 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)2 AMD64AddressValue (org.graalvm.compiler.lir.amd64.AMD64AddressValue)2 Before (org.junit.Before)2 SubstrateTargetDescription (com.oracle.svm.core.graal.meta.SubstrateTargetDescription)1 ArrayList (java.util.ArrayList)1 CPUFeature (jdk.vm.ci.amd64.AMD64.CPUFeature)1 AMD64.rax (jdk.vm.ci.amd64.AMD64.rax)1