use of org.graalvm.compiler.lir.amd64.AMD64ShiftOp in project graal by oracle.
the class AMD64ArithmeticLIRGenerator method emitShift.
private Variable emitShift(AMD64Shift op, OperandSize size, Value a, Value b) {
Variable result = getLIRGen().newVariable(LIRKind.combine(a, b).changeType(a.getPlatformKind()));
AllocatableValue input = getLIRGen().asAllocatable(a);
if (isJavaConstant(b)) {
JavaConstant c = asJavaConstant(b);
if (c.asLong() == 1) {
getLIRGen().append(new AMD64Unary.MOp(op.m1Op, size, result, input));
} else {
/*
* c is implicitly masked to 5 or 6 bits by the CPU, so casting it to (int) is
* always correct, even without the NumUtil.is32bit() test.
*/
getLIRGen().append(new AMD64Binary.ConstOp(op.miOp, size, result, input, (int) c.asLong()));
}
} else {
getLIRGen().emitMove(RCX_I, b);
getLIRGen().append(new AMD64ShiftOp(op.mcOp, size, result, input, RCX_I));
}
return result;
}
Aggregations