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
This commit is contained in:
bmeurer@chromium.org 2014-01-09 07:47:58 +00:00
parent 902a05922b
commit bb041d65ee

View File

@ -347,13 +347,33 @@ OS::MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function(
}
#endif
#undef __
UnaryMathFunction CreateSqrtFunction() {
return &sqrt;
#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));
__ 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.