From ce4b1329ca903d6b98734a27a46b54bb9cfd6d5b Mon Sep 17 00:00:00 2001 From: Pavel Vyssotski Date: Fri, 31 Jul 2015 13:03:17 +0600 Subject: ART: x86_64 RoundDouble/Float intrinsics should initialize out value. 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. Signed-off-by: Pavel Vyssotski (cherry picked from commit 9ca257196b46fd7629bce0b338580e571e4113a8) Bug: 22973442 Change-Id: If974e79d33311587d0b541a01ca8a4c9c11b9468 --- compiler/optimizing/intrinsics_x86_64.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/optimizing/intrinsics_x86_64.cc b/compiler/optimizing/intrinsics_x86_64.cc index c245cb646f..450e550328 100644 --- a/compiler/optimizing/intrinsics_x86_64.cc +++ b/compiler/optimizing/intrinsics_x86_64.cc @@ -686,7 +686,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; } @@ -728,6 +728,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(kPrimIntMax))); __ j(kAboveEqual, &done); @@ -772,6 +775,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(kPrimLongMax))); __ j(kAboveEqual, &done); -- cgit v1.2.3