use of org.graalvm.compiler.lir.Variable in project graal by oracle.
the class SPARCArithmeticLIRGenerator method emitBitScanForward.
@Override
public Variable emitBitScanForward(Value operand) {
Variable result = getLIRGen().newVariable(LIRKind.combine(operand).changeType(SPARCKind.WORD));
getLIRGen().append(new SPARCBitManipulationOp(BSF, result, getLIRGen().asAllocatable(operand), getLIRGen()));
return result;
}
use of org.graalvm.compiler.lir.Variable in project graal by oracle.
the class SPARCArithmeticLIRGenerator method emitRem.
@Override
public Value emitRem(Value a, Value b, LIRFrameState state) {
Variable result = getLIRGen().newVariable(LIRKind.combine(a, b));
// Intermediate values
Variable q1;
Variable q2;
switch((SPARCKind) a.getPlatformKind()) {
case WORD:
// Sign extend a and b
Value as = emitSignExtend(a);
Value bs = emitSignExtend(b);
q1 = emitBinary(as.getValueKind(), Sdivx, as, bs, state);
q2 = emitBinary(as.getValueKind(), Mulx, q1, bs);
result = emitSub(as, q2, false);
break;
case XWORD:
q1 = emitBinary(result.getValueKind(), Sdivx, a, b, state);
q2 = emitBinary(result.getValueKind(), Mulx, q1, b);
result = emitSub(a, q2, false);
break;
case SINGLE:
ForeignCallLinkage fremCall = getLIRGen().getForeignCalls().lookupForeignCall(ARITHMETIC_FREM);
result = getLIRGen().emitForeignCall(fremCall, state, a, b);
break;
case DOUBLE:
ForeignCallLinkage dremCall = getLIRGen().getForeignCalls().lookupForeignCall(ARITHMETIC_DREM);
result = getLIRGen().emitForeignCall(dremCall, state, a, b);
break;
default:
throw GraalError.shouldNotReachHere("missing: " + a.getPlatformKind());
}
return result;
}
use of org.graalvm.compiler.lir.Variable in project graal by oracle.
the class SPARCArithmeticLIRGenerator method emitReinterpret.
@Override
public AllocatableValue emitReinterpret(LIRKind to, Value inputVal) {
SPARCKind fromKind = (SPARCKind) inputVal.getPlatformKind();
SPARCKind toKind = (SPARCKind) to.getPlatformKind();
AllocatableValue input = getLIRGen().asAllocatable(inputVal);
Variable result = getLIRGen().newVariable(to);
// These cases require a move between CPU and FPU registers:
if (fromKind.isFloat() != toKind.isFloat()) {
moveBetweenFpGp(result, input);
return result;
} else {
// Consequently, there is no need for a special zero-extension move.
return emitConvertMove(to, input);
}
}
use of org.graalvm.compiler.lir.Variable in project graal by oracle.
the class SPARCArithmeticLIRGenerator method emitNarrow.
@Override
public Value emitNarrow(Value inputVal, int bits) {
if (inputVal.getPlatformKind() == XWORD && bits <= 32) {
LIRKind resultKind = LIRKind.combine(inputVal).changeType(WORD);
Variable result = getLIRGen().newVariable(resultKind);
getLIRGen().emitMove(result, inputVal);
return result;
} else {
return inputVal;
}
}
use of org.graalvm.compiler.lir.Variable in project graal by oracle.
the class SPARCArithmeticLIRGenerator method emitURem.
@Override
public Value emitURem(Value a, Value b, LIRFrameState state) {
Variable result = getLIRGen().newVariable(LIRKind.combine(a, b));
Variable scratch1 = getLIRGen().newVariable(LIRKind.combine(a, b));
Variable scratch2 = getLIRGen().newVariable(LIRKind.combine(a, b));
Rem opcode;
switch(((SPARCKind) a.getPlatformKind())) {
case WORD:
opcode = Rem.IUREM;
break;
case XWORD:
opcode = Rem.LUREM;
break;
default:
throw GraalError.shouldNotReachHere();
}
getLIRGen().append(new RemOp(opcode, result, getLIRGen().asAllocatable(a), getLIRGen().asAllocatable(b), scratch1, scratch2, state));
return result;
}
Aggregations