Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: src/ppc/macro-assembler-ppc.cc

Issue 1650593002: PPC: Refactor checks for minus zero. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@patch05
Patch Set: Fix typos. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ppc/macro-assembler-ppc.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ppc/macro-assembler-ppc.cc
diff --git a/src/ppc/macro-assembler-ppc.cc b/src/ppc/macro-assembler-ppc.cc
index a2043a0559623af9572e48d90a76d2dadfe568e1..5088f58946e238ad0843b3d41475edb6f69609fb 100644
--- a/src/ppc/macro-assembler-ppc.cc
+++ b/src/ppc/macro-assembler-ppc.cc
@@ -2128,6 +2128,60 @@ void MacroAssembler::TestDoubleIsInt32(DoubleRegister double_input,
TryDoubleToInt32Exact(scratch1, double_input, scratch2, double_scratch);
}
+void MacroAssembler::TestDoubleIsMinusZero(DoubleRegister input,
+ Register scratch1,
+ Register scratch2) {
+#if V8_TARGET_ARCH_PPC64
+ MovDoubleToInt64(scratch1, input);
+ rotldi(scratch1, scratch1, 1);
+ cmpi(scratch1, Operand(1));
+#else
+ MovDoubleToInt64(scratch1, scratch2, input);
+ Label done;
+ cmpi(scratch2, Operand::Zero());
+ bne(&done);
+ lis(scratch2, Operand(SIGN_EXT_IMM16(0x8000)));
+ cmp(scratch1, scratch2);
+ bind(&done);
+#endif
+}
+
+void MacroAssembler::TestHeapNumberIsMinusZero(Register input,
+ Register scratch1,
+ Register scratch2) {
+#if V8_TARGET_ARCH_PPC64
+ LoadP(scratch1, FieldMemOperand(input, HeapNumber::kValueOffset));
+ rotldi(scratch1, scratch1, 1);
+ cmpi(scratch1, Operand(1));
+#else
+ lwz(scratch1, FieldMemOperand(input, HeapNumber::kExponentOffset));
+ lwz(scratch2, FieldMemOperand(input, HeapNumber::kMantissaOffset));
+ Label done;
+ cmpi(scratch2, Operand::Zero());
+ bne(&done);
+ lis(scratch2, Operand(SIGN_EXT_IMM16(0x8000)));
+ cmp(scratch1, scratch2);
+ bind(&done);
+#endif
+}
+
+void MacroAssembler::TestDoubleSign(DoubleRegister input, Register scratch) {
+#if V8_TARGET_ARCH_PPC64
+ MovDoubleToInt64(scratch, input);
+#else
+ MovDoubleHighToInt(scratch, input);
+#endif
+ cmpi(scratch, Operand::Zero());
+}
+
+void MacroAssembler::TestHeapNumberSign(Register input, Register scratch) {
+#if V8_TARGET_ARCH_PPC64
+ LoadP(scratch, FieldMemOperand(input, HeapNumber::kValueOffset));
+#else
+ lwz(scratch, FieldMemOperand(input, HeapNumber::kExponentOffset));
+#endif
+ cmpi(scratch, Operand::Zero());
+}
void MacroAssembler::TryDoubleToInt32Exact(Register result,
DoubleRegister double_input,
« no previous file with comments | « src/ppc/macro-assembler-ppc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698