<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 17, 2019, 1:12 PM Gedare Bloom <<a href="mailto:gedare@rtems.org">gedare@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, Jul 16, 2019 at 6:57 AM Joel Sherrill <<a href="mailto:joel@rtems.org" target="_blank" rel="noreferrer">joel@rtems.org</a>> wrote:<br>
><br>
> Let's give preference to FreeBSD sources. Notes below.<br>
><br>
> On Wed, Jul 3, 2019 at 1:08 PM Vaibhav Gupta <<a href="mailto:vaibhavgupta40@gmail.com" target="_blank" rel="noreferrer">vaibhavgupta40@gmail.com</a>> wrote:<br>
>><br>
>> Hello,<br>
>> I have found sources for fenv.<br>
>><br>
>> 1.1) - ARM FreeBSD Source:<br>
>> - <a href="https://github.com/freebsd/freebsd/blob/master/lib/msun/arm/fenv.h" rel="noreferrer noreferrer" target="_blank">https://github.com/freebsd/freebsd/blob/master/lib/msun/arm/fenv.h</a><br>
>> - <a href="https://github.com/freebsd/freebsd/blob/master/lib/msun/arm/fenv.c" rel="noreferrer noreferrer" target="_blank">https://github.com/freebsd/freebsd/blob/master/lib/msun/arm/fenv.c</a><br>
>> .<br>
>> 1.2) - ARM NetBSD Source :<br>
>> - <a href="https://github.com/NetBSD/src/blob/trunk/sys/arch/arm/include/fenv.h" rel="noreferrer noreferrer" target="_blank">https://github.com/NetBSD/src/blob/trunk/sys/arch/arm/include/fenv.h</a><br>
>> - <a href="https://github.com/NetBSD/src/blob/trunk/lib/libm/arch/arm/fenv.c" rel="noreferrer noreferrer" target="_blank">https://github.com/NetBSD/src/blob/trunk/lib/libm/arch/arm/fenv.c</a><br>
>> -----------------------------------------------------------------------------<br>
><br>
><br>
> For the ARM FreeBSD source, there are some ifdef's which appear to<br>
> be for architectural variations. Please check the gcc source for arm<br>
> (gcc-XXX/gcc/config/arm) to see if they are defined by gcc. If they<br>
> all are, then there is nothing to consider on how they get tripped.<br>
><br>
> For example, __ARM_PCS_AAPCS64 is one. That looks like a multilib<br>
> define.<br>
><br>
>><br>
>> 2.1) - SPARC NetBSD Source :<br>
>> - <a href="https://github.com/NetBSD/src/blob/trunk/sys/arch/sparc/include/fenv.h" rel="noreferrer noreferrer" target="_blank">https://github.com/NetBSD/src/blob/trunk/sys/arch/sparc/include/fenv.h</a><br>
>> - <a href="https://github.com/NetBSD/src/blob/trunk/lib/libm/arch/sparc/fenv.c" rel="noreferrer noreferrer" target="_blank">https://github.com/NetBSD/src/blob/trunk/lib/libm/arch/sparc/fenv.c</a><br>
>> ----------------------------------------------------------------------------<br>
><br>
><br>
> This looks good and may work for sparc64 as well as sparc. Check if<br>
> sparc64-rtems5-gcc defines __arch64 as used byL<br>
><br>
> <a href="https://github.com/NetBSD/src/blob/trunk/sys/arch/sparc/include/fenv.h#L36" rel="noreferrer noreferrer" target="_blank">https://github.com/NetBSD/src/blob/trunk/sys/arch/sparc/include/fenv.h#L36</a><br>
><br>
>><br>
>> 3.1) - PPC FreeBSD Source:<br>
>> - <a href="https://github.com/freebsd/freebsd/blob/master/lib/msun/powerpc/fenv.h" rel="noreferrer noreferrer" target="_blank">https://github.com/freebsd/freebsd/blob/master/lib/msun/powerpc/fenv.h</a><br>
>> - <a href="https://github.com/freebsd/freebsd/blob/master/lib/msun/powerpc/fenv.c" rel="noreferrer noreferrer" target="_blank">https://github.com/freebsd/freebsd/blob/master/lib/msun/powerpc/fenv.c</a><br>
>> .<br>
>> 3.2) - PPC NetBSD Source:<br>
>> - <a href="https://github.com/NetBSD/src/blob/trunk/sys/arch/powerpc/include/fenv.h" rel="noreferrer noreferrer" target="_blank">https://github.com/NetBSD/src/blob/trunk/sys/arch/powerpc/include/fenv.h</a><br>
>> - <a href="https://github.com/NetBSD/src/blob/trunk/lib/libm/arch/powerpc/fenv.c" rel="noreferrer noreferrer" target="_blank">https://github.com/NetBSD/src/blob/trunk/lib/libm/arch/powerpc/fenv.c</a><br>
>> ---------------------------------------------------------------------------<br>
><br>
><br>
> Sam advice on PPC. Looks OK, check ifdefs<br>
><br>
>><br>
>> 4.1) - x86 FreeBSD Source:<br>
>> - <a href="https://github.com/freebsd/freebsd/blob/master/lib/msun/x86/fenv.h" rel="noreferrer noreferrer" target="_blank">https://github.com/freebsd/freebsd/blob/master/lib/msun/x86/fenv.h</a><br>
>> .<br>
>> 4.2) - x86 NetBSD Source:<br>
>> - <a href="https://github.com/NetBSD/src/blob/trunk/lib/libm/arch/x86_64/fenv.c" rel="noreferrer noreferrer" target="_blank">https://github.com/NetBSD/src/blob/trunk/lib/libm/arch/x86_64/fenv.c</a><br>
>> --------------------------------------------------------------------------<br>
><br>
><br>
> This is not i386 (e.g. 32-bit), it is for the 64-bit target. Good to merge it into<br>
> newlib but we don't have a fully functional port to test this with.<br>
><br>
>><br>
>> 5.1) - RISC5 FreeBSD Source:<br>
>> - <a href="https://github.com/freebsd/freebsd/blob/master/lib/msun/riscv/fenv.h" rel="noreferrer noreferrer" target="_blank">https://github.com/freebsd/freebsd/blob/master/lib/msun/riscv/fenv.h</a><br>
>> - <a href="https://github.com/freebsd/freebsd/blob/master/lib/msun/riscv/fenv.c" rel="noreferrer noreferrer" target="_blank">https://github.com/freebsd/freebsd/blob/master/lib/msun/riscv/fenv.c</a><br>
>> .<br>
>> 5.2) - RISC5 NetBSD Source:<br>
>> - <a href="https://github.com/NetBSD/src/blob/trunk/sys/arch/riscv/include/fenv.h" rel="noreferrer noreferrer" target="_blank">https://github.com/NetBSD/src/blob/trunk/sys/arch/riscv/include/fenv.h</a><br>
>> - <a href="https://github.com/NetBSD/src/blob/trunk/lib/libm/arch/riscv/fenv.c" rel="noreferrer noreferrer" target="_blank">https://github.com/NetBSD/src/blob/trunk/lib/libm/arch/riscv/fenv.c</a><br>
>> ========================================================<br>
><br>
><br>
> Same advice.<br>
><br>
>><br>
>> ========================================================<br>
>><br>
>> It's impossible to depend on either NetBSD or FreeBSD.<br>
><br>
><br>
> Yep. Give preference to FreeBSD but if it isn't in FreeBSD, use NetBSD.<br>
>><br>
>> .<br>
>> For some architectures, FreeBSD has code,<br>
>> for some, NetBSD has.<br>
>> .<br>
>> For x86, Free BSD has explicit header<br>
>> and NetBSD has .c file.<br>
><br>
><br>
> These are all architecture specific files so do not go in a main include<br>
> or source directory. They go in an architecture specific subdirectory.<br>
><br>
> See <a href="https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=tree;f=newlib/libm/machine;h=9b2197b2660fd84c6b64ef265c1ec3b6e30c9074;hb=HEAD" rel="noreferrer noreferrer" target="_blank">https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=tree;f=newlib/libm/machine;h=9b2197b2660fd84c6b64ef265c1ec3b6e30c9074;hb=HEAD</a><br>
><br>
> And notice that arm, aarch64, riscv, and i386 are all already there. Looks<br>
> like you can focus on the ones not there (PPC and SPARC). Ignore x86_64<br>
> for now. If there is a ticket for the port, just add a comment to that. I don't<br>
> think we are setup to test that port right now.<br>
><br>
Since arm/riscv/i386 are there, you might be able to write an fenv<br>
test suite that can pass on one of those archs, and then use it with<br>
confidence to do TDD of other architectures.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">This is a great idea!</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> Hope that all makes sense.<br>
><br>
> --joel<br>
><br>
>> .<br>
>> .<br>
>> .<br>
>> Vaibhav Gupta<br>
</blockquote></div></div></div>