Fix LIR generation for long arithmetic operation

X86Mir2Lir::GenLongArith generated wrong LIR if the first argument
of the operation was promoted. It forgot to swap arguments if
the first was not temp, but the second was temp

Change-Id: I389f72f560ce9924859e17385bc8f64793c77b67
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
Signed-off-by: Yevgeny Rouban <yevgeny.y.rouban@intel.com>
diff --git a/compiler/dex/quick/x86/int_x86.cc b/compiler/dex/quick/x86/int_x86.cc
index d12c057..d7eeeac 100644
--- a/compiler/dex/quick/x86/int_x86.cc
+++ b/compiler/dex/quick/x86/int_x86.cc
@@ -1200,8 +1200,12 @@
     // We need at least one of them to be a temporary.
     if (!(IsTemp(rl_src2.reg.GetReg()) && IsTemp(rl_src2.reg.GetHighReg()))) {
       rl_src1 = ForceTempWide(rl_src1);
+      GenLongRegOrMemOp(rl_src1, rl_src2, op);
+    } else {
+      GenLongRegOrMemOp(rl_src2, rl_src1, op);
+      StoreFinalValueWide(rl_dest, rl_src2);
+      return;
     }
-    GenLongRegOrMemOp(rl_src1, rl_src2, op);
   } else {
     // Need LHS to be the temp.
     rl_src1 = ForceTempWide(rl_src1);