OSDN Git Service

AArch64: Fix kOpLsl, rem-float/double.
authorZheng Xu <zheng.xu@arm.com>
Mon, 9 Jun 2014 03:05:31 +0000 (11:05 +0800)
committerZheng Xu <zheng.xu@arm.com>
Mon, 9 Jun 2014 09:05:57 +0000 (17:05 +0800)
Change-Id: I6f7293493c0f94f96882d2e559e3eef659a23aec

compiler/dex/quick/arm64/fp_arm64.cc
compiler/dex/quick/arm64/utility_arm64.cc
compiler/dex/quick/gen_invoke.cc

index acc7d17..265e8d2 100644 (file)
@@ -45,6 +45,7 @@ void Arm64Mir2Lir::GenArithOpFloat(Instruction::Code opcode, RegLocation rl_dest
     case Instruction::REM_FLOAT_2ADDR:
     case Instruction::REM_FLOAT:
       FlushAllRegs();   // Send everything to home location
+      // TODO: Fix xSELF.
       CallRuntimeHelperRegLocationRegLocation(QUICK_ENTRYPOINT_OFFSET(8, pFmodf), rl_src1, rl_src2,
                                               false);
       rl_result = GetReturn(kFPReg);
@@ -88,8 +89,15 @@ void Arm64Mir2Lir::GenArithOpDouble(Instruction::Code opcode,
     case Instruction::REM_DOUBLE_2ADDR:
     case Instruction::REM_DOUBLE:
       FlushAllRegs();   // Send everything to home location
-      CallRuntimeHelperRegLocationRegLocation(QUICK_ENTRYPOINT_OFFSET(8, pFmod), rl_src1, rl_src2,
-                                              false);
+      // TODO: Fix xSELF.
+      {
+        ThreadOffset<8> helper_offset = QUICK_ENTRYPOINT_OFFSET(8, pFmod);
+        RegStorage r_tgt = CallHelperSetup(helper_offset);
+        LoadValueDirectWideFixed(rl_src1, rs_d0);
+        LoadValueDirectWideFixed(rl_src2, rs_d1);
+        ClobberCallerSave();
+        CallHelper(r_tgt, helper_offset, false);
+      }
       rl_result = GetReturnWide(kFPReg);
       StoreValueWide(rl_dest, rl_result);
       return;
index d0ab4f6..4f0d7bc 100644 (file)
@@ -532,11 +532,11 @@ LIR* Arm64Mir2Lir::OpRegRegImm(OpKind op, RegStorage r_dest, RegStorage r_src1,
   switch (op) {
     case kOpLsl: {
       // "lsl w1, w2, #imm" is an alias of "ubfm w1, w2, #(-imm MOD 32), #(31-imm)"
-      // and "lsl x1, x2, #imm" of "ubfm x1, x2, #(-imm MOD 32), #(31-imm)".
+      // and "lsl x1, x2, #imm" of "ubfm x1, x2, #(-imm MOD 64), #(63-imm)".
       // For now, we just use ubfm directly.
-      int max_value = (is_wide) ? 64 : 32;
+      int max_value = (is_wide) ? 63 : 31;
       return NewLIR4(kA64Ubfm4rrdd | wide, r_dest.GetReg(), r_src1.GetReg(),
-                     (-value) & (max_value - 1), max_value - value);
+                     (-value) & max_value, max_value - value);
     }
     case kOpLsr:
       return NewLIR3(kA64Lsr3rrd | wide, r_dest.GetReg(), r_src1.GetReg(), value);
index ee68fe2..7a415a2 100644 (file)
@@ -277,6 +277,8 @@ void Mir2Lir::CallRuntimeHelperRegLocationRegLocation(ThreadOffset<pointer_size>
     if (arg1.wide == 0) {
       if (cu_->instruction_set == kMips) {
         LoadValueDirectFixed(arg1, arg1.fp ? TargetReg(kFArg2) : TargetReg(kArg1));
+      } else if (cu_->instruction_set == kArm64) {
+        LoadValueDirectFixed(arg1, arg1.fp ? TargetReg(kFArg1) : TargetReg(kArg1));
       } else {
         LoadValueDirectFixed(arg1, TargetReg(kArg1));
       }