<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 20, 2020 at 2:50 PM Gedare Bloom <<a href="mailto:gedare@rtems.org">gedare@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sun, Mar 8, 2020 at 11:02 AM Eshan Dhawan <<a href="mailto:eshandhawan51@gmail.com" target="_blank">eshandhawan51@gmail.com</a>> wrote:<br>
><br>
> I have compiled as well as executed it for RISC V architecture function Fegetround() returns error for all rounding directions other the default "FETONEAREST" I asked about it on devel to which dr Joel told that it is due to soft-float.<br>
> So I have added its test case but they won't work on emulators.<br>
><br>
There may be some emulator/simulator that simulates hard-float<br>
support. You may want to investigate a little bit. That would be<br>
helpful for testing purposes.<br></blockquote><div><br></div><div>Jim Wilson of SiFive and long time GCC maintainer told me that about the RISC-V</div><div>soft float. It is just the way it is. </div><div><br></div><div>If there is a way to know you have soft float, perhaps the libm header file could </div><div>do the right thing and not define the constants it doesn't support. That is the</div><div>contract on these methods. :)</div><div><br></div><div>I don't know what we can really do in our tests. </div><div><br></div><div>--joel </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
><br>
> thanks<br>
> -Eshan<br>
> On Sun, Mar 8, 2020 at 7:55 PM Gedare Bloom <<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>> wrote:<br>
>><br>
>> Hi Eshan,<br>
>><br>
>> This is looking good. Did you compile it? Execute it? How was the output?<br>
>><br>
>> On Sat, Mar 7, 2020 at 6:51 AM Eshan dhawan <<a href="mailto:eshandhawan51@gmail.com" target="_blank">eshandhawan51@gmail.com</a>> wrote:<br>
>> ><br>
>> > ---<br>
>> > testsuites/psxtests/psxfenv01/init.c | 89 ++++++++++++++++++++++------<br>
>> > 1 file changed, 71 insertions(+), 18 deletions(-)<br>
>> ><br>
>> > diff --git a/testsuites/psxtests/psxfenv01/init.c b/testsuites/psxtests/psxfenv01/init.c<br>
>> > index cdb0fa596e..6d71463465 100644<br>
>> > --- a/testsuites/psxtests/psxfenv01/init.c<br>
>> > +++ b/testsuites/psxtests/psxfenv01/init.c<br>
>> > @@ -46,11 +46,12 @@<br>
>> > #include <string.h><br>
>> > #include <rtems/test.h><br>
>> > #include <tmacros.h><br>
>> > +#include <float.h><br>
>> ><br>
>> > const char rtems_test_name[] = "PSXFENV 01";<br>
>> ><br>
>> > /* forward declarations to avoid warnings */<br>
>> > -rtems_task Init(rtems_task_argument ignored);<br>
>> > +rtems_task Init( rtems_task_argument ignored );<br>
>> ><br>
>> > /* Test Function Begins */<br>
>> > rtems_task Init(rtems_task_argument ignored)<br>
>> > @@ -62,28 +63,31 @@ rtems_task Init(rtems_task_argument ignored)<br>
>> ><br>
>> > /*<br>
>> > * 'FE_ALL_EXCEPT' will be defined only when 'feclearexcept()',<br>
>> > - * 'fegetexceptflag()', 'feraiseexcept()', 'fesetexceptflag()' and<br>
>> > - * 'fetestexcept()' functions are supported by the architecture.<br>
>> > + * fegetexceptflag() , feraiseexcept(), fesetexceptflag() and<br>
>> > + * fetestexcept() functions are supported by the architecture.<br>
>> > * Hence their testcases can be wrapped under #ifdef and #endif.<br>
>> > */<br>
>> > #ifdef FE_ALL_EXCEPT /* floating-point exceptions */<br>
>> > puts( "fesetenv(FE_DFL_ENV)." );<br>
>> > - r = fesetenv(FE_DFL_ENV);<br>
>> > - if (r)<br>
>> > + r = fesetenv ( FE_DFL_ENV );<br>
>> > + if ( r ) {<br>
>> > printf("fesetenv ==> %d\n", r);<br>
>> > - rtems_test_assert( r == 0 );<br>
>> > + }<br>
>> > + rtems_test_assert ( r == 0 );<br>
>> ><br>
>> > - /* Test 'feclearexcept()' and 'fetestexcept()' in one go. */<br>
>> > - puts( "feclearexcept(FE_ALL_EXCEPT)." );<br>
>> > - r = feclearexcept(FE_ALL_EXCEPT);<br>
>> > - if (r)<br>
>> > + /* Test feclearexcept() and fetestexcept() in one go. */<br>
>> > + puts( "feclearexcept(FE_ALL_EXCEPT)" );<br>
>> > + r = feclearexcept ( FE_ALL_EXCEPT );<br>
>> > + if ( r ) {<br>
>> > printf("feclearexcept ==> 0x%x\n", r);<br>
>> > - rtems_test_assert( r == 0 );<br>
>> > + }<br>
>> > + rtems_test_assert ( r == 0 );<br>
>> ><br>
>> > - r = fetestexcept( FE_ALL_EXCEPT );<br>
>> > - if (r)<br>
>> > + r = fetestexcept ( FE_ALL_EXCEPT );<br>
>> > + if ( r ) {<br>
>> > printf("fetestexcept ==> 0x%x\n", r);<br>
>> > - rtems_test_assert( r == 0 );<br>
>> > + }<br>
>> > + rtems_test_assert ( r == 0 );<br>
>> ><br>
>> > /* Test 'FE_DIVBYZERO' */<br>
>> > puts( "Divide by zero and confirm fetestexcept()" );<br>
>> > @@ -91,11 +95,60 @@ rtems_task Init(rtems_task_argument ignored)<br>
>> > b = 1.0;<br>
>> > c = b/a;<br>
>> > (void) c;<br>
>> > -<br>
>> > - fegetexceptflag(&excepts,FE_ALL_EXCEPT);<br>
>> > -<br>
>> > + /* Test fegetexceptflag() and fesetexceptflag() */<br>
>> > + r = fegetexceptflag ( &excepts, FE_ALL_EXCEPT );<br>
>> > + if ( r ) {<br>
>> > + printf("fegetexceptflag ==> 0x%x\n", r);<br>
>> > + }<br>
>> > + rtems_test_assert ( r == 0 );<br>
>> > +<br>
>> > + r = fesetexceptflag ( &excepts, FE_ALL_EXCEPT );<br>
>> > + if ( r ) {<br>
>> > + printf("fesetexceptflag ==> 0x%x\n", r);<br>
>> > + }<br>
>> > + rtems_test_assert ( r == 0 );<br>
>> > +<br>
>> > + /* Test for fegetround() and fesetround()<br>
>> > + * They have four main macros to be tested separated by ifdef<br>
>> > + * Since not all architectures support them<br>
>> > + * The test case gets and sets the rounding directions */<br>
>> > +#ifdef FE_TONEAREST<br>
>> > + rtems_test_assert ( fegetround() == FE_TONEAREST ) ;<br>
>> > +#endif<br>
>> > +#ifdef FE_TOWARDZERO<br>
>> > + r = fesetround ( FE_TOWARDZERO ) ;<br>
>> > + if ( r ) {<br>
>> > + printf("fesetround ==> 0x%x\n", r);<br>
>> > + }<br>
>> > + rtems_test_assert ( r == 0 ) ;<br>
>> > + rtems_test_assert ( fegetround() == FE_TOWARDZERO ) ;<br>
>> > +#endif<br>
>> > +#ifdef FE_DOWNWARD<br>
>> > + r = fesetround ( FE_DOWNWARD );<br>
>> > + if ( r ) {<br>
>> > + printf("fesetround ==> 0x%x\n", r);<br>
>> > + }<br>
>> > + rtems_test_assert ( r == 0 ) ;<br>
>> > + rtems_test_assert ( fegetround() == FE_DOWNWARD ) ;<br>
>> > +#endif<br>
>> > +#ifdef FE_UPWARD<br>
>> > + r = fesetround ( FE_UPWARD );<br>
>> > + if ( r ) {<br>
>> > + printf("fesetround ==> 0x%x\n", r);<br>
>> > + }<br>
>> > + rtems_test_assert ( r == 0 ) ;<br>
>> > + rtems_test_assert ( fegetround() == FE_UPWARD ) ;<br>
>> > +#endif<br>
>> > +#ifdef FE_TONEAREST<br>
>> > + r = fesetround ( FE_TONEAREST );<br>
>> > + if ( r ) {<br>
>> > + printf("fesetround ==> 0x%x\n", r);<br>
>> > + }<br>
>> > + rtems_test_assert ( r == 0 ) ;<br>
>> > +#endif<br>
>> > +<br>
>> > #ifdef FE_DIVBYZERO<br>
>> > - r = feraiseexcept(FE_DIVBYZERO);<br>
>> > + r = feraiseexcept ( FE_DIVBYZERO ) ;<br>
>> > rtems_test_assert( fetestexcept( FE_DIVBYZERO ) );<br>
>> > #endif<br>
>> ><br>
>> > --<br>
>> > 2.17.1<br>
>> ><br>
>> > _______________________________________________<br>
>> > devel mailing list<br>
>> > <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>> > <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div>