| Index: src/crankshaft/ppc/lithium-codegen-ppc.cc
|
| diff --git a/src/crankshaft/ppc/lithium-codegen-ppc.cc b/src/crankshaft/ppc/lithium-codegen-ppc.cc
|
| index 9a7aa32aa76ae2a7178dcbbdd51c1413ff954d91..0082f7355e7c30d5563a37bbf24a743d3ec1784c 100644
|
| --- a/src/crankshaft/ppc/lithium-codegen-ppc.cc
|
| +++ b/src/crankshaft/ppc/lithium-codegen-ppc.cc
|
| @@ -2390,32 +2390,13 @@ void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
|
| DoubleRegister value = ToDoubleRegister(instr->value());
|
| __ fcmpu(value, kDoubleRegZero);
|
| EmitFalseBranch(instr, ne);
|
| -#if V8_TARGET_ARCH_PPC64
|
| - __ MovDoubleToInt64(scratch, value);
|
| -#else
|
| - __ MovDoubleHighToInt(scratch, value);
|
| -#endif
|
| - __ cmpi(scratch, Operand::Zero());
|
| + __ TestDoubleSign(value, scratch);
|
| EmitBranch(instr, lt);
|
| } else {
|
| Register value = ToRegister(instr->value());
|
| __ CheckMap(value, scratch, Heap::kHeapNumberMapRootIndex,
|
| instr->FalseLabel(chunk()), DO_SMI_CHECK);
|
| -#if V8_TARGET_ARCH_PPC64
|
| - __ LoadP(scratch, FieldMemOperand(value, HeapNumber::kValueOffset));
|
| - __ li(ip, Operand(1));
|
| - __ rotrdi(ip, ip, 1); // ip = 0x80000000_00000000
|
| - __ cmp(scratch, ip);
|
| -#else
|
| - __ lwz(scratch, FieldMemOperand(value, HeapNumber::kExponentOffset));
|
| - __ lwz(ip, FieldMemOperand(value, HeapNumber::kMantissaOffset));
|
| - Label skip;
|
| - __ lis(r0, Operand(SIGN_EXT_IMM16(0x8000)));
|
| - __ cmp(scratch, r0);
|
| - __ bne(&skip);
|
| - __ cmpi(ip, Operand::Zero());
|
| - __ bind(&skip);
|
| -#endif
|
| + __ TestHeapNumberIsMinusZero(value, scratch, ip);
|
| EmitBranch(instr, eq);
|
| }
|
| }
|
| @@ -3700,13 +3681,8 @@ void LCodeGen::DoMathRound(LMathRound* instr) {
|
| // If the input is +0.5, the result is 1.
|
| __ bgt(&convert); // Out of [-0.5, +0.5].
|
| if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| -#if V8_TARGET_ARCH_PPC64
|
| - __ MovDoubleToInt64(scratch1, input);
|
| -#else
|
| - __ MovDoubleHighToInt(scratch1, input);
|
| -#endif
|
| - __ cmpi(scratch1, Operand::Zero());
|
| - // [-0.5, -0].
|
| + // [-0.5, -0] (negative) yields minus zero.
|
| + __ TestDoubleSign(input, scratch1);
|
| DeoptimizeIf(lt, instr, Deoptimizer::kMinusZero);
|
| }
|
| __ fcmpu(input, dot_five);
|
| @@ -4920,17 +4896,7 @@ void LCodeGen::EmitNumberUntagD(LNumberUntagD* instr, Register input_reg,
|
| // load heap number
|
| __ lfd(result_reg, FieldMemOperand(input_reg, HeapNumber::kValueOffset));
|
| if (deoptimize_on_minus_zero) {
|
| -#if V8_TARGET_ARCH_PPC64
|
| - __ MovDoubleToInt64(scratch, result_reg);
|
| - // rotate left by one for simple compare.
|
| - __ rldicl(scratch, scratch, 1, 0);
|
| - __ cmpi(scratch, Operand(1));
|
| -#else
|
| - __ MovDoubleToInt64(scratch, ip, result_reg);
|
| - __ cmpi(ip, Operand::Zero());
|
| - __ bne(&done);
|
| - __ Cmpi(scratch, Operand(HeapNumber::kSignMask), r0);
|
| -#endif
|
| + __ TestDoubleIsMinusZero(result_reg, scratch, ip);
|
| DeoptimizeIf(eq, instr, Deoptimizer::kMinusZero);
|
| }
|
| __ b(&done);
|
| @@ -5019,10 +4985,7 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
|
| if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| __ cmpi(input_reg, Operand::Zero());
|
| __ bne(&done);
|
| - __ lwz(scratch1,
|
| - FieldMemOperand(scratch2, HeapNumber::kValueOffset +
|
| - Register::kExponentOffset));
|
| - __ cmpwi(scratch1, Operand::Zero());
|
| + __ TestHeapNumberSign(scratch2, scratch1);
|
| DeoptimizeIf(lt, instr, Deoptimizer::kMinusZero);
|
| }
|
| }
|
| @@ -5097,12 +5060,7 @@ void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
|
| Label done;
|
| __ cmpi(result_reg, Operand::Zero());
|
| __ bne(&done);
|
| -#if V8_TARGET_ARCH_PPC64
|
| - __ MovDoubleToInt64(scratch1, double_input);
|
| -#else
|
| - __ MovDoubleHighToInt(scratch1, double_input);
|
| -#endif
|
| - __ cmpi(scratch1, Operand::Zero());
|
| + __ TestDoubleSign(double_input, scratch1);
|
| DeoptimizeIf(lt, instr, Deoptimizer::kMinusZero);
|
| __ bind(&done);
|
| }
|
| @@ -5127,12 +5085,7 @@ void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
|
| Label done;
|
| __ cmpi(result_reg, Operand::Zero());
|
| __ bne(&done);
|
| -#if V8_TARGET_ARCH_PPC64
|
| - __ MovDoubleToInt64(scratch1, double_input);
|
| -#else
|
| - __ MovDoubleHighToInt(scratch1, double_input);
|
| -#endif
|
| - __ cmpi(scratch1, Operand::Zero());
|
| + __ TestDoubleSign(double_input, scratch1);
|
| DeoptimizeIf(lt, instr, Deoptimizer::kMinusZero);
|
| __ bind(&done);
|
| }
|
|
|