OSDN Git Service

ART: x86_64 RoundDouble/Float intrinsics should initialize out value.
authorPavel Vyssotski <pavel.n.vyssotski@intel.com>
Fri, 31 Jul 2015 07:03:17 +0000 (13:03 +0600)
committerPavel Vyssotski <pavel.n.vyssotski@intel.com>
Tue, 4 Aug 2015 11:31:04 +0000 (17:31 +0600)
x86_64 RoundDouble intrinsic should initialize output register for the case of
"inPlusPointFive >= maxLong" as expected. The same for the RoundFloat intrinsic.
Fixed also the out register type in CreateSSE41FPToIntLocations provoking
a DCHECK failure.

Change-Id: I0a910682e2917214861683c678ffba8e0f4bfed8
Signed-off-by: Pavel Vyssotski <pavel.n.vyssotski@intel.com>
compiler/optimizing/intrinsics_x86_64.cc

index ea342e9..1a50f50 100644 (file)
@@ -690,7 +690,7 @@ static void CreateSSE41FPToIntLocations(ArenaAllocator* arena,
                                                               LocationSummary::kNoCall,
                                                               kIntrinsified);
     locations->SetInAt(0, Location::RequiresFpuRegister());
-    locations->SetOut(Location::RequiresFpuRegister());
+    locations->SetOut(Location::RequiresRegister());
     locations->AddTemp(Location::RequiresFpuRegister());
     return;
   }
@@ -732,6 +732,9 @@ void IntrinsicCodeGeneratorX86_64::VisitMathRoundFloat(HInvoke* invoke) {
   // And truncate to an integer.
   __ roundss(inPlusPointFive, inPlusPointFive, Immediate(1));
 
+  // Load maxInt into out.
+  codegen_->Load64BitValue(out, kPrimIntMax);
+
   // if inPlusPointFive >= maxInt goto done
   __ comiss(inPlusPointFive, codegen_->LiteralFloatAddress(static_cast<float>(kPrimIntMax)));
   __ j(kAboveEqual, &done);
@@ -776,6 +779,9 @@ void IntrinsicCodeGeneratorX86_64::VisitMathRoundDouble(HInvoke* invoke) {
   // And truncate to an integer.
   __ roundsd(inPlusPointFive, inPlusPointFive, Immediate(1));
 
+  // Load maxLong into out.
+  codegen_->Load64BitValue(out, kPrimLongMax);
+
   // if inPlusPointFive >= maxLong goto done
   __ comisd(inPlusPointFive, codegen_->LiteralDoubleAddress(static_cast<double>(kPrimLongMax)));
   __ j(kAboveEqual, &done);