src/jit/lsraxarch.cpp
bool LinearScan::isRMWRegOper(GenTree* tree)
{
    // TODO-XArch-CQ: Make this more accurate.
    // For now, We assume that most binary operators are of the RMW form.
    assert(tree->OperIsBinary());

    if (tree->OperIsCompare() || tree->OperIs(GT_CMP) || tree->OperIs(GT_BT))
    {
        return false;
    }

    switch (tree->OperGet())
    {
        // These Opers either support a three op form (i.e. GT_LEA), or do not read/write their first operand
        case GT_LEA:
        case GT_STOREIND:
        case GT_ARR_INDEX:
        case GT_STORE_BLK:
        case GT_STORE_OBJ:
        case GT_SWITCH_TABLE:
        case GT_LOCKADD:
#ifdef _TARGET_X86_
        case GT_LONG:
#endif
            return false;

        // x86/x64 does support a three op multiply when op2|op1 is a contained immediate
        case GT_MUL:
            return (!tree->gtGetOp2()->isContainedIntOrIImmed() && !tree->gtGetOp1()->isContainedIntOrIImmed());

#ifdef FEATURE_HW_INTRINSICS
        case GT_HWIntrinsic:
            return tree->isRMWHWIntrinsic(compiler);
#endif // FEATURE_HW_INTRINSICS

        default:
            return true;
    }
}
//------------------------------------------------------------------------------
// isRMWRegOper: Can this binary tree node be used in a Read-Modify-Write format
//
// Arguments:
//    tree      - a binary tree node
//
// Return Value:
//    Returns true if we can use the read-modify-write instruction form
//
// Notes:
//    This is used to determine whether to preference the source to the destination register.
//
Can this binary tree node be used in a Read-Modify-Write format
Arguments:
tree      - a binary tree node

Return Value:
Returns true if we can use the read-modify-write instruction form

This is used to determine whether to preference the source to the destination register.
Can this binary tree node be used in a Read - Modify - Write format Arguments : tree - a binary tree node Return Value : Returns true if we can use the read - modify - write instruction form This is used to determine whether to preference the source to the destination register .
bool LinearScan::isRMWRegOper(GenTree* tree)
{
    assert(tree->OperIsBinary());
    if (tree->OperIsCompare() || tree->OperIs(GT_CMP) || tree->OperIs(GT_BT))
    {
        return false;
    }
    switch (tree->OperGet())
    {
        case GT_LEA:
        case GT_STOREIND:
        case GT_ARR_INDEX:
        case GT_STORE_BLK:
        case GT_STORE_OBJ:
        case GT_SWITCH_TABLE:
        case GT_LOCKADD:
#ifdef _TARGET_X86_
        case GT_LONG:
#endif
            return false;
        case GT_MUL:
            return (!tree->gtGetOp2()->isContainedIntOrIImmed() && !tree->gtGetOp1()->isContainedIntOrIImmed());
#ifdef FEATURE_HW_INTRINSICS
        case GT_HWIntrinsic:
            return tree->isRMWHWIntrinsic(compiler);
#endif 
        default:
            return true;
    }
}
bool LinearScan :: isRMWRegOper ( GenTree * tree ) { assert ( tree -> OperIsBinary ( ) ) ; if ( tree -> OperIsCompare ( ) || tree -> OperIs ( GT_CMP ) || tree -> OperIs ( GT_BT ) ) { return false ; } switch ( tree -> OperGet ( ) ) { case GT_LEA : case GT_STOREIND : case GT_ARR_INDEX : case GT_STORE_BLK : case GT_STORE_OBJ : case GT_SWITCH_TABLE : case GT_LOCKADD : #ifdef _TARGET_X86_ case GT_LONG : #endif return false ; case GT_MUL : return ( ! tree -> gtGetOp2 ( ) -> isContainedIntOrIImmed ( ) && ! tree -> gtGetOp1 ( ) -> isContainedIntOrIImmed ( ) ) ; #ifdef FEATURE_HW_INTRINSICS case GT_HWIntrinsic : return tree -> isRMWHWIntrinsic ( compiler ) ; #endif default : return true ; } }
isRMWRegOper: Can this binary tree node be used in a Read-Modify-Write format
Arguments:
tree      - a binary tree node
isRMWRegOper : Can this binary tree node be used in a Read - Modify - Write format Arguments : tree - a binary tree node
// TODO-XArch-CQ: Make this more accurate. // For now, We assume that most binary operators are of the RMW form. // These Opers either support a three op form (i.e. GT_LEA), or do not read/write their first operand // x86/x64 does support a three op multiply when op2|op1 is a contained immediate // FEATURE_HW_INTRINSICS