Search in sources :

Example 1 with SPARCKind

use of jdk.vm.ci.sparc.SPARCKind in project graal by oracle.

the class SPARCHotSpotLIRGenerator 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());
    SPARCKind memKind = (SPARCKind) kind.getPlatformKind();
    Variable result = newVariable(newValue.getValueKind());
    append(new CompareAndSwapOp(result, asAllocatable(address), asAllocatable(expectedValue), asAllocatable(newValue)));
    return emitConditionalMove(memKind, expectedValue, result, Condition.EQ, true, trueValue, falseValue);
}
Also used : Variable(org.graalvm.compiler.lir.Variable) CompareAndSwapOp(org.graalvm.compiler.lir.sparc.SPARCMove.CompareAndSwapOp) SPARCKind(jdk.vm.ci.sparc.SPARCKind)

Example 2 with SPARCKind

use of jdk.vm.ci.sparc.SPARCKind in project graal by oracle.

the class SPARCArithmeticLIRGenerator method emitMathAbs.

@Override
public Value emitMathAbs(Value inputValue) {
    Variable result = getLIRGen().newVariable(LIRKind.combine(inputValue));
    SPARCKind kind = (SPARCKind) inputValue.getPlatformKind();
    Opfs opf;
    switch(kind) {
        case SINGLE:
            opf = Opfs.Fabss;
            break;
        case DOUBLE:
            opf = Opfs.Fabsd;
            break;
        default:
            throw GraalError.shouldNotReachHere("Input kind: " + kind);
    }
    getLIRGen().append(new SPARCOPFOp(opf, g0.asValue(), getLIRGen().asAllocatable(inputValue), result));
    return result;
}
Also used : SPARCOPFOp(org.graalvm.compiler.lir.sparc.SPARCOPFOp) Variable(org.graalvm.compiler.lir.Variable) Opfs(org.graalvm.compiler.asm.sparc.SPARCAssembler.Opfs) SPARCKind(jdk.vm.ci.sparc.SPARCKind)

Example 3 with SPARCKind

use of jdk.vm.ci.sparc.SPARCKind in project graal by oracle.

the class SPARCArithmeticLIRGenerator method emitShr.

@Override
public Variable emitShr(Value a, Value b) {
    SPARCKind aKind = (SPARCKind) a.getPlatformKind();
    LIRKind resultKind = LIRKind.combine(a, b).changeType(aKind);
    Op3s op;
    switch(aKind) {
        case WORD:
            op = Op3s.Sra;
            break;
        case XWORD:
            op = Op3s.Srax;
            break;
        default:
            throw GraalError.shouldNotReachHere();
    }
    return emitBinary(resultKind, op, a, b);
}
Also used : Op3s(org.graalvm.compiler.asm.sparc.SPARCAssembler.Op3s) LIRKind(org.graalvm.compiler.core.common.LIRKind) SPARCKind(jdk.vm.ci.sparc.SPARCKind)

Example 4 with SPARCKind

use of jdk.vm.ci.sparc.SPARCKind in project graal by oracle.

the class SPARCArithmeticLIRGenerator method emitRem.

@Override
public Value emitRem(Value a, Value b, LIRFrameState state) {
    Variable result = getLIRGen().newVariable(LIRKind.combine(a, b));
    // Intermediate values
    Variable q1;
    Variable q2;
    switch((SPARCKind) a.getPlatformKind()) {
        case WORD:
            // Sign extend a and b
            Value as = emitSignExtend(a);
            Value bs = emitSignExtend(b);
            q1 = emitBinary(as.getValueKind(), Sdivx, as, bs, state);
            q2 = emitBinary(as.getValueKind(), Mulx, q1, bs);
            result = emitSub(as, q2, false);
            break;
        case XWORD:
            q1 = emitBinary(result.getValueKind(), Sdivx, a, b, state);
            q2 = emitBinary(result.getValueKind(), Mulx, q1, b);
            result = emitSub(a, q2, false);
            break;
        case SINGLE:
            ForeignCallLinkage fremCall = getLIRGen().getForeignCalls().lookupForeignCall(ARITHMETIC_FREM);
            result = getLIRGen().emitForeignCall(fremCall, state, a, b);
            break;
        case DOUBLE:
            ForeignCallLinkage dremCall = getLIRGen().getForeignCalls().lookupForeignCall(ARITHMETIC_DREM);
            result = getLIRGen().emitForeignCall(dremCall, state, a, b);
            break;
        default:
            throw GraalError.shouldNotReachHere("missing: " + a.getPlatformKind());
    }
    return result;
}
Also used : Variable(org.graalvm.compiler.lir.Variable) ConstantValue(org.graalvm.compiler.lir.ConstantValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) ForeignCallLinkage(org.graalvm.compiler.core.common.spi.ForeignCallLinkage) SPARCKind(jdk.vm.ci.sparc.SPARCKind)

Example 5 with SPARCKind

use of jdk.vm.ci.sparc.SPARCKind in project graal by oracle.

the class SPARCArithmeticLIRGenerator method emitShl.

@Override
public Variable emitShl(Value a, Value b) {
    SPARCKind aKind = (SPARCKind) a.getPlatformKind();
    LIRKind resultKind = LIRKind.combine(a, b).changeType(aKind);
    Op3s op;
    switch(aKind) {
        case WORD:
            op = Op3s.Sll;
            break;
        case XWORD:
            op = Op3s.Sllx;
            break;
        default:
            throw GraalError.shouldNotReachHere(String.format("Unsupported kind %s", aKind));
    }
    return emitBinary(resultKind, op, a, b);
}
Also used : Op3s(org.graalvm.compiler.asm.sparc.SPARCAssembler.Op3s) LIRKind(org.graalvm.compiler.core.common.LIRKind) SPARCKind(jdk.vm.ci.sparc.SPARCKind)

Aggregations

SPARCKind (jdk.vm.ci.sparc.SPARCKind)15 Variable (org.graalvm.compiler.lir.Variable)6 Value (jdk.vm.ci.meta.Value)5 LIRKind (org.graalvm.compiler.core.common.LIRKind)5 SPARCAddressValue (org.graalvm.compiler.lir.sparc.SPARCAddressValue)5 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)4 Op3s (org.graalvm.compiler.asm.sparc.SPARCAssembler.Op3s)3 Condition (org.graalvm.compiler.core.common.calc.Condition)3 BranchOp (org.graalvm.compiler.lir.sparc.SPARCControlFlow.BranchOp)3 JavaConstant (jdk.vm.ci.meta.JavaConstant)2 BYTE (jdk.vm.ci.sparc.SPARCKind.BYTE)2 HWORD (jdk.vm.ci.sparc.SPARCKind.HWORD)2 WORD (jdk.vm.ci.sparc.SPARCKind.WORD)2 XWORD (jdk.vm.ci.sparc.SPARCKind.XWORD)2 ConditionFlag (org.graalvm.compiler.asm.sparc.SPARCAssembler.ConditionFlag)2 Opfs (org.graalvm.compiler.asm.sparc.SPARCAssembler.Opfs)2 CanonicalCondition (org.graalvm.compiler.core.common.calc.CanonicalCondition)2 NodeMatchRules (org.graalvm.compiler.core.gen.NodeMatchRules)2 ComplexMatchResult (org.graalvm.compiler.core.match.ComplexMatchResult)2 MatchRule (org.graalvm.compiler.core.match.MatchRule)2