Search in sources :

Example 11 with LIRKind

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

the class AMD64ArithmeticLIRGenerator method emitMul.

@Override
public Variable emitMul(Value a, Value b, boolean setFlags) {
    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 emitIMUL(DWORD, a, b);
        case QWORD:
            return emitIMUL(QWORD, a, b);
        case SINGLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.MUL, SS, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.MUL, SS, true, a, b);
            }
        case DOUBLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.MUL, SD, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.MUL, SD, 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 12 with LIRKind

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

the class AMD64ArithmeticLIRGenerator method emitXor.

@Override
public Variable emitXor(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, XOR, DWORD, true, a, b, false);
        case QWORD:
            return emitBinary(resultKind, XOR, QWORD, true, a, b, false);
        case SINGLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.XOR, PS, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.XOR, PS, true, a, b);
            }
        case DOUBLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.XOR, PD, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.XOR, 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 13 with LIRKind

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

the class AArch64AddressNode method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    LIRGeneratorTool tool = gen.getLIRGeneratorTool();
    AllocatableValue baseValue = base == null ? Value.ILLEGAL : tool.asAllocatable(gen.operand(base));
    AllocatableValue indexValue = index == null ? Value.ILLEGAL : tool.asAllocatable(gen.operand(index));
    AllocatableValue baseReference = LIRKind.derivedBaseFromValue(baseValue);
    AllocatableValue indexReference;
    if (index == null) {
        indexReference = null;
    } else if (addressingMode.equals(AddressingMode.IMMEDIATE_UNSCALED)) {
        indexReference = LIRKind.derivedBaseFromValue(indexValue);
    } else {
        if (LIRKind.isValue(indexValue.getValueKind())) {
            indexReference = null;
        } else {
            indexReference = Value.ILLEGAL;
        }
    }
    LIRKind kind = LIRKind.combineDerived(tool.getLIRKind(stamp(NodeView.DEFAULT)), baseReference, indexReference);
    gen.setResult(this, new AArch64AddressValue(kind, baseValue, indexValue, (int) displacement, scaleFactor, addressingMode));
}
Also used : AArch64AddressValue(org.graalvm.compiler.lir.aarch64.AArch64AddressValue) LIRKind(org.graalvm.compiler.core.common.LIRKind) LIRGeneratorTool(org.graalvm.compiler.lir.gen.LIRGeneratorTool) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 14 with LIRKind

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

the class AArch64ArithmeticLIRGenerator method emitNarrow.

@Override
public Value emitNarrow(Value inputVal, int bits) {
    if (inputVal.getPlatformKind() == AArch64Kind.QWORD && bits <= 32) {
        LIRKind resultKind = getResultLirKind(bits, inputVal);
        long mask = NumUtil.getNbitNumberLong(bits);
        Value maskValue = new ConstantValue(resultKind, JavaConstant.forLong(mask));
        return emitBinary(resultKind, AArch64ArithmeticOp.AND, true, inputVal, maskValue);
    } else {
        return inputVal;
    }
}
Also used : ConstantValue(org.graalvm.compiler.lir.ConstantValue) AArch64AddressValue(org.graalvm.compiler.lir.aarch64.AArch64AddressValue) RegisterValue(jdk.vm.ci.code.RegisterValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) LIRKind(org.graalvm.compiler.core.common.LIRKind) ConstantValue(org.graalvm.compiler.lir.ConstantValue)

Example 15 with LIRKind

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

the class AArch64ArithmeticLIRGenerator method emitSignExtend.

@Override
public Value emitSignExtend(Value inputVal, int fromBits, int toBits) {
    LIRKind resultKind = getResultLirKind(toBits, inputVal);
    assert fromBits <= toBits && toBits <= 64;
    if (fromBits == toBits) {
        return inputVal;
    } else if (isJavaConstant(inputVal)) {
        JavaConstant javaConstant = asJavaConstant(inputVal);
        long constant;
        if (javaConstant.isNull()) {
            constant = 0;
        } else {
            constant = javaConstant.asLong();
        }
        int shiftCount = QWORD.getSizeInBytes() * 8 - fromBits;
        return new ConstantValue(resultKind, JavaConstant.forLong((constant << shiftCount) >> shiftCount));
    }
    Variable result = getLIRGen().newVariable(resultKind);
    getLIRGen().append(new AArch64SignExtendOp(result, getLIRGen().asAllocatable(inputVal), fromBits, toBits));
    return result;
}
Also used : AArch64SignExtendOp(org.graalvm.compiler.lir.aarch64.AArch64SignExtendOp) Variable(org.graalvm.compiler.lir.Variable) LIRValueUtil.asJavaConstant(org.graalvm.compiler.lir.LIRValueUtil.asJavaConstant) LIRValueUtil.isJavaConstant(org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant) JavaConstant(jdk.vm.ci.meta.JavaConstant) LIRKind(org.graalvm.compiler.core.common.LIRKind) ConstantValue(org.graalvm.compiler.lir.ConstantValue)

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