Browse Source

ARM: Fix code generation for integer math.min/math.max.

Mike Pall 12 years ago
parent
commit
41738e371a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/lj_asm_arm.h

+ 2 - 2
src/lj_asm_arm.h

@@ -1642,13 +1642,13 @@ static void asm_intmin_max(ASMState *as, IRIns *ir, int cc)
     kcmp = 0;
     kcmp = 0;
     right = ra_alloc1(as, ir->op2, rset_exclude(RSET_GPR, left));
     right = ra_alloc1(as, ir->op2, rset_exclude(RSET_GPR, left));
   }
   }
-  if (dest != right) {
+  if (kmov || dest != right) {
     emit_dm(as, ARMF_CC(ARMI_MOV, cc)^kmov, dest, right);
     emit_dm(as, ARMF_CC(ARMI_MOV, cc)^kmov, dest, right);
     cc ^= 1;  /* Must use opposite conditions for paired moves. */
     cc ^= 1;  /* Must use opposite conditions for paired moves. */
   } else {
   } else {
     cc ^= (CC_LT^CC_GT);  /* Otherwise may swap CC_LT <-> CC_GT. */
     cc ^= (CC_LT^CC_GT);  /* Otherwise may swap CC_LT <-> CC_GT. */
   }
   }
-  if (dest != left) emit_dm(as, ARMF_CC(ARMI_MOV, cc)^kmov, dest, left);
+  if (dest != left) emit_dm(as, ARMF_CC(ARMI_MOV, cc), dest, left);
   emit_nm(as, ARMI_CMP^kcmp, left, right);
   emit_nm(as, ARMI_CMP^kcmp, left, right);
 }
 }