Search in sources :

Example 36 with LIRKind

use of org.graalvm.compiler.core.common.LIRKind in project graal by oracle.

the class ReadRegisterNode method generate.

@Override
public void generate(NodeLIRBuilderTool generator) {
    LIRKind kind = generator.getLIRGeneratorTool().getLIRKind(stamp(NodeView.DEFAULT));
    Value result = register.asValue(kind);
    if (incoming) {
        generator.getLIRGeneratorTool().emitIncomingValues(new Value[] { result });
    }
    if (!directUse) {
        result = generator.getLIRGeneratorTool().emitMove(result);
    }
    generator.setResult(this, result);
}
Also used : Value(jdk.vm.ci.meta.Value) LIRKind(org.graalvm.compiler.core.common.LIRKind)

Example 37 with LIRKind

use of org.graalvm.compiler.core.common.LIRKind in project graal by oracle.

the class AMD64ArithmeticLIRGenerator method emitIDIV.

private AMD64MulDivOp emitIDIV(OperandSize size, Value a, Value b, LIRFrameState state) {
    LIRKind kind = LIRKind.combine(a, b);
    AMD64SignExtendOp sx = getLIRGen().append(new AMD64SignExtendOp(size, kind, moveToReg(AMD64.rax, a)));
    return getLIRGen().append(new AMD64MulDivOp(AMD64MOp.IDIV, size, kind, sx.getHighResult(), sx.getLowResult(), getLIRGen().asAllocatable(b), state));
}
Also used : AMD64MulDivOp(org.graalvm.compiler.lir.amd64.AMD64MulDivOp) AMD64SignExtendOp(org.graalvm.compiler.lir.amd64.AMD64SignExtendOp) LIRKind(org.graalvm.compiler.core.common.LIRKind)

Example 38 with LIRKind

use of org.graalvm.compiler.core.common.LIRKind 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 39 with LIRKind

use of org.graalvm.compiler.core.common.LIRKind 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 40 with LIRKind

use of org.graalvm.compiler.core.common.LIRKind in project graal by oracle.

the class AMD64ArithmeticLIRGenerator method emitDIV.

private AMD64MulDivOp emitDIV(OperandSize size, Value a, Value b, LIRFrameState state) {
    LIRKind kind = LIRKind.combine(a, b);
    RegisterValue rax = moveToReg(AMD64.rax, a);
    RegisterValue rdx = AMD64.rdx.asValue(kind);
    getLIRGen().append(new AMD64ClearRegisterOp(size, rdx));
    return getLIRGen().append(new AMD64MulDivOp(AMD64MOp.DIV, size, kind, rdx, rax, getLIRGen().asAllocatable(b), state));
}
Also used : RegisterValue(jdk.vm.ci.code.RegisterValue) AMD64MulDivOp(org.graalvm.compiler.lir.amd64.AMD64MulDivOp) LIRKind(org.graalvm.compiler.core.common.LIRKind) AMD64ClearRegisterOp(org.graalvm.compiler.lir.amd64.AMD64ClearRegisterOp)

Aggregations

LIRKind (org.graalvm.compiler.core.common.LIRKind)60 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)20 Variable (org.graalvm.compiler.lir.Variable)19 Value (jdk.vm.ci.meta.Value)15 RegisterValue (jdk.vm.ci.code.RegisterValue)11 TargetDescription (jdk.vm.ci.code.TargetDescription)7 PlatformKind (jdk.vm.ci.meta.PlatformKind)7 LIRGeneratorTool (org.graalvm.compiler.lir.gen.LIRGeneratorTool)7 AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)6 JavaConstant (jdk.vm.ci.meta.JavaConstant)4 SPARCKind (jdk.vm.ci.sparc.SPARCKind)4 ComplexMatchValue (org.graalvm.compiler.core.match.ComplexMatchValue)4 AArch64AddressValue (org.graalvm.compiler.lir.aarch64.AArch64AddressValue)4 AMD64AddressValue (org.graalvm.compiler.lir.amd64.AMD64AddressValue)4 ComplexMatchResult (org.graalvm.compiler.core.match.ComplexMatchResult)3 MatchRule (org.graalvm.compiler.core.match.MatchRule)3 ConstantValue (org.graalvm.compiler.lir.ConstantValue)3 AMD64MulDivOp (org.graalvm.compiler.lir.amd64.AMD64MulDivOp)3 SubstrateRegisterConfig (com.oracle.svm.core.graal.meta.SubstrateRegisterConfig)2 Op3s (org.graalvm.compiler.asm.sparc.SPARCAssembler.Op3s)2