}
// Generate code for ADD, SUB, MUL, DIV, UDIV, AND, OR and XOR
+// This method is expected to have called genConsumeOperands() before calling it.
void CodeGen::genCodeForBinary(GenTree* treeNode)
{
const genTreeOps oper = treeNode->OperGet();
oper == GT_AND ||
oper == GT_OR ||
oper == GT_XOR);
-
+
GenTreePtr op1 = treeNode->gtGetOp1();
GenTreePtr op2 = treeNode->gtGetOp2();
instruction ins = genGetInsForOper(treeNode->OperGet(), targetType);
// The arithmetic node must be sitting in a register (since it's not contained)
noway_assert(targetReg != REG_NA);
- genConsumeOperands(treeNode->AsOp());
-
regNumber r = emit->emitInsTernary(ins, emitTypeSize(treeNode), treeNode, op1, op2);
noway_assert(r == targetReg);
case GT_DIV:
case GT_UDIV:
+ genConsumeOperands(treeNode->AsOp());
+
if (varTypeIsFloating(targetType))
{
// Floating point divide never raises an exception
- genCodeForBinary(treeNode);
+ genCodeForBinary(treeNode);
}
else // an integer divide operation
{
emitAttr size = EA_ATTR(genTypeSize(genActualType(treeNode->TypeGet())));
// TODO-ARM64-CQ: Optimize a divide by power of 2 as we do for AMD64
-
+
if (divisorOp->IsZero())
{
// We unconditionally throw a divide by zero exception
emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
genJumpToThrowHlpBlk(jmpEqual, SCK_DIV_BY_ZERO);
}
- genCodeForBinary(treeNode);
+ genCodeForBinary(treeNode);
}
}
}
case GT_ADD:
case GT_SUB:
case GT_MUL:
+ genConsumeOperands(treeNode->AsOp());
genCodeForBinary(treeNode);
break;
//------------------------------------------------------------------------
// genCodeForBinary: Generate code for many binary arithmetic operators
+// This method is expected to have called genConsumeOperands() before calling it.
//
// Arguments:
// treeNode - The binary operation for which we are generating code.
GenTreePtr dst;
GenTreePtr src;
- genConsumeOperands(treeNode->AsOp());
-
// This is the case of reg1 = reg1 op reg2
// We're ready to emit the instruction without any moves
if (op1reg == targetReg)
#endif // !defined(_TARGET_64BIT_)
case GT_ADD:
case GT_SUB:
+ genConsumeOperands(treeNode->AsOp());
genCodeForBinary(treeNode);
break;
WorkingDir=CoreMangLib\cti\system\dividebyzeroexception\DivideByZeroExceptionCtor
Expected=0
MaxAllowedDurationSeconds=600
-Categories=Pri1;RT;EXPECTED_FAIL;REGRESS
+Categories=Pri1;RT;EXPECTED_PASS
HostStyle=0
[DivideByZeroExceptionCtor2.cmd_1358]
RelativePath=CoreMangLib\cti\system\dividebyzeroexception\DivideByZeroExceptionCtor2\DivideByZeroExceptionCtor2.cmd
WorkingDir=CoreMangLib\cti\system\type\TypeGetType1
Expected=0
MaxAllowedDurationSeconds=600
-Categories=Pri1;RT;EXPECTED_FAIL;REGRESS
+Categories=Pri1;RT;EXPECTED_PASS
HostStyle=0
[TypeGetType2.cmd_2699]
RelativePath=CoreMangLib\cti\system\type\TypeGetType2\TypeGetType2.cmd