Search in sources :

Example 1 with AMD64MOp

use of org.graalvm.compiler.asm.amd64.AMD64Assembler.AMD64MOp 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)

Aggregations

AMD64MOp (org.graalvm.compiler.asm.amd64.AMD64Assembler.AMD64MOp)1 Variable (org.graalvm.compiler.lir.Variable)1 AMD64Binary (org.graalvm.compiler.lir.amd64.AMD64Binary)1 AMD64Unary (org.graalvm.compiler.lir.amd64.AMD64Unary)1