Search in sources :

Example 6 with OperandSize

use of org.graalvm.compiler.asm.amd64.AMD64Assembler.OperandSize in project graal by oracle.

the class AMD64NodeMatchRules method addMemory.

@MatchRule("(Add value Read=access)")
@MatchRule("(Add value FloatingRead=access)")
public ComplexMatchResult addMemory(ValueNode value, LIRLowerableAccess access) {
    OperandSize size = getMemorySize(access);
    if (size.isXmmType()) {
        TargetDescription target = getLIRGeneratorTool().target();
        boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
        if (isAvx) {
            return binaryRead(AVXOp.ADD, size, value, access);
        } else {
            return binaryRead(SSEOp.ADD, size, value, access);
        }
    } else {
        return binaryRead(ADD.getRMOpcode(size), size, value, access);
    }
}
Also used : TargetDescription(jdk.vm.ci.code.TargetDescription) OperandSize(org.graalvm.compiler.asm.amd64.AMD64Assembler.OperandSize) MatchRule(org.graalvm.compiler.core.match.MatchRule)

Example 7 with OperandSize

use of org.graalvm.compiler.asm.amd64.AMD64Assembler.OperandSize in project graal by oracle.

the class AMD64ArithmeticLIRGenerator method emitIMULConst.

private Variable emitIMULConst(OperandSize size, AllocatableValue a, ConstantValue b) {
    long value = b.getJavaConstant().asLong();
    if (NumUtil.isInt(value)) {
        int imm = (int) value;
        AMD64RMIOp op;
        if (NumUtil.isByte(imm)) {
            op = AMD64RMIOp.IMUL_SX;
        } else {
            op = AMD64RMIOp.IMUL;
        }
        Variable ret = getLIRGen().newVariable(LIRKind.combine(a, b));
        getLIRGen().append(new AMD64Binary.RMIOp(op, size, ret, a, imm));
        return ret;
    } else {
        return emitBinaryVar(LIRKind.combine(a, b), AMD64RMOp.IMUL, size, true, a, getLIRGen().asAllocatable(b));
    }
}
Also used : Variable(org.graalvm.compiler.lir.Variable) AMD64Binary(org.graalvm.compiler.lir.amd64.AMD64Binary) AMD64RMIOp(org.graalvm.compiler.asm.amd64.AMD64Assembler.AMD64RMIOp)

Example 8 with OperandSize

use of org.graalvm.compiler.asm.amd64.AMD64Assembler.OperandSize in project graal by oracle.

the class AMD64ArithmeticLIRGenerator method emitBinaryConst.

private Variable emitBinaryConst(LIRKind resultKind, AMD64BinaryArithmetic op, OperandSize size, boolean commutative, AllocatableValue a, ConstantValue b, boolean setFlags) {
    long value = b.getJavaConstant().asLong();
    if (NumUtil.isInt(value)) {
        Variable result = getLIRGen().newVariable(resultKind);
        int constant = (int) value;
        if (!setFlags) {
            AMD64MOp mop = getMOp(op, constant);
            if (mop != null) {
                getLIRGen().append(new AMD64Unary.MOp(mop, size, result, a));
                return result;
            }
        }
        getLIRGen().append(new AMD64Binary.ConstOp(op, size, result, a, constant));
        return result;
    } else {
        return emitBinaryVar(resultKind, op.getRMOpcode(size), size, commutative, a, getLIRGen().asAllocatable(b));
    }
}
Also used : AMD64Unary(org.graalvm.compiler.lir.amd64.AMD64Unary) Variable(org.graalvm.compiler.lir.Variable) AMD64Binary(org.graalvm.compiler.lir.amd64.AMD64Binary) AMD64MOp(org.graalvm.compiler.asm.amd64.AMD64Assembler.AMD64MOp)

Example 9 with OperandSize

use of org.graalvm.compiler.asm.amd64.AMD64Assembler.OperandSize in project graal by oracle.

the class AMD64LIRGenerator method emitCompareRegMemoryOp.

private boolean emitCompareRegMemoryOp(OperandSize size, AllocatableValue a, AMD64AddressValue b, LIRFrameState state) {
    AMD64RMOp op = CMP.getRMOpcode(size);
    append(new AMD64BinaryConsumer.MemoryRMOp(op, size, a, b, state));
    return false;
}
Also used : AMD64RMOp(org.graalvm.compiler.asm.amd64.AMD64Assembler.AMD64RMOp) AMD64BinaryConsumer(org.graalvm.compiler.lir.amd64.AMD64BinaryConsumer)

Example 10 with OperandSize

use of org.graalvm.compiler.asm.amd64.AMD64Assembler.OperandSize in project graal by oracle.

the class AMD64NodeMatchRules method mulMemory.

@MatchRule("(Mul value Read=access)")
@MatchRule("(Mul value FloatingRead=access)")
public ComplexMatchResult mulMemory(ValueNode value, LIRLowerableAccess access) {
    OperandSize size = getMemorySize(access);
    if (size.isXmmType()) {
        TargetDescription target = getLIRGeneratorTool().target();
        boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
        if (isAvx) {
            return binaryRead(AVXOp.MUL, size, value, access);
        } else {
            return binaryRead(SSEOp.MUL, size, value, access);
        }
    } else {
        return binaryRead(AMD64RMOp.IMUL, size, value, access);
    }
}
Also used : TargetDescription(jdk.vm.ci.code.TargetDescription) OperandSize(org.graalvm.compiler.asm.amd64.AMD64Assembler.OperandSize) MatchRule(org.graalvm.compiler.core.match.MatchRule)

Aggregations

OperandSize (org.graalvm.compiler.asm.amd64.AMD64Assembler.OperandSize)7 TargetDescription (jdk.vm.ci.code.TargetDescription)4 AMD64RMOp (org.graalvm.compiler.asm.amd64.AMD64Assembler.AMD64RMOp)4 MatchRule (org.graalvm.compiler.core.match.MatchRule)4 AMD64BinaryConsumer (org.graalvm.compiler.lir.amd64.AMD64BinaryConsumer)4 JavaConstant (jdk.vm.ci.meta.JavaConstant)3 AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)2 Constant (jdk.vm.ci.meta.Constant)2 VMConstant (jdk.vm.ci.meta.VMConstant)2 AMD64MIOp (org.graalvm.compiler.asm.amd64.AMD64Assembler.AMD64MIOp)2 LIRValueUtil.asJavaConstant (org.graalvm.compiler.lir.LIRValueUtil.asJavaConstant)2 LIRValueUtil.isJavaConstant (org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant)2 Variable (org.graalvm.compiler.lir.Variable)2 AMD64Binary (org.graalvm.compiler.lir.amd64.AMD64Binary)2 AMD64 (jdk.vm.ci.amd64.AMD64)1 CPUFeature (jdk.vm.ci.amd64.AMD64.CPUFeature)1 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)1 PlatformKind (jdk.vm.ci.meta.PlatformKind)1 Value (jdk.vm.ci.meta.Value)1 ValueKind (jdk.vm.ci.meta.ValueKind)1