From 799f506b8d48bcceef5e6cf50f3f5eb6bcea05e1 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Wed, 26 Nov 2014 14:45:52 +0000 Subject: Revert "[optimizing compiler] Add CMP{L,G}_{FLOAT,DOUBLE}" Fails on x86_64 and target. This reverts commit cea28ec4b9e94ec942899acf1dbf20f8999b36b4. Change-Id: I30c1d188c7ecfe765f137a307022ede84f15482c --- compiler/optimizing/code_generator_arm.cc | 71 ++++++++++--------------------- 1 file changed, 22 insertions(+), 49 deletions(-) (limited to 'compiler/optimizing/code_generator_arm.cc') diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc index 641e115f5d..a204e21495 100644 --- a/compiler/optimizing/code_generator_arm.cc +++ b/compiler/optimizing/code_generator_arm.cc @@ -2292,71 +2292,44 @@ void InstructionCodeGeneratorARM::VisitNot(HNot* not_) { void LocationsBuilderARM::VisitCompare(HCompare* compare) { LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(compare, LocationSummary::kNoCall); - switch (compare->InputAt(0)->GetType()) { - case Primitive::kPrimLong: { - locations->SetInAt(0, Location::RequiresRegister()); - locations->SetInAt(1, Location::RequiresRegister()); - locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); - break; - } - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: { - locations->SetInAt(0, Location::RequiresFpuRegister()); - locations->SetInAt(1, Location::RequiresFpuRegister()); - locations->SetOut(Location::RequiresRegister()); - break; - } - default: - LOG(FATAL) << "Unexpected type for compare operation " << compare->InputAt(0)->GetType(); - } + locations->SetInAt(0, Location::RequiresRegister()); + locations->SetInAt(1, Location::RequiresRegister()); + locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); } void InstructionCodeGeneratorARM::VisitCompare(HCompare* compare) { LocationSummary* locations = compare->GetLocations(); - Register out = locations->Out().As(); - Location left = locations->InAt(0); - Location right = locations->InAt(1); - - Label less, greater, done; switch (compare->InputAt(0)->GetType()) { case Primitive::kPrimLong: { + Register output = locations->Out().As(); + Location left = locations->InAt(0); + Location right = locations->InAt(1); + Label less, greater, done; __ cmp(left.AsRegisterPairHigh(), ShifterOperand(right.AsRegisterPairHigh())); // Signed compare. __ b(&less, LT); __ b(&greater, GT); - // Do LoadImmediate before any `cmp`, as LoadImmediate might affect the status flags. - __ LoadImmediate(out, 0); + // Do LoadImmediate before any `cmp`, as LoadImmediate might affect + // the status flags. + __ LoadImmediate(output, 0); __ cmp(left.AsRegisterPairLow(), ShifterOperand(right.AsRegisterPairLow())); // Unsigned compare. - break; - } - case Primitive::kPrimFloat: { - __ LoadImmediate(out, 0); - __ vcmps(left.As(), right.As()); - __ b(compare->IsGtBias() ? &greater : &less, VS); // VS for unordered - break; - } - case Primitive::kPrimDouble: { - __ LoadImmediate(out, 0); - __ vcmpd(FromLowSToD(left.AsFpuRegisterPairLow()), - FromLowSToD(right.AsFpuRegisterPairLow())); - __ b(compare->IsGtBias() ? &greater : &less, VS); + __ b(&done, EQ); + __ b(&less, CC); + + __ Bind(&greater); + __ LoadImmediate(output, 1); + __ b(&done); + + __ Bind(&less); + __ LoadImmediate(output, -1); + + __ Bind(&done); break; } default: - LOG(FATAL) << "Unexpected compare type " << compare->InputAt(0)->GetType(); + LOG(FATAL) << "Unimplemented compare type " << compare->InputAt(0)->GetType(); } - __ b(&done, EQ); - __ b(&less, CC); // CC is for both: unsigned compare for longs and 'less than' for floats. - - __ Bind(&greater); - __ LoadImmediate(out, 1); - __ b(&done); - - __ Bind(&less); - __ LoadImmediate(out, -1); - - __ Bind(&done); } void LocationsBuilderARM::VisitPhi(HPhi* instruction) { -- cgit v1.2.3