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

Unified Diff: src/ppc/codegen-ppc.cc

Issue 2075263002: PPC/s390: [builtins] Introduce proper Float64Exp operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments, uploaded doubleregister to d0 Created 4 years, 6 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/codegen-ppc.h ('k') | src/s390/codegen-s390.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ppc/codegen-ppc.cc
diff --git a/src/ppc/codegen-ppc.cc b/src/ppc/codegen-ppc.cc
index 2139d871db5d37d23bde27d4b1f685c40659cbc5..8f2f1cd902f4f3a56630b4a00d4c30f7e23757df 100644
--- a/src/ppc/codegen-ppc.cc
+++ b/src/ppc/codegen-ppc.cc
@@ -16,62 +16,6 @@ namespace internal {
#define __ masm.
-
-#if defined(USE_SIMULATOR)
-byte* fast_exp_ppc_machine_code = nullptr;
-double fast_exp_simulator(double x, Isolate* isolate) {
- return Simulator::current(isolate)
- ->CallFPReturnsDouble(fast_exp_ppc_machine_code, x, 0);
-}
-#endif
-
-
-UnaryMathFunctionWithIsolate CreateExpFunction(Isolate* isolate) {
- size_t actual_size;
- byte* buffer =
- static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true));
- if (buffer == nullptr) return nullptr;
- ExternalReference::InitializeMathExpData();
-
- MacroAssembler masm(isolate, buffer, static_cast<int>(actual_size),
- CodeObjectRequired::kNo);
-
- {
- DoubleRegister input = d1;
- DoubleRegister result = d2;
- DoubleRegister double_scratch1 = d3;
- DoubleRegister double_scratch2 = d4;
- Register temp1 = r7;
- Register temp2 = r8;
- Register temp3 = r9;
-
-// Called from C
- __ function_descriptor();
-
- __ Push(temp3, temp2, temp1);
- MathExpGenerator::EmitMathExp(&masm, input, result, double_scratch1,
- double_scratch2, temp1, temp2, temp3);
- __ Pop(temp3, temp2, temp1);
- __ fmr(d1, result);
- __ Ret();
- }
-
- CodeDesc desc;
- masm.GetCode(&desc);
- DCHECK(ABI_USES_FUNCTION_DESCRIPTORS || !RelocInfo::RequiresRelocation(desc));
-
- Assembler::FlushICache(isolate, buffer, actual_size);
- base::OS::ProtectCode(buffer, actual_size);
-
-#if !defined(USE_SIMULATOR)
- return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer);
-#else
- fast_exp_ppc_machine_code = buffer;
- return &fast_exp_simulator;
-#endif
-}
-
-
UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) {
#if defined(USE_SIMULATOR)
return nullptr;
@@ -513,96 +457,6 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm, Register string,
__ bind(&done);
}
-
-static MemOperand ExpConstant(int index, Register base) {
- return MemOperand(base, index * kDoubleSize);
-}
-
-
-void MathExpGenerator::EmitMathExp(MacroAssembler* masm, DoubleRegister input,
- DoubleRegister result,
- DoubleRegister double_scratch1,
- DoubleRegister double_scratch2,
- Register temp1, Register temp2,
- Register temp3) {
- DCHECK(!input.is(result));
- DCHECK(!input.is(double_scratch1));
- DCHECK(!input.is(double_scratch2));
- DCHECK(!result.is(double_scratch1));
- DCHECK(!result.is(double_scratch2));
- DCHECK(!double_scratch1.is(double_scratch2));
- DCHECK(!temp1.is(temp2));
- DCHECK(!temp1.is(temp3));
- DCHECK(!temp2.is(temp3));
- DCHECK(ExternalReference::math_exp_constants(0).address() != NULL);
- DCHECK(!masm->serializer_enabled()); // External references not serializable.
-
- Label zero, infinity, done;
-
- __ mov(temp3, Operand(ExternalReference::math_exp_constants(0)));
-
- __ lfd(double_scratch1, ExpConstant(0, temp3));
- __ fcmpu(double_scratch1, input);
- __ fmr(result, input);
- __ bunordered(&done);
- __ bge(&zero);
-
- __ lfd(double_scratch2, ExpConstant(1, temp3));
- __ fcmpu(input, double_scratch2);
- __ bge(&infinity);
-
- __ lfd(double_scratch1, ExpConstant(3, temp3));
- __ lfd(result, ExpConstant(4, temp3));
- __ fmul(double_scratch1, double_scratch1, input);
- __ fadd(double_scratch1, double_scratch1, result);
- __ MovDoubleLowToInt(temp2, double_scratch1);
- __ fsub(double_scratch1, double_scratch1, result);
- __ lfd(result, ExpConstant(6, temp3));
- __ lfd(double_scratch2, ExpConstant(5, temp3));
- __ fmul(double_scratch1, double_scratch1, double_scratch2);
- __ fsub(double_scratch1, double_scratch1, input);
- __ fsub(result, result, double_scratch1);
- __ fmul(double_scratch2, double_scratch1, double_scratch1);
- __ fmul(result, result, double_scratch2);
- __ lfd(double_scratch2, ExpConstant(7, temp3));
- __ fmul(result, result, double_scratch2);
- __ fsub(result, result, double_scratch1);
- __ lfd(double_scratch2, ExpConstant(8, temp3));
- __ fadd(result, result, double_scratch2);
- __ srwi(temp1, temp2, Operand(11));
- __ andi(temp2, temp2, Operand(0x7ff));
- __ addi(temp1, temp1, Operand(0x3ff));
-
- // Must not call ExpConstant() after overwriting temp3!
- __ mov(temp3, Operand(ExternalReference::math_exp_log_table()));
- __ slwi(temp2, temp2, Operand(3));
-#if V8_TARGET_ARCH_PPC64
- __ ldx(temp2, MemOperand(temp3, temp2));
- __ sldi(temp1, temp1, Operand(52));
- __ orx(temp2, temp1, temp2);
- __ MovInt64ToDouble(double_scratch1, temp2);
-#else
- __ add(ip, temp3, temp2);
- __ lwz(temp3, MemOperand(ip, Register::kExponentOffset));
- __ lwz(temp2, MemOperand(ip, Register::kMantissaOffset));
- __ slwi(temp1, temp1, Operand(20));
- __ orx(temp3, temp1, temp3);
- __ MovInt64ToDouble(double_scratch1, temp3, temp2);
-#endif
-
- __ fmul(result, result, double_scratch1);
- __ b(&done);
-
- __ bind(&zero);
- __ fmr(result, kDoubleRegZero);
- __ b(&done);
-
- __ bind(&infinity);
- __ lfd(result, ExpConstant(2, temp3));
-
- __ bind(&done);
-}
-
#undef __
CodeAgingHelper::CodeAgingHelper(Isolate* isolate) {
« no previous file with comments | « src/ppc/codegen-ppc.h ('k') | src/s390/codegen-s390.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698