Bug 1574415 - Part 5: Avoid unnecessary move when source and temporary registers are equal. r=jandem
authorAndré Bargull <andre.bargull@gmail.com>
Mon, 07 Oct 2019 11:57:30 +0000
changeset 496546 f3b48a00be455786162394ad78a8d044349af958
parent 496545 ef1f7213e654816da44e0963a27adf1510e1ea03
child 496547 1cc3c2eee37ec2c9cd23d6327b8d8f6ca51dccf3
push id36661
push userccoroiu@mozilla.com
push dateMon, 07 Oct 2019 21:50:01 +0000
treeherdermozilla-central@2b4c8b7a255c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1574415
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1574415 - Part 5: Avoid unnecessary move when source and temporary registers are equal. r=jandem This avoids emitting `movapd %xmm0, %xmm0` for clamp-uint8 code. Differential Revision: https://phabricator.services.mozilla.com/D47753
js/src/jit/MacroAssembler.cpp
--- a/js/src/jit/MacroAssembler.cpp
+++ b/js/src/jit/MacroAssembler.cpp
@@ -2093,17 +2093,19 @@ void MacroAssembler::convertDoubleToInt(
           behavior == IntConversionBehavior::NegativeZeroCheck);
       break;
     case IntConversionBehavior::Truncate:
       branchTruncateDoubleMaybeModUint32(src, output,
                                          truncateFail ? truncateFail : fail);
       break;
     case IntConversionBehavior::ClampToUint8:
       // Clamping clobbers the input register, so use a temp.
-      moveDouble(src, temp);
+      if (src != temp) {
+        moveDouble(src, temp);
+      }
       clampDoubleToUint8(temp, output);
       break;
   }
 }
 
 void MacroAssembler::convertValueToInt(
     ValueOperand value, MDefinition* maybeInput, Label* handleStringEntry,
     Label* handleStringRejoin, Label* truncateDoubleSlow, Register stringReg,