Added enum CompareKind as input to genJumpKindForOper()
authorBrian Sullivan <briansul@microsoft.com>
Thu, 18 Feb 2016 23:33:54 +0000 (15:33 -0800)
committerBrian Sullivan <briansul@microsoft.com>
Thu, 18 Feb 2016 23:33:54 +0000 (15:33 -0800)
Record the result of genJumpKindForOper() in a local before generating the jump instruction
Added support for using Logical instructions with genJumpKindForOper()

src/jit/codegen.h
src/jit/codegenarm.cpp
src/jit/codegenarm64.cpp
src/jit/codegencommon.cpp
src/jit/codegenlegacy.cpp
src/jit/codegenxarch.cpp
src/jit/registerfp.cpp
tests/arm64/Tests.lst

index f198ff9..574cf1c 100644 (file)
@@ -90,8 +90,8 @@ private:
                                                         else
                                                             return REG_SPBASE; }
 
-    static emitJumpKind genJumpKindForOper(genTreeOps cmp, bool isUnsigned);
-
+    enum CompareKind { CK_SIGNED, CK_UNSIGNED, CK_LOGICAL };
+    static emitJumpKind genJumpKindForOper(genTreeOps cmp, CompareKind compareKind);
 
     // For a given compare oper tree, returns the conditions to use with jmp/set in 'jmpKind' array. 
     // The corresponding elements of jmpToTrueLabel indicate whether the target of the jump is to the
index 4db9068..8e07454 100644 (file)
@@ -1448,8 +1448,9 @@ CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
             // Get the "kind" and type of the comparison.  Note that whether it is an unsigned cmp
             // is governed by a flag NOT by the inherent type of the node
             // TODO-ARM-CQ: Check if we can use the currently set flags.
+            CompareKind compareKind = ((cmp->gtFlags & GTF_UNSIGNED) != 0) ? CK_UNSIGNED : CK_SIGNED;
 
-            emitJumpKind jmpKind   = genJumpKindForOper(cmp->gtOper, (cmp->gtFlags & GTF_UNSIGNED) != 0);
+            emitJumpKind jmpKind   = genJumpKindForOper(cmp->gtOper, compareKind);
             BasicBlock * jmpTarget = compiler->compCurBB->bbJumpDest;
 
             inst_JMP(jmpKind, jmpTarget);
@@ -1468,7 +1469,8 @@ CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
 
             BasicBlock* skipLabel = genCreateTempLabel();
 
-            inst_JMP(genJumpKindForOper(GT_EQ, false), skipLabel);
+            emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+            inst_JMP(jmpEqual, skipLabel);
             // emit the call to the EE-helper that stops for GC (or other reasons)
 
             genEmitHelperCall(CORINFO_HELP_STOP_FOR_GC, 0, EA_UNKNOWN);
@@ -1674,13 +1676,13 @@ CodeGen::genRangeCheck(GenTreePtr  oper)
         //  constant operand in the second position
         src1 = arrLen;
         src2 = arrIdx;
-        jmpKind = genJumpKindForOper(GT_LE, true);  // unsigned compare
+        jmpKind = genJumpKindForOper(GT_LE, CK_UNSIGNED); 
     }
     else
     {
         src1 = arrIdx;
         src2 = arrLen;
-        jmpKind = genJumpKindForOper(GT_GE, true);  // unsigned compare
+        jmpKind = genJumpKindForOper(GT_GE, CK_UNSIGNED); 
     }
 
     genConsumeIfReg(src1);
index 56ef403..16805a8 100644 (file)
@@ -1367,7 +1367,8 @@ void                CodeGen::genEmitGSCookieCheck(bool pushReg)
     getEmitter()->emitIns_R_R(INS_cmp, EA_PTRSIZE, regGSConst, regGSValue);
 
     BasicBlock  *gsCheckBlk = genCreateTempLabel();
-    inst_JMP(genJumpKindForOper(GT_EQ, false), gsCheckBlk);
+    emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+    inst_JMP(jmpEqual, gsCheckBlk);
     genEmitHelperCall(CORINFO_HELP_FAIL_FAST, 0, EA_UNKNOWN);
     genDefineTempLabel(gsCheckBlk);
 }
@@ -2427,7 +2428,8 @@ CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
             
             if (divisorOp->IsZero())
             {
-                genJumpToThrowHlpBlk(genJumpKindForOper(GT_EQ, false), SCK_DIV_BY_ZERO);
+                emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+                genJumpToThrowHlpBlk(jmpEqual, SCK_DIV_BY_ZERO);
                 // We don't need to generate the sdiv/udiv instruction
             }
             else
@@ -2458,11 +2460,14 @@ CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
                     {   
                         // Check if the divisor is zero throw a DivideByZeroException
                         emit->emitIns_R_I(INS_cmp, cmpSize, divisorReg, 0);
-                        genJumpToThrowHlpBlk(genJumpKindForOper(GT_EQ, false), SCK_DIV_BY_ZERO);
+                        emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+                        genJumpToThrowHlpBlk(jmpEqual, SCK_DIV_BY_ZERO);
 
                         // Check if the divisor is not -1 branch to 'sdivLabel'
                         emit->emitIns_R_I(INS_cmp, cmpSize, divisorReg, -1);
-                        inst_JMP(genJumpKindForOper(GT_NE, false), sdivLabel);
+
+                        emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_SIGNED);
+                        inst_JMP(jmpNotEqual, sdivLabel);
                         // If control flow continues past here the 'divisorReg' is known to be -1
                     }
                     
@@ -2475,7 +2480,8 @@ CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
                         // this will set the Z and V flags only when dividendReg is MinInt
                         //
                         emit->emitIns_R_R_R(INS_adds, cmpSize, REG_ZR, dividendReg, dividendReg);
-                        inst_JMP(genJumpKindForOper(GT_NE, false), sdivLabel);     // goto sdiv if the Z flag is clear
+                        emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_SIGNED);
+                        inst_JMP(jmpNotEqual, sdivLabel);                  // goto sdiv if the Z flag is clear
                         genJumpToThrowHlpBlk(EJ_vs, SCK_ARITH_EXCPN);   // if the V flags is set throw ArithmeticException
                     }
 
@@ -2492,7 +2498,8 @@ CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
                     if (!divisorOp->isContainedIntOrIImmed())
                     {                        
                         emit->emitIns_R_I(INS_cmp, cmpSize, divisorReg, 0);
-                        genJumpToThrowHlpBlk(genJumpKindForOper(GT_EQ, false), SCK_DIV_BY_ZERO);
+                        emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+                        genJumpToThrowHlpBlk(jmpEqual, SCK_DIV_BY_ZERO);
                     }
 
                     genCodeForBinary(treeNode);         // Generate the udiv instruction
@@ -2945,28 +2952,15 @@ CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
 
             // Get the "kind" and type of the comparison.  Note that whether it is an unsigned cmp
             // is governed by a flag NOT by the inherent type of the node
-            // TODO-XArch-CQ: Check if we can use the currently set flags.
             emitJumpKind jumpKind[2];
             bool branchToTrueLabel[2];
             genJumpKindsForTree(cmp, jumpKind, branchToTrueLabel);
 
-            BasicBlock* skipLabel = nullptr;
             if (jumpKind[0] != EJ_NONE)
             {
-                BasicBlock *jmpTarget;
-                if (branchToTrueLabel[0])
-                {
-                    jmpTarget = compiler->compCurBB->bbJumpDest;
-                }
-                else
-                {
-                    // This case arises only for ordered GT_EQ right now
-                    assert((cmp->gtOper == GT_EQ) && ((cmp->gtFlags & GTF_RELOP_NAN_UN) == 0));
-                    skipLabel = genCreateTempLabel();
-                    jmpTarget = skipLabel;
-                }
-
-                inst_JMP(jumpKind[0], jmpTarget);
+                // On Arm64 the branches will always branch to the true label
+                assert(branchToTrueLabel[0]);
+                inst_JMP(jumpKind[0], compiler->compCurBB->bbJumpDest);
             }
 
             if (jumpKind[1] != EJ_NONE)
@@ -2975,9 +2969,6 @@ CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
                 assert(branchToTrueLabel[1]);
                 inst_JMP(jumpKind[1], compiler->compCurBB->bbJumpDest);
             }
-
-            if (skipLabel != nullptr)
-                genDefineTempLabel(skipLabel);
         }
         break;
 
@@ -2992,7 +2983,8 @@ CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
 
             BasicBlock* skipLabel = genCreateTempLabel();
 
-            inst_JMP(genJumpKindForOper(GT_EQ, false), skipLabel);
+            emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+            inst_JMP(jmpEqual, skipLabel);
             // emit the call to the EE-helper that stops for GC (or other reasons)
 
             genEmitHelperCall(CORINFO_HELP_STOP_FOR_GC, 0, EA_UNKNOWN);
@@ -3595,7 +3587,8 @@ CodeGen::genLclHeap(GenTreePtr tree)
         getEmitter()->emitIns_S_R(INS_cmp, EA_PTRSIZE, REG_SPBASE, compiler->lvaReturnEspCheck, 0);
 
         BasicBlock  *   esp_check = genCreateTempLabel();
-        inst_JMP(genJumpKindForOper(GT_EQ, false), esp_check);
+        emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+        inst_JMP(jmpEqual, esp_check);
         getEmitter()->emitIns(INS_BREAKPOINT);
         genDefineTempLabel(esp_check);
     }
@@ -3636,7 +3629,8 @@ CodeGen::genLclHeap(GenTreePtr tree)
         genConsumeRegAndCopy(size, targetReg);
         endLabel = genCreateTempLabel();
         getEmitter()->emitIns_R_R(INS_TEST, easz, targetReg, targetReg);
-        inst_JMP(genJumpKindForOper(GT_EQ, false), endLabel);
+        emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+        inst_JMP(jmpEqual, endLabel);
 
         // Compute the size of the block to allocate and perform alignment.
         // If the method has no PSPSym and compInitMem=true, we can reuse targetReg as regcnt,
@@ -3775,7 +3769,8 @@ CodeGen::genLclHeap(GenTreePtr tree)
         // Therefore we need to subtract 16 from regcnt here.
         assert(genIsValidIntReg(regCnt));
         inst_RV_IV(INS_subs, regCnt, 16, emitActualTypeSize(type));
-        inst_JMP(genJumpKindForOper(GT_NE, false), loop);
+        emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_SIGNED);
+        inst_JMP(jmpNotEqual, loop);
     }
     else
     {
@@ -3835,7 +3830,8 @@ CodeGen::genLclHeap(GenTreePtr tree)
         getEmitter()->emitIns_R_R_I(INS_sub, EA_PTRSIZE, regTmp, REG_SPBASE, CORINFO_PAGE_SIZE);
 
         getEmitter()->emitIns_R_R(INS_cmp, EA_PTRSIZE, regTmp, regCnt);
-        inst_JMP(genJumpKindForOper(GT_LT, true), done);
+        emitJumpKind jmpLTU = genJumpKindForOper(GT_LT, CK_UNSIGNED);
+        inst_JMP(jmpLTU, done);
         
         // Update SP to be at the next page of stack that we will tickle
         getEmitter()->emitIns_R_R(INS_mov, EA_PTRSIZE, REG_SPBASE, regCnt);
@@ -4397,13 +4393,13 @@ CodeGen::genRangeCheck(GenTreePtr  oper)
         //  constant operand in the second position
         src1 = arrLen;
         src2 = arrIndex;
-        jmpKind = genJumpKindForOper(GT_LE, true);  // unsigned compare
+        jmpKind = genJumpKindForOper(GT_LE, CK_UNSIGNED);
     }
     else
     {
         src1 = arrIndex;
         src2 = arrLen;
-        jmpKind = genJumpKindForOper(GT_GE, true);  // unsigned compare
+        jmpKind = genJumpKindForOper(GT_GE, CK_UNSIGNED);
     }
 
     GenTreeIntConCommon* intConst = nullptr;
@@ -4511,7 +4507,8 @@ CodeGen::genCodeForArrIndex(GenTreeArrIndex* arrIndex)
     emit->emitIns_R_R_I(ins_Load(TYP_INT), EA_8BYTE, tmpReg, arrReg, offset);  // a 4 BYTE sign extending load
     emit->emitIns_R_R(INS_cmp, EA_4BYTE, tgtReg, tmpReg);
     
-    genJumpToThrowHlpBlk(genJumpKindForOper(GT_GE, true), SCK_RNGCHK_FAIL);
+    emitJumpKind jmpGEU = genJumpKindForOper(GT_GE, CK_UNSIGNED);
+    genJumpToThrowHlpBlk(jmpGEU, SCK_RNGCHK_FAIL);
     
     genProduceReg(arrIndex);
 }
@@ -5755,34 +5752,37 @@ void CodeGen::genLeaInstruction(GenTreeAddrMode *lea)
 
 /*****************************************************************************
  *  The condition to use for (the jmp/set for) the given type of compare operation are
- *  returned in 'jmpKind' array.  The corresponding elements of jmpToTrueLabel indicate
- *  the branch target when the condition being true.
- *
- *  jmpToTrueLabel[i]= true  implies branch to the target when the compare operation is true. 
- *  jmpToTrueLabel[i]= false implies branch to the target when the compare operation is false.
+ *  returned in 'jmpKind' array.  
+ *  If only one branch is necessary the value of jmpKind[1] will be EJ_NONE
+ *  On Arm64 both branches will always branch to the true label
  */
 // static
 void         CodeGen::genJumpKindsForTree(GenTreePtr    cmpTree, 
                                           emitJumpKind  jmpKind[2], 
                                           bool          jmpToTrueLabel[2])
 {
-    // Except for BEQ (ordered GT_EQ) both jumps are to the true label.
+    // On Arm64 both branches will always branch to the true label
     jmpToTrueLabel[0] = true;
     jmpToTrueLabel[1] = true;
 
     // For integer comparisons just use genJumpKindForOper
     if (!varTypeIsFloating(cmpTree->gtOp.gtOp1->gtEffectiveVal()))
     {
-        jmpKind[0] = genJumpKindForOper(cmpTree->gtOper, (cmpTree->gtFlags & GTF_UNSIGNED) != 0);
+        CompareKind compareKind = ((cmpTree->gtFlags & GTF_UNSIGNED) != 0) ? CK_UNSIGNED : CK_SIGNED;
+        jmpKind[0] = genJumpKindForOper(cmpTree->gtOper, compareKind);
         jmpKind[1] = EJ_NONE;
     }
-    else
+    else  // We have a Floating Point Compare operation
     {
         assert(cmpTree->OperIsCompare());
 
         // For details on this mapping, see the ARM64 Condition Code 
         // table at section C1.2.3 in the ARMV8 architecture manual
         //
+
+        // We must check the GTF_RELOP_NAN_UN to find out
+        // if we need to branch when we have a NaN operand.
+        //
         if ((cmpTree->gtFlags & GTF_RELOP_NAN_UN) != 0)
         {
             // Must branch if we have an NaN, unordered
@@ -5822,7 +5822,7 @@ void         CodeGen::genJumpKindsForTree(GenTreePtr    cmpTree,
                 unreached();
             }
         }
-        else
+        else  // ((cmpTree->gtFlags & GTF_RELOP_NAN_UN) == 0)
         {
             // Do not branch if we have an NaN, unordered
             switch (cmpTree->gtOper)
@@ -5965,7 +5965,8 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
         {
             // We only need to check for a negative value in sourceReg
             emit->emitIns_R_I(INS_cmp, cmpSize, sourceReg, 0);
-            genJumpToThrowHlpBlk(genJumpKindForOper(GT_LT, false), SCK_OVERFLOW);
+            emitJumpKind jmpLTS = genJumpKindForOper(GT_LT, CK_SIGNED);
+            genJumpToThrowHlpBlk(jmpLTS, SCK_OVERFLOW);
             if (dstType == TYP_ULONG)
             {
                 // cast to TYP_ULONG:
@@ -5982,7 +5983,8 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
 
             noway_assert(castInfo.typeMask != 0);
             emit->emitIns_R_I(INS_tst, cmpSize, sourceReg, castInfo.typeMask);
-            genJumpToThrowHlpBlk(genJumpKindForOper(GT_NE, false), SCK_OVERFLOW);
+            emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_SIGNED);
+            genJumpToThrowHlpBlk(jmpNotEqual, SCK_OVERFLOW);
         }
         else
         {
@@ -6005,7 +6007,8 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
                 emit->emitIns_R_R(INS_cmp, cmpSize, sourceReg, tmpReg);
             }
 
-            genJumpToThrowHlpBlk(genJumpKindForOper(GT_GT, false), SCK_OVERFLOW);
+            emitJumpKind jmpGTS = genJumpKindForOper(GT_GT, CK_SIGNED);
+            genJumpToThrowHlpBlk(jmpGTS, SCK_OVERFLOW);
 
             // Compare with the MIN
 
@@ -6020,7 +6023,8 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
                 emit->emitIns_R_R(INS_cmp, cmpSize, sourceReg, tmpReg);
             }
 
-            genJumpToThrowHlpBlk(genJumpKindForOper(GT_LT, false), SCK_OVERFLOW);
+            emitJumpKind jmpLTS = genJumpKindForOper(GT_LT, CK_SIGNED);
+            genJumpToThrowHlpBlk(jmpLTS, SCK_OVERFLOW);
         }
         ins = INS_mov;
     }
@@ -6339,7 +6343,8 @@ CodeGen::genCkfinite(GenTreePtr treeNode)
     emit->emitIns_R_I(INS_cmp, EA_4BYTE, intReg, expMask);
 
     // If exponent is all 1's, throw ArithmeticException
-    genJumpToThrowHlpBlk(genJumpKindForOper(GT_EQ, false), SCK_ARITH_EXCPN);
+    emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+    genJumpToThrowHlpBlk(jmpEqual, SCK_ARITH_EXCPN);
 
     // if it is a finite value copy it to targetReg
     if (treeNode->gtRegNum != fpReg)
index ef9285e..a2f262f 100644 (file)
@@ -2454,7 +2454,7 @@ FOUND_AM:
 */
 
 // static
-emitJumpKind         CodeGen::genJumpKindForOper(genTreeOps  cmp, bool  isUnsigned)
+emitJumpKind         CodeGen::genJumpKindForOper(genTreeOps  cmp, CompareKind compareKind)
 {
     const static
         BYTE            genJCCinsSgn[] =
@@ -2495,6 +2495,27 @@ emitJumpKind         CodeGen::genJumpKindForOper(genTreeOps  cmp, bool  isUnsign
         EJ_hi,      // GT_GT
 #endif
     };
+
+    const static
+        BYTE            genJCCinsLog[] =       /* logical operation */
+    {
+#if defined(_TARGET_XARCH_)
+        EJ_je,      // GT_EQ   (Z == 1)
+        EJ_jne,     // GT_NE   (Z == 0)
+        EJ_js,      // GT_LT   (S == 1)
+        EJ_NONE,    // GT_LE
+        EJ_jns,     // GT_GE   (S == 0)
+        EJ_NONE,    // GT_GT
+#elif defined(_TARGET_ARMARCH_)
+        EJ_eq,      // GT_EQ   (Z == 1)
+        EJ_ne,      // GT_NE   (Z == 0)
+        EJ_mi,      // GT_LT   (N == 1)
+        EJ_NONE,    // GT_LE
+        EJ_pl,      // GT_GE   (N == 0)
+        EJ_NONE,    // GT_GT
+#endif
+    };
+
 #if defined(_TARGET_XARCH_)
     assert(genJCCinsSgn[GT_EQ - GT_EQ] == EJ_je);
     assert(genJCCinsSgn[GT_NE - GT_EQ] == EJ_jne);
@@ -2509,6 +2530,11 @@ emitJumpKind         CodeGen::genJumpKindForOper(genTreeOps  cmp, bool  isUnsign
     assert(genJCCinsUns[GT_LE - GT_EQ] == EJ_jbe);
     assert(genJCCinsUns[GT_GE - GT_EQ] == EJ_jae);
     assert(genJCCinsUns[GT_GT - GT_EQ] == EJ_ja);
+
+    assert(genJCCinsLog[GT_EQ - GT_EQ] == EJ_je);
+    assert(genJCCinsLog[GT_NE - GT_EQ] == EJ_jne);
+    assert(genJCCinsLog[GT_LT - GT_EQ] == EJ_js);
+    assert(genJCCinsLog[GT_GE - GT_EQ] == EJ_jns);
 #elif defined(_TARGET_ARMARCH_)
     assert(genJCCinsSgn[GT_EQ - GT_EQ] == EJ_eq);
     assert(genJCCinsSgn[GT_NE - GT_EQ] == EJ_ne);
@@ -2523,19 +2549,32 @@ emitJumpKind         CodeGen::genJumpKindForOper(genTreeOps  cmp, bool  isUnsign
     assert(genJCCinsUns[GT_LE - GT_EQ] == EJ_ls);
     assert(genJCCinsUns[GT_GE - GT_EQ] == EJ_hs);
     assert(genJCCinsUns[GT_GT - GT_EQ] == EJ_hi);
+
+    assert(genJCCinsLog[GT_EQ - GT_EQ] == EJ_eq);
+    assert(genJCCinsLog[GT_NE - GT_EQ] == EJ_ne);
+    assert(genJCCinsLog[GT_LT - GT_EQ] == EJ_mi);
+    assert(genJCCinsLog[GT_GE - GT_EQ] == EJ_pl);
 #else
     assert(!"unknown arch");
 #endif
     assert(GenTree::OperIsCompare(cmp));
 
-    if (isUnsigned)
+    emitJumpKind result = EJ_COUNT;
+
+    if (compareKind == CK_UNSIGNED)
     {
-        return (emitJumpKind)genJCCinsUns[cmp - GT_EQ];
+        result = (emitJumpKind)genJCCinsUns[cmp - GT_EQ];
     }
-    else
+    else if (compareKind == CK_SIGNED)
     {
-        return (emitJumpKind)genJCCinsSgn[cmp - GT_EQ];
+        result = (emitJumpKind)genJCCinsSgn[cmp - GT_EQ];
     }
+    else if (compareKind == CK_LOGICAL)
+    {
+        result = (emitJumpKind)genJCCinsLog[cmp - GT_EQ];
+    }
+    assert(result != EJ_COUNT);
+    return result;
 }
 
 /*****************************************************************************
@@ -10920,8 +10959,8 @@ void                CodeGen::genPInvokeCallEpilog(LclVarDsc *  frameListRoot,
     clab_nostop = genCreateTempLabel();
 
     /* Generate the conditional jump */
-
-    inst_JMP(genJumpKindForOper(GT_EQ, false), clab_nostop);
+    emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+    inst_JMP(jmpEqual, clab_nostop);
 
 #ifdef _TARGET_ARM_
     // The helper preserves the return value on ARM
index 69c924c..8491292 100644 (file)
@@ -2007,7 +2007,8 @@ void                CodeGen::genRangeCheck(GenTreePtr  oper)
         /* Generate "jae <fail_label>" */
 
         noway_assert(oper->gtOper == GT_ARR_BOUNDS_CHECK);
-        genJumpToThrowHlpBlk(genJumpKindForOper(GT_GE, true), SCK_RNGCHK_FAIL, bndsChk->gtIndRngFailBB);
+        emitJumpKind jmpGEU = genJumpKindForOper(GT_GE, CK_UNSIGNED);
+        genJumpToThrowHlpBlk(jmpGEU, SCK_RNGCHK_FAIL, bndsChk->gtIndRngFailBB);
     }
     else
     {
@@ -2034,7 +2035,8 @@ void                CodeGen::genRangeCheck(GenTreePtr  oper)
             /* Generate "cmp [arrRef+LenOffs], ixv" */
             inst_AT_IV(INS_cmp, EA_4BYTE, arrRef, ixv, lenOffset);
             // Generate "jbe <fail_label>"
-            genJumpToThrowHlpBlk(genJumpKindForOper(GT_LE, true), SCK_RNGCHK_FAIL, bndsChk->gtIndRngFailBB);
+            emitJumpKind jmpLEU = genJumpKindForOper(GT_LE, CK_UNSIGNED);
+            genJumpToThrowHlpBlk(jmpLEU, SCK_RNGCHK_FAIL, bndsChk->gtIndRngFailBB);
         }
         else if (arrLen->IsCnsIntOrI())
         {
@@ -2054,7 +2056,8 @@ void                CodeGen::genRangeCheck(GenTreePtr  oper)
              /* Generate "cmp arrLen, ixv" */
             inst_RV_IV(INS_cmp, arrLen->gtRegNum, ixv, EA_4BYTE);
             // Generate "jbe <fail_label>"
-            genJumpToThrowHlpBlk(genJumpKindForOper(GT_LE, true), SCK_RNGCHK_FAIL, bndsChk->gtIndRngFailBB);
+            emitJumpKind jmpLEU = genJumpKindForOper(GT_LE, CK_UNSIGNED);
+            genJumpToThrowHlpBlk(jmpLEU, SCK_RNGCHK_FAIL, bndsChk->gtIndRngFailBB);
         }
     }
 
@@ -2272,8 +2275,8 @@ regMaskTP           CodeGen::genMakeAddrArrElem(GenTreePtr      arrElem,
                         arrReg,
                         compiler->eeGetArrayDataOffset(elemType) + sizeof(int) * dim);
 #endif
-
-        genJumpToThrowHlpBlk(genJumpKindForOper(GT_GE, true), SCK_RNGCHK_FAIL);
+        emitJumpKind jmpGEU = genJumpKindForOper(GT_GE, CK_UNSIGNED);
+        genJumpToThrowHlpBlk(jmpGEU, SCK_RNGCHK_FAIL);
 
         if (dim == 0)
         {
@@ -3061,7 +3064,8 @@ void                CodeGen::genEmitGSCookieCheck(bool pushReg)
     }
 
     gsCheckBlk = genCreateTempLabel();
-    inst_JMP(genJumpKindForOper(GT_EQ, false), gsCheckBlk);
+    emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+    inst_JMP(jmpEqual, gsCheckBlk);
     genEmitHelperCall(CORINFO_HELP_FAIL_FAST, 0, EA_UNKNOWN);
     genDefineTempLabel(gsCheckBlk);
 
@@ -3817,14 +3821,8 @@ void                CodeGen::genCondJumpLng(GenTreePtr     cond,
                 jumpTrue = genTransitionBlockStackFP(&compCurFPState, compiler->compCurBB, jumpTrue);
             }
 #endif
-            if (cmp == GT_EQ)
-            {
-                inst_JMP(genJumpKindForOper(GT_EQ, false), jumpTrue);
-            }
-            else
-            {
-                inst_JMP(genJumpKindForOper(GT_NE, false), jumpTrue);
-            }
+            emitJumpKind jmpKind = genJumpKindForOper(cmp, CK_SIGNED);
+            inst_JMP(jmpKind, jumpTrue);
         }
         else // specialCaseCmp == false
         {
@@ -4069,9 +4067,8 @@ emitJumpKind            CodeGen::genCondSetFlags(GenTreePtr cond)
     regMaskTP     regNeed;
     regMaskTP     addrReg1 = RBM_NONE;
     regMaskTP     addrReg2 = RBM_NONE;
-    emitJumpKind  jumpKind = EJ_jmp; // We borrow EJ_jmp for the cases where we don't know yet 
-                                     // which conditional instruction to use. 
-    
+    emitJumpKind  jumpKind = EJ_COUNT;   // Initialize with an invalid value
+
     bool  byteCmp;
     bool  shortCmp;
                   
@@ -4247,16 +4244,16 @@ emitJumpKind            CodeGen::genCondSetFlags(GenTreePtr cond)
 #ifdef _TARGET_ARM_
                 case GT_EQ: jumpKind = EJ_eq;      break;
                 case GT_NE: jumpKind = EJ_ne;      break;
-                case GT_LT: break;
+                case GT_LT: jumpKind = EJ_NONE;    break;
                 case GT_LE: jumpKind = EJ_eq;      break;
-                case GT_GE: break;
+                case GT_GE: jumpKind = EJ_NONE;    break;
                 case GT_GT: jumpKind = EJ_ne;      break;
 #elif defined(_TARGET_X86_)
                 case GT_EQ: jumpKind = EJ_je;      break;
                 case GT_NE: jumpKind = EJ_jne;     break;
-                case GT_LT: break;
+                case GT_LT: jumpKind = EJ_NONE;    break;
                 case GT_LE: jumpKind = EJ_je;      break;
-                case GT_GE: break;
+                case GT_GE: jumpKind = EJ_NONE;    break;
                 case GT_GT: jumpKind = EJ_jne;     break;
 #endif // TARGET
                 default:
@@ -4284,29 +4281,32 @@ emitJumpKind            CodeGen::genCondSetFlags(GenTreePtr cond)
                     -----------------------------------------------------
                     |     > 0    |      N/A          |       N/A        |
                     -----------------------------------------------------
-                */   
+                */
+
                 switch (cmp)
                 {
 #ifdef _TARGET_ARM_
                 case GT_EQ: jumpKind = EJ_eq;      break;
                 case GT_NE: jumpKind = EJ_ne;      break;
                 case GT_LT: jumpKind = EJ_mi;      break;
-                case GT_LE: break;
+                case GT_LE: jumpKind = EJ_NONE;    break;
                 case GT_GE: jumpKind = EJ_pl;      break;
-                case GT_GT: break;
+                case GT_GT: jumpKind = EJ_NONE;    break;
 #elif defined(_TARGET_X86_)
                 case GT_EQ: jumpKind = EJ_je;      break;
                 case GT_NE: jumpKind = EJ_jne;     break;
                 case GT_LT: jumpKind = EJ_js;      break;
-                case GT_LE: break;
+                case GT_LE: jumpKind = EJ_NONE;    break;
                 case GT_GE: jumpKind = EJ_jns;     break;
-                case GT_GT: break;
+                case GT_GT: jumpKind = EJ_NONE;    break;
 #endif // TARGET
-                    default:
-                        noway_assert(!"Unexpected comparison OpCode");
-                        break;
+                default:
+                    noway_assert(!"Unexpected comparison OpCode");
+                    break;
                 }
+                assert(jumpKind == genJumpKindForOper(cmp, CK_LOGICAL));
             }
+            assert(jumpKind != EJ_COUNT);   // Ensure that it was assigned a valid value above
 
             /* Is the value a simple local variable? */
 
@@ -4316,7 +4316,7 @@ emitJumpKind            CodeGen::genCondSetFlags(GenTreePtr cond)
 
                 if (genFlagsAreVar(op1->gtLclVarCommon.gtLclNum))
                 {
-                    if (jumpKind != EJ_jmp)
+                    if (jumpKind != EJ_NONE)
                     {
                         addrReg1 = RBM_NONE;
                         genUpdateLife(op1);
@@ -4342,7 +4342,7 @@ emitJumpKind            CodeGen::genCondSetFlags(GenTreePtr cond)
 
             if  (flags)
             {
-                if (jumpKind != EJ_jmp)
+                if (jumpKind != EJ_NONE)
                 {
                     goto DONE_FLAGS;
                 }
@@ -4727,7 +4727,7 @@ DONE_OP1:
 
 DONE:
     
-    jumpKind = genJumpKindForOper(cmp, unsignedCmp);
+    jumpKind = genJumpKindForOper(cmp, unsignedCmp ? CK_UNSIGNED : CK_SIGNED);
 
 DONE_FLAGS: // We have determined what jumpKind to use
 
@@ -4740,7 +4740,7 @@ DONE_FLAGS: // We have determined what jumpKind to use
     genDoneAddressable(op1, addrReg1, RegSet::KEEP_REG);
     genDoneAddressable(op2, addrReg2, RegSet::KEEP_REG);
 
-    noway_assert(jumpKind != EJ_jmp);
+    noway_assert(jumpKind != EJ_COUNT);   // Ensure that it was assigned a valid value
 
     return jumpKind;
 }
@@ -6591,7 +6591,8 @@ void                CodeGen::genCodeForMult64(GenTreePtr tree,
         getEmitter()->emitIns_R_I(INS_cmp, EA_4BYTE, regTmpHi, 0);
 
         // Jump to the block which will throw the expection
-        genJumpToThrowHlpBlk(genJumpKindForOper(GT_NE, false), SCK_OVERFLOW);
+        emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_SIGNED);
+        genJumpToThrowHlpBlk(jmpNotEqual, SCK_OVERFLOW);
 
         // Unlock regLo [and regHi] after generating code for the gtOverflow() case
         //
@@ -7949,12 +7950,10 @@ void                CodeGen::genCodeForSignedMod(GenTreePtr tree,
 
         regTracker.rsTrackRegTrash(reg);
 
-        /* Generate "jns skip" */
-#ifdef _TARGET_ARM_
-        inst_JMP(EJ_pl, skip);
-#else
-        inst_JMP(EJ_jns, skip);
-#endif
+        /* Check and branch for a postive value */
+        emitJumpKind jmpGEL = genJumpKindForOper(GT_GE, CK_LOGICAL);
+        inst_JMP(jmpGEL, skip);
+
         /* Generate the rest of the sequence and we're done */
 
         genIncRegBy(reg, -1, NULL, treeType);
@@ -8079,12 +8078,11 @@ void                CodeGen::genCodeForSignedDiv(GenTreePtr tree,
 
             inst_RV_SH(INS_SHIFT_RIGHT_ARITHM, emitTypeSize(treeType), reg, genLog2(ival), INS_FLAGS_SET);
 
-            /* Generate "jns onNegDivisee" followed by "adc reg, 0" */
-#ifdef _TARGET_ARM_
-            inst_JMP(EJ_pl, onNegDivisee);
-#else
-            inst_JMP(EJ_jns, onNegDivisee);
-#endif
+            // Check and branch for a postive value, skipping the INS_ADDC instruction
+            emitJumpKind jmpGEL = genJumpKindForOper(GT_GE, CK_LOGICAL);
+            inst_JMP(jmpGEL, onNegDivisee);
+
+            // Add the carry flag to 'reg'
             inst_RV_IV(INS_ADDC, reg, 0, emitActualTypeSize(treeType));
 
             /* Define the 'onNegDivisee' label and we're done */
@@ -8109,12 +8107,13 @@ void                CodeGen::genCodeForSignedDiv(GenTreePtr tree,
             onNegDivisee:
             sar     reg, log2(ival)
             */
+
             instGen_Compare_Reg_To_Zero(emitTypeSize(treeType), reg);
-#ifdef _TARGET_ARM_
-            inst_JMP(EJ_pl, onNegDivisee);
-#else
-            inst_JMP(EJ_jns, onNegDivisee);
-#endif
+
+            // Check and branch for a postive value, skipping the INS_add instruction
+            emitJumpKind jmpGEL = genJumpKindForOper(GT_GE, CK_LOGICAL);
+            inst_JMP(jmpGEL, onNegDivisee);
+
             inst_RV_IV(INS_add, reg, (int)ival-1, emitActualTypeSize(treeType));
 
             /* Define the 'onNegDivisee' label and we're done */
@@ -9239,7 +9238,8 @@ void                CodeGen::genCodeForTreeSmpOp(GenTreePtr tree,
                 getEmitter()->emitIns_S_R(INS_cmp, EA_PTRSIZE, REG_SPBASE, compiler->lvaReturnEspCheck, 0);
 
                 BasicBlock  *   esp_check = genCreateTempLabel();
-                inst_JMP(genJumpKindForOper(GT_EQ, false), esp_check);
+                emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+                inst_JMP(jmpEqual, esp_check);
                 getEmitter()->emitIns(INS_BREAKPOINT);
                 genDefineTempLabel(esp_check);
             }
@@ -10232,7 +10232,8 @@ void                CodeGen::genCodeForTreeSmpOp(GenTreePtr tree,
                         getEmitter()->emitIns_R_I(INS_add, dstType, regDst, 2 * TARGET_POINTER_SIZE);
                         regTracker.rsTrackRegTrash(regDst);
                         getEmitter()->emitIns_R_I(INS_sub, EA_4BYTE, regLoopIndex, 1, INS_FLAGS_SET);
-                        inst_JMP(genJumpKindForOper(GT_GT, false), loopTopBlock);
+                        emitJumpKind jmpGTS = genJumpKindForOper(GT_GT, CK_SIGNED);
+                        inst_JMP(jmpGTS, loopTopBlock);
 
                         regTracker.rsTrackRegIntCns(regLoopIndex, 0);
 
@@ -10840,6 +10841,9 @@ REG_OK:
             regNumber hiReg = (op1->gtFlags & GTF_REG_VAL) ? genRegPairHi(op1->gtRegPair)
                                                            : REG_NA;
 
+            emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_SIGNED);
+            emitJumpKind jmpLTS = genJumpKindForOper(GT_LT, CK_SIGNED);
+
             switch (dstType)
             {
             case TYP_INT:   // conv.ovf.i8.i4
@@ -10859,7 +10863,7 @@ REG_OK:
                 instGen_Compare_Reg_To_Zero(EA_4BYTE, reg);
                 if (tree->gtFlags & GTF_UNSIGNED)       // conv.ovf.u8.i4       (i4 > 0 and upper bits 0)
                 {
-                    genJumpToThrowHlpBlk(genJumpKindForOper(GT_LT, false), SCK_OVERFLOW);
+                    genJumpToThrowHlpBlk(jmpLTS, SCK_OVERFLOW);
                     goto UPPER_BITS_ZERO;
                 }
 
@@ -10888,7 +10892,7 @@ REG_OK:
                 done = genCreateTempLabel();
 
                 // Is the loDWord positive or negative
-                inst_JMP(genJumpKindForOper(GT_LT, false), neg);
+                inst_JMP(jmpLTS, neg);
 
                 // If loDWord is positive, hiDWord should be 0 (sign extended loDWord)
 
@@ -10901,7 +10905,7 @@ REG_OK:
                     inst_TT_IV(INS_cmp, op1, 0x00000000, 4);
                 }
 
-                genJumpToThrowHlpBlk(genJumpKindForOper(GT_NE, false), SCK_OVERFLOW);
+                genJumpToThrowHlpBlk(jmpNotEqual, SCK_OVERFLOW);
                 inst_JMP(EJ_jmp, done);
 
                 // If loDWord is negative, hiDWord should be -1 (sign extended loDWord)
@@ -10916,7 +10920,7 @@ REG_OK:
                 {
                     inst_TT_IV(INS_cmp, op1, 0xFFFFFFFFL, 4);
                 }
-                genJumpToThrowHlpBlk(genJumpKindForOper(GT_NE, false), SCK_OVERFLOW);
+                genJumpToThrowHlpBlk(jmpNotEqual, SCK_OVERFLOW);
 
                 // Done
 
@@ -10936,8 +10940,8 @@ UPPER_BITS_ZERO:
                 {
                     inst_TT_IV(INS_cmp, op1, 0, 4);
                 }
-
-                genJumpToThrowHlpBlk(genJumpKindForOper(GT_NE, false), SCK_OVERFLOW);
+               
+                genJumpToThrowHlpBlk(jmpNotEqual, SCK_OVERFLOW);
                 break;
 
             default:
@@ -11125,7 +11129,8 @@ UPPER_BITS_ZERO:
         if (unsv)
         {
             inst_RV_IV(INS_TEST, reg, typeMask, emitActualTypeSize(baseType));
-            genJumpToThrowHlpBlk(genJumpKindForOper(GT_NE, false), SCK_OVERFLOW);
+            emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_SIGNED);
+            genJumpToThrowHlpBlk(jmpNotEqual, SCK_OVERFLOW);
         }
         else
         {
@@ -11137,12 +11142,14 @@ UPPER_BITS_ZERO:
             noway_assert(typeMin != DUMMY_INIT(~0) && typeMax != DUMMY_INIT(0));
 
             inst_RV_IV(INS_cmp, reg, typeMax, emitActualTypeSize(baseType));
-            genJumpToThrowHlpBlk(genJumpKindForOper(GT_GT, false), SCK_OVERFLOW);
+            emitJumpKind jmpGTS = genJumpKindForOper(GT_GT, CK_SIGNED);
+            genJumpToThrowHlpBlk(jmpGTS, SCK_OVERFLOW);
 
             // Compare with the MIN
 
             inst_RV_IV(INS_cmp, reg, typeMin, emitActualTypeSize(baseType));
-            genJumpToThrowHlpBlk(genJumpKindForOper(GT_LT, false), SCK_OVERFLOW);
+            emitJumpKind jmpLTS = genJumpKindForOper(GT_LT, CK_SIGNED);
+            genJumpToThrowHlpBlk(jmpLTS, SCK_OVERFLOW);
         }
 
         genCodeForTree_DONE(tree, reg);
@@ -13850,7 +13857,8 @@ REG_VAR_LONG:
                     {
                         noway_assert((op2->gtFlags & GTF_UNSIGNED) == 0); // conv.ovf.u8.un should be bashed to conv.u8.un
                         instGen_Compare_Reg_To_Zero(EA_4BYTE, regHi);     // set flags
-                        genJumpToThrowHlpBlk(genJumpKindForOper(GT_LT, false), SCK_OVERFLOW);
+                        emitJumpKind jmpLTS = genJumpKindForOper(GT_LT, CK_SIGNED);
+                        genJumpToThrowHlpBlk(jmpLTS, SCK_OVERFLOW);
                     }
 
                     /* Move the value into the target */
@@ -15260,7 +15268,8 @@ USE_SAR_FOR_CAST:
                     {
                         regNumber hiReg = genRegPairHi(regPair);
                         instGen_Compare_Reg_To_Zero(EA_4BYTE, hiReg); // set flags
-                        genJumpToThrowHlpBlk(genJumpKindForOper(GT_LT, false), SCK_OVERFLOW);
+                        emitJumpKind jmpLTS = genJumpKindForOper(GT_LT, CK_SIGNED);
+                        genJumpToThrowHlpBlk(jmpLTS, SCK_OVERFLOW);
                     }
                 }
                 goto DONE;
@@ -15311,26 +15320,29 @@ USE_SAR_FOR_CAST:
 #endif
             case TYP_LONG:
             case TYP_ULONG:
+               {
+                    noway_assert(tree->gtOverflow()); // conv.ovf.u8 or conv.ovf.i8
 
-                noway_assert(tree->gtOverflow()); // conv.ovf.u8 or conv.ovf.i8
+                    genComputeRegPair(op1, REG_PAIR_NONE, RBM_ALLINT & ~needReg, RegSet::FREE_REG);
+                    regPair = op1->gtRegPair;
 
-                genComputeRegPair(op1, REG_PAIR_NONE, RBM_ALLINT & ~needReg, RegSet::FREE_REG);
-                regPair = op1->gtRegPair;
+                    // Do we need to set the sign-flag, or can be check if it
+                    // set, and not do this "test" if so.
 
-                // Do we need to set the sign-flag, or can be check if it
-                // set, and not do this "test" if so.
+                    if (op1->gtFlags & GTF_REG_VAL)
+                    {
+                        regNumber hiReg = genRegPairHi(op1->gtRegPair);
+                        noway_assert(hiReg != REG_STK);
+                        instGen_Compare_Reg_To_Zero(EA_4BYTE, hiReg); // set flags
+                    }
+                    else
+                    {
+                        inst_TT_IV(INS_cmp, op1, 0, sizeof(int));
+                    }
 
-                if (op1->gtFlags & GTF_REG_VAL)
-                {
-                    regNumber hiReg = genRegPairHi(op1->gtRegPair);
-                    noway_assert(hiReg != REG_STK);
-                    instGen_Compare_Reg_To_Zero(EA_4BYTE, hiReg); // set flags
-                }
-                else
-                {
-                    inst_TT_IV(INS_cmp, op1, 0, sizeof(int));
+                    emitJumpKind jmpLTS = genJumpKindForOper(GT_LT, CK_SIGNED);
+                    genJumpToThrowHlpBlk(jmpLTS, SCK_OVERFLOW);
                 }
-                genJumpToThrowHlpBlk(genJumpKindForOper(GT_LT, false), SCK_OVERFLOW);              
                 goto DONE;
 
             default:
@@ -15853,13 +15865,14 @@ void            CodeGen::genTableSwitch(regNumber      reg,
     if (jumpCnt < minSwitchTabJumpCnt)
     {
         /* Does the first case label follow? */
-        emitJumpKind jmpIfEqual = genJumpKindForOper(GT_EQ, false);
+        emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
 
         if  (fFirstCaseFollows)
         {
             /* Check for the default case */
             inst_RV_IV(INS_cmp, reg, jumpCnt - 1, EA_4BYTE);
-            inst_JMP(genJumpKindForOper(GT_GE, true), jumpTab[jumpCnt - 1]);
+            emitJumpKind jmpGEU = genJumpKindForOper(GT_GE, CK_UNSIGNED);
+            inst_JMP(jmpGEU, jumpTab[jumpCnt - 1]);
 
             /* No need to jump to the first case */
 
@@ -15882,7 +15895,7 @@ void            CodeGen::genTableSwitch(regNumber      reg,
             while (jumpCnt > 0)
             {
                 inst_RV_IV(INS_sub, reg, 1, EA_4BYTE, INS_FLAGS_SET);
-                inst_JMP(jmpIfEqual, *jumpTab++);
+                inst_JMP(jmpEqual, *jumpTab++);
                 jumpCnt--;
             }
         }
@@ -15890,7 +15903,7 @@ void            CodeGen::genTableSwitch(regNumber      reg,
         {
             /* Check for case0 first */
             instGen_Compare_Reg_To_Zero(EA_4BYTE, reg); // set flags
-            inst_JMP(jmpIfEqual, *jumpTab);
+            inst_JMP(jmpEqual, *jumpTab);
 
             /* No need to jump to the first case or the default */
 
@@ -15913,7 +15926,7 @@ void            CodeGen::genTableSwitch(regNumber      reg,
             while (jumpCnt > 0)
             {
                 inst_RV_IV(INS_sub, reg, 1, EA_4BYTE, INS_FLAGS_SET);
-                inst_JMP(jmpIfEqual, *jumpTab++);
+                inst_JMP(jmpEqual, *jumpTab++);
                 jumpCnt--;
             }
 
@@ -15934,7 +15947,8 @@ void            CodeGen::genTableSwitch(regNumber      reg,
     /* First take care of the default case */
 
     inst_RV_IV(INS_cmp, reg, jumpCnt - 1, EA_4BYTE);
-    inst_JMP(genJumpKindForOper(GT_GE, true), jumpTab[jumpCnt - 1]);
+    emitJumpKind jmpGEU = genJumpKindForOper(GT_GE, CK_UNSIGNED);
+    inst_JMP(jmpGEU, jumpTab[jumpCnt - 1]);
 
     /* Generate the jump table contents */
 
@@ -20562,7 +20576,8 @@ regMaskTP           CodeGen::genCodeForCall(GenTreePtr  call,
 
             esp_check = genCreateTempLabel();
 
-            inst_JMP(genJumpKindForOper(GT_EQ, false), esp_check);
+            emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+            inst_JMP(jmpEqual, esp_check);
 
             getEmitter()->emitIns(INS_BREAKPOINT);
 
@@ -20735,7 +20750,8 @@ regMaskTP           CodeGen::genCodeForCall(GenTreePtr  call,
             getEmitter()->emitIns_S_R(INS_cmp, EA_4BYTE, REG_SPBASE, compiler->lvaCallEspCheck, 0);
 
         BasicBlock  *   esp_check = genCreateTempLabel();
-        inst_JMP(genJumpKindForOper(GT_EQ, false), esp_check);
+        emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+        inst_JMP(jmpEqual, esp_check);
         getEmitter()->emitIns(INS_BREAKPOINT);
         genDefineTempLabel(esp_check);
     }
@@ -21000,7 +21016,8 @@ regNumber           CodeGen::genLclHeap(GenTreePtr size)
         getEmitter()->emitIns_S_R(INS_cmp, EA_PTRSIZE, REG_SPBASE, compiler->lvaReturnEspCheck, 0);
 
         BasicBlock  *   esp_check = genCreateTempLabel();
-        inst_JMP(genJumpKindForOper(GT_EQ, false), esp_check);
+        emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+        inst_JMP(jmpEqual, esp_check);
         getEmitter()->emitIns(INS_BREAKPOINT);
         genDefineTempLabel(esp_check);
     }
@@ -21126,7 +21143,8 @@ regNumber           CodeGen::genLclHeap(GenTreePtr size)
 
         // If 0 we bail out
         instGen_Compare_Reg_To_Zero(easz, regCnt); // set flags
-        inst_JMP(genJumpKindForOper(GT_EQ, false), endLabel);
+        emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+        inst_JMP(jmpEqual, endLabel);
 
         // Align to STACK_ALIGN
         inst_RV_IV(INS_add, regCnt,  (STACK_ALIGN - 1), emitActualTypeSize(type));
@@ -21186,7 +21204,8 @@ regNumber           CodeGen::genLclHeap(GenTreePtr size)
         assert(!"Codegen missing");
 #endif // TARGETS
 
-        inst_JMP(genJumpKindForOper(GT_NE, false), loop);
+        emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_SIGNED);
+        inst_JMP(jmpNotEqual, loop);
 
         // Move the final value of ESP into regCnt
         inst_RV_RV(INS_mov, regCnt, REG_SPBASE);
@@ -21266,7 +21285,8 @@ regNumber           CodeGen::genLclHeap(GenTreePtr size)
         noway_assert(size->gtFlags & GTF_REG_VAL);
         regCnt = size->gtRegNum;
         inst_RV_RV(INS_cmp, REG_SPBASE, regCnt, TYP_I_IMPL);
-        inst_JMP(genJumpKindForOper(GT_GE, true), loop);
+        emitJumpKind jmpGEU = genJumpKindForOper(GT_GE, CK_UNSIGNED);
+        inst_JMP(jmpGEU, loop);
 
         // Move the final value to ESP
         inst_RV_RV(INS_mov, REG_SPBASE, regCnt);
index bf5a072..06b6d10 100644 (file)
@@ -258,7 +258,8 @@ void                CodeGen::genEmitGSCookieCheck(bool pushReg)
     }
 
     BasicBlock  *gsCheckBlk = genCreateTempLabel();
-    inst_JMP(genJumpKindForOper(GT_EQ, false), gsCheckBlk);
+    emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+    inst_JMP(jmpEqual, gsCheckBlk);
     genEmitHelperCall(CORINFO_HELP_FAIL_FAST, 0, EA_UNKNOWN);
     genDefineTempLabel(gsCheckBlk);
 }
@@ -2267,7 +2268,8 @@ CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
 
             BasicBlock* skipLabel = genCreateTempLabel();
 
-            inst_JMP(genJumpKindForOper(GT_EQ, false), skipLabel);
+            emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+            inst_JMP(jmpEqual, skipLabel);
 
             // emit the call to the EE-helper that stops for GC (or other reasons)
             assert(treeNode->gtRsvdRegs != RBM_NONE);
@@ -2878,7 +2880,8 @@ CodeGen::genLclHeap(GenTreePtr tree)
         getEmitter()->emitIns_S_R(INS_cmp, EA_PTRSIZE, REG_SPBASE, compiler->lvaReturnEspCheck, 0);
 
         BasicBlock  *   esp_check = genCreateTempLabel();
-        inst_JMP(genJumpKindForOper(GT_EQ, false), esp_check);
+        emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+        inst_JMP(jmpEqual, esp_check);
         getEmitter()->emitIns(INS_BREAKPOINT);
         genDefineTempLabel(esp_check);
     }
@@ -6278,7 +6281,8 @@ void         CodeGen::genJumpKindsForTree(GenTreePtr    cmpTree,
     // For integer comparisons just use genJumpKindForOper
     if (!varTypeIsFloating(cmpTree->gtOp.gtOp1->gtEffectiveVal()))
     {
-        jmpKind[0] = genJumpKindForOper(cmpTree->gtOper, (cmpTree->gtFlags & GTF_UNSIGNED) != 0);
+        CompareKind compareKind = ((cmpTree->gtFlags & GTF_UNSIGNED) != 0) ? CK_UNSIGNED : CK_SIGNED;
+        jmpKind[0] = genJumpKindForOper(cmpTree->gtOper, compareKind);
         jmpKind[1] = EJ_NONE;
     }
     else
@@ -6428,7 +6432,7 @@ void         CodeGen::genJumpKindsForTreeLongLo(GenTreePtr    cmpTree,
     jmpToTrueLabel[1] = true;
 
     assert(cmpTree->OperIsCompare());
-    jmpKind[0] = genJumpKindForOper(cmpTree->gtOper, true);
+    jmpKind[0] = genJumpKindForOper(cmpTree->gtOper, CK_UNSIGNED);
     jmpKind[1] = EJ_NONE;
 }
 
index 13f9123..7779cfe 100644 (file)
@@ -314,7 +314,8 @@ void CodeGen::genFloatCheckFinite(GenTree *tree, RegSet::RegisterPreference *pre
     inst_RV_IV(INS_cmp, reg, expMask, EA_4BYTE);
 
     // If exponent was all 1's, we need to throw ArithExcep
-    genJumpToThrowHlpBlk(EJ_eq, SCK_ARITH_EXCPN);
+    emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+    genJumpToThrowHlpBlk(jmpEqual, SCK_ARITH_EXCPN);
 
     genCodeForTreeFloat_DONE(tree, op1->gtRegNum);
 }
index 786276d..172d32e 100644 (file)
@@ -8075,7 +8075,7 @@ WorkingDir=JIT\Directed\StructPromote\SP2c
 MaxAllowedDurationSeconds=600
 HostStyle=Any
 Expected=100
-Categories=JIT;EXPECTED_FAIL;ISSUE_3151
+Categories=JIT;EXPECTED_FAIL;ISSUE_3151;REL_PASS
 [attributector.exe_2053]
 RelativePath=CoreMangLib\cti\system\resources\satellitecontractversionattribute\AttributeCtor\AttributeCtor.exe
 WorkingDir=CoreMangLib\cti\system\resources\satellitecontractversionattribute\AttributeCtor
@@ -13836,7 +13836,7 @@ WorkingDir=JIT\Directed\StructPromote\SP2b
 MaxAllowedDurationSeconds=600
 HostStyle=Any
 Expected=100
-Categories=JIT;EXPECTED_FAIL;ISSUE_3151
+Categories=JIT;EXPECTED_FAIL;ISSUE_3151;REL_PASS
 [ldfldahack.exe_5577]
 RelativePath=JIT\Regression\CLR-x86-JIT\v2.1\DDB\B168384\LdfldaHack\LdfldaHack.exe
 WorkingDir=JIT\Regression\CLR-x86-JIT\v2.1\DDB\B168384\LdfldaHack
@@ -19177,7 +19177,7 @@ WorkingDir=JIT\Methodical\Invoke\25params\25param2a_cs_do
 MaxAllowedDurationSeconds=600
 HostStyle=Any
 Expected=100
-Categories=JIT;EXPECTED_FAIL;ISSUE_2988;ISSUE_2987
+Categories=JIT;EXPECTED_FAIL;ISSUE_2988;ISSUE_2987;REL_PASS
 [_il_relconv_i8_i.exe_3892]
 RelativePath=JIT\Methodical\ELEMENT_TYPE_IU\_il_relconv_i8_i\_il_relconv_i8_i.exe
 WorkingDir=JIT\Methodical\ELEMENT_TYPE_IU\_il_relconv_i8_i
@@ -20654,7 +20654,7 @@ WorkingDir=JIT\Methodical\Invoke\25params\25param2a_cs_ro
 MaxAllowedDurationSeconds=600
 HostStyle=Any
 Expected=100
-Categories=JIT;EXPECTED_FAIL;ISSUE_2988;ISSUE_2987
+Categories=JIT;EXPECTED_FAIL;ISSUE_2988;ISSUE_2987;REL_PASS
 [weakreferenceisaliveb_psc.exe_2559]
 RelativePath=CoreMangLib\cti\system\weakreference\WeakReferenceIsAliveb_PSC\WeakReferenceIsAliveb_PSC.exe
 WorkingDir=CoreMangLib\cti\system\weakreference\WeakReferenceIsAliveb_PSC
@@ -26450,7 +26450,7 @@ WorkingDir=JIT\Regression\CLR-x86-JIT\V1-M09.5-PDC\b12399\b12399
 MaxAllowedDurationSeconds=600
 HostStyle=Any
 Expected=100
-Categories=JIT;EXPECTED_FAIL;NEED_TRIAGE
+Categories=JIT;EXPECTED_PASS;ISSUE_3105
 [int16iconvertibletoboolean.exe_1323]
 RelativePath=CoreMangLib\cti\system\int16\Int16IConvertibleToBoolean\Int16IConvertibleToBoolean.exe
 WorkingDir=CoreMangLib\cti\system\int16\Int16IConvertibleToBoolean
@@ -34234,7 +34234,7 @@ WorkingDir=JIT\Directed\StructPromote\SP2a
 MaxAllowedDurationSeconds=600
 HostStyle=Any
 Expected=100
-Categories=JIT;EXPECTED_FAIL;ISSUE_3151
+Categories=JIT;EXPECTED_FAIL;ISSUE_3151;REL_PASS
 [b15222.exe_4865]
 RelativePath=JIT\Regression\CLR-x86-JIT\V1-M09.5-PDC\b15222\b15222\b15222.exe
 WorkingDir=JIT\Regression\CLR-x86-JIT\V1-M09.5-PDC\b15222\b15222