Search in sources :

Example 6 with SPARCKind

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

the class SPARCArithmeticLIRGenerator method emitReinterpret.

@Override
public AllocatableValue emitReinterpret(LIRKind to, Value inputVal) {
    SPARCKind fromKind = (SPARCKind) inputVal.getPlatformKind();
    SPARCKind toKind = (SPARCKind) to.getPlatformKind();
    AllocatableValue input = getLIRGen().asAllocatable(inputVal);
    Variable result = getLIRGen().newVariable(to);
    // These cases require a move between CPU and FPU registers:
    if (fromKind.isFloat() != toKind.isFloat()) {
        moveBetweenFpGp(result, input);
        return result;
    } else {
        // Consequently, there is no need for a special zero-extension move.
        return emitConvertMove(to, input);
    }
}
Also used : Variable(org.graalvm.compiler.lir.Variable) SPARCKind(jdk.vm.ci.sparc.SPARCKind) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 7 with SPARCKind

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

the class SPARCLIRGenerator method emitConditionalMove.

@Override
public Variable emitConditionalMove(PlatformKind cmpKind, Value left, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue) {
    // Emit compare
    SPARCKind cmpSPARCKind = (SPARCKind) cmpKind;
    boolean mirrored = emitCompare(cmpSPARCKind, left, right);
    // Emit move
    Value actualTrueValue = trueValue;
    Value actualFalseValue = falseValue;
    SPARCKind valueKind = (SPARCKind) trueValue.getPlatformKind();
    CMOV cmove;
    if (valueKind.isFloat()) {
        // Floats cannot be immediate at all
        actualTrueValue = load(trueValue);
        actualFalseValue = load(falseValue);
        cmove = valueKind.equals(SINGLE) ? FMOVSCC : FMOVDCC;
    } else if (valueKind.isInteger()) {
        actualTrueValue = loadSimm11(trueValue);
        actualFalseValue = loadSimm11(falseValue);
        cmove = MOVicc;
    } else {
        throw GraalError.shouldNotReachHere();
    }
    Variable result = newVariable(trueValue.getValueKind());
    ConditionFlag finalCondition = SPARCControlFlow.fromCondition(cmpSPARCKind.isInteger(), mirrored ? cond.mirror() : cond, unorderedIsTrue);
    CC cc = CC.forKind(cmpSPARCKind);
    append(new CondMoveOp(cmove, cc, finalCondition, actualTrueValue, actualFalseValue, result));
    return result;
}
Also used : FMOVSCC(org.graalvm.compiler.asm.sparc.SPARCAssembler.FMOVSCC) CC(org.graalvm.compiler.asm.sparc.SPARCAssembler.CC) FMOVDCC(org.graalvm.compiler.asm.sparc.SPARCAssembler.FMOVDCC) Variable(org.graalvm.compiler.lir.Variable) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) SPARCImmediateAddressValue(org.graalvm.compiler.lir.sparc.SPARCImmediateAddressValue) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) CondMoveOp(org.graalvm.compiler.lir.sparc.SPARCControlFlow.CondMoveOp) SPARCKind(jdk.vm.ci.sparc.SPARCKind) CMOV(org.graalvm.compiler.asm.sparc.SPARCAssembler.CMOV) ConditionFlag(org.graalvm.compiler.asm.sparc.SPARCAssembler.ConditionFlag)

Example 8 with SPARCKind

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

the class SPARCLIRGenerator method emitCompareBranch.

@Override
public void emitCompareBranch(PlatformKind cmpKind, Value x, Value y, Condition cond, boolean unorderedIsTrue, LabelRef trueDestination, LabelRef falseDestination, double trueDestinationProbability) {
    AllocatableValue left;
    Value right;
    Condition actualCondition;
    if (isJavaConstant(x)) {
        left = load(y);
        right = loadSimm13(x);
        actualCondition = cond.mirror();
    } else {
        left = load(x);
        right = loadSimm13(y);
        actualCondition = cond;
    }
    SPARCKind actualCmpKind = (SPARCKind) cmpKind;
    if (actualCmpKind.isInteger()) {
        assert actualCmpKind.equals(XWORD) || actualCmpKind.equals(WORD) : "SPARC does not support compare of: " + actualCmpKind;
        append(new SPARCControlFlow.CompareBranchOp(left, right, actualCondition, trueDestination, falseDestination, actualCmpKind, unorderedIsTrue, trueDestinationProbability));
    } else if (actualCmpKind.isFloat()) {
        emitFloatCompare(actualCmpKind, x, y, Fcc0);
        ConditionFlag cf = SPARCControlFlow.fromCondition(false, cond, unorderedIsTrue);
        append(new SPARCControlFlow.BranchOp(cf, trueDestination, falseDestination, actualCmpKind, trueDestinationProbability));
    } else {
        throw GraalError.shouldNotReachHere();
    }
}
Also used : Condition(org.graalvm.compiler.core.common.calc.Condition) BranchOp(org.graalvm.compiler.lir.sparc.SPARCControlFlow.BranchOp) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) SPARCImmediateAddressValue(org.graalvm.compiler.lir.sparc.SPARCImmediateAddressValue) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) SPARCKind(jdk.vm.ci.sparc.SPARCKind) SPARCControlFlow(org.graalvm.compiler.lir.sparc.SPARCControlFlow) ConditionFlag(org.graalvm.compiler.asm.sparc.SPARCAssembler.ConditionFlag)

Example 9 with SPARCKind

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

the class SPARCLIRGenerator method emitOverflowCheckBranch.

@Override
public void emitOverflowCheckBranch(LabelRef overflow, LabelRef noOverflow, LIRKind cmpLIRKind, double overflowProbability) {
    SPARCKind cmpKind = (SPARCKind) cmpLIRKind.getPlatformKind();
    append(new BranchOp(ConditionFlag.OverflowSet, overflow, noOverflow, cmpKind, overflowProbability));
}
Also used : BranchOp(org.graalvm.compiler.lir.sparc.SPARCControlFlow.BranchOp) SPARCKind(jdk.vm.ci.sparc.SPARCKind)

Example 10 with SPARCKind

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

the class SPARCByteSwapOp method emitCode.

@Override
public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
    SPARCAddress addr = (SPARCAddress) crb.asAddress(tmpSlot);
    SPARCMove.emitStore(input, addr, result.getPlatformKind(), SPARCDelayedControlTransfer.DUMMY, null, crb, masm);
    if (addr.getIndex().equals(Register.None)) {
        Register tempReg = ValueUtil.asRegister(tempIndex, XWORD);
        masm.setx(addr.getDisplacement(), tempReg, false);
        addr = new SPARCAddress(addr.getBase(), tempReg);
    }
    getDelayedControlTransfer().emitControlTransfer(crb, masm);
    switch((SPARCKind) input.getPlatformKind()) {
        case WORD:
            masm.lduwa(addr.getBase(), addr.getIndex(), asRegister(result, WORD), Asi.ASI_PRIMARY_LITTLE);
            break;
        case XWORD:
            masm.ldxa(addr.getBase(), addr.getIndex(), asRegister(result, XWORD), Asi.ASI_PRIMARY_LITTLE);
            break;
        default:
            throw GraalError.shouldNotReachHere();
    }
}
Also used : Register(jdk.vm.ci.code.Register) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) SPARCKind(jdk.vm.ci.sparc.SPARCKind) SPARCAddress(org.graalvm.compiler.asm.sparc.SPARCAddress)

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