use of org.graalvm.compiler.lir.Variable 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));
}
}
use of org.graalvm.compiler.lir.Variable in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitConvertMemoryOp.
protected Value emitConvertMemoryOp(PlatformKind kind, AMD64RMOp op, OperandSize size, AMD64AddressValue address, LIRFrameState state) {
Variable result = getLIRGen().newVariable(LIRKind.value(kind));
getLIRGen().append(new AMD64Unary.MemoryOp(op, size, result, address, state));
return result;
}
use of org.graalvm.compiler.lir.Variable in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitMathExp.
@Override
public Value emitMathExp(Value input) {
Variable result = getLIRGen().newVariable(LIRKind.combine(input));
AllocatableValue stackSlot = getLIRGen().getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(AMD64Kind.QWORD));
getLIRGen().append(new AMD64MathIntrinsicUnaryOp(getAMD64LIRGen(), EXP, result, getLIRGen().asAllocatable(input), stackSlot));
return result;
}
use of org.graalvm.compiler.lir.Variable in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitMathLog.
@Override
public Value emitMathLog(Value input, boolean base10) {
LIRGenerator gen = getLIRGen();
Variable result = maths.emitLog(gen, input, base10);
if (result == null) {
result = gen.newVariable(LIRKind.combine(input));
AllocatableValue stackSlot = gen.getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(AMD64Kind.QWORD));
gen.append(new AMD64MathIntrinsicUnaryOp(getAMD64LIRGen(), base10 ? LOG10 : LOG, result, gen.asAllocatable(input), stackSlot));
}
return result;
}
use of org.graalvm.compiler.lir.Variable 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));
}
}
Aggregations