Commit bb041d65 authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

ARM: Implement sqrt in inline assembly.

Call VSQRT directly to avoid the tiniest (1ulp) precision
error that occurs in the system-supplied sqrt on QNX/ARM.

All precision tests in SunSpider are now passing on this platform.

BUG=
R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/98363010

Patch from Cosmin Truta <ctruta@gmail.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18506 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 902a0592
......@@ -347,13 +347,33 @@ OS::MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function(
}
#endif
#undef __
UnaryMathFunction CreateSqrtFunction() {
#if defined(USE_SIMULATOR)
return &std::sqrt;
#else
size_t actual_size;
byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true));
if (buffer == NULL) return &std::sqrt;
MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size));
UnaryMathFunction CreateSqrtFunction() {
return &sqrt;
__ GetCFunctionDoubleResult(d0);
__ vsqrt(d0, d0);
__ SetCallCDoubleArguments(d0);
__ Ret();
CodeDesc desc;
masm.GetCode(&desc);
ASSERT(!RelocInfo::RequiresRelocation(desc));
CPU::FlushICache(buffer, actual_size);
OS::ProtectCode(buffer, actual_size);
return FUNCTION_CAST<UnaryMathFunction>(buffer);
#endif
}
#undef __
// -------------------------------------------------------------------------
// Platform-specific RuntimeCallHelper functions.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment