[Pixman] [PATCH] [v3] test: add a check for FE_DIVBYZERO

Marek Vasut marex at denx.de
Sat Sep 19 16:33:00 PDT 2015


On Sunday, September 20, 2015 at 01:22:25 AM, Siarhei Siamashka wrote:
> On Thu, 17 Sep 2015 15:43:27 +0200

Hi!

> Marek Vasut <marex at denx.de> wrote:
> > From: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
> > 
> > Some architectures, such as Microblaze and Nios2, currently do not
> > implement FE_DIVBYZERO, even though they have <fenv.h> and
> > feenableexcept(). This commit adds a configure.ac check to verify
> > whether FE_DIVBYZERO is defined or not, and if not, disables the
> > problematic code in test/utils.c.
> > 
> > Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
> > Signed-off-by: Marek Vasut <marex at denx.de>
> > 
> > ---
> > 
> > Changes v1 -> v2:
> >  * Use the ac_cv_have_decl_FE_DIVBYZERO variable, which is
> >  
> >    automatically set by AC_CHECK_DECL, to decide whether or not
> >    HAVE_FEDIVBYZERO should be defined.
> > 
> > Changes v2 -> v3:
> >  * Use action-if-yes of AC_CHECK_DECL as suggested in
> >  
> >    http://lists.freedesktop.org/archives/pixman/2014-February/003176.html
> > 
> > ---
> > 
> >  configure.ac | 5 +++++
> >  test/utils.c | 2 ++
> >  2 files changed, 7 insertions(+)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index f93cc30..424bfd3 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -891,6 +891,11 @@ if test x$have_feenableexcept = xyes; then
> > 
> >     AC_DEFINE(HAVE_FEENABLEEXCEPT, 1, [Whether we have feenableexcept()])
> >  
> >  fi
> > 
> > +AC_CHECK_DECL([FE_DIVBYZERO],
> > +	[AC_DEFINE(HAVE_FEDIVBYZERO, 1, [Whether we have FE_DIVBYZERO])],
> > +	[],
> > +	[[#include <fenv.h>]])
> > +
> > 
> >  AC_CHECK_FUNC(gettimeofday, have_gettimeofday=yes, have_gettimeofday=no)
> >  AC_CHECK_HEADER(sys/time.h, have_sys_time_h=yes, have_sys_time_h=no)
> >  if test x$have_gettimeofday = xyes && test x$have_sys_time_h = xyes;
> >  then
> > 
> > diff --git a/test/utils.c b/test/utils.c
> > index 222d4d5..8657966 100644
> > --- a/test/utils.c
> > +++ b/test/utils.c
> > @@ -966,9 +966,11 @@ enable_divbyzero_exceptions (void)
> > 
> >  {
> >  #ifdef HAVE_FENV_H
> >  #ifdef HAVE_FEENABLEEXCEPT
> > 
> > +#ifdef HAVE_FEDIVBYZERO
> > 
> >      feenableexcept (FE_DIVBYZERO);
> > 
> > +#endif
> > 
> >  #endif
> >  #endif
> >  }
> >  
> >  void
> 
> Thanks for the patch:
> Acked-by: Siarhei Siamashka <siarhei.siamashka at gmail.com>
> 
> If it is not a big secret, how is pixman used on these Microblaze
> and Nios2 architectures in practice?

Dunno about the microblaze, but I didn't get as far as testing the
pixman on nios2 yet. I only noticed Yocto/Poky fails compiling the
pixman, found the original patch by Thomas, fixed it and resubmitted.

I'll have to cook some display core into the FPGA soon and try getting
X11 running on it :-) Thus far, I only got as far as booting Linux on
the nios2 and got all the way to shell, but still without X11. And let
me make this clear, my nios2/f (F means Fast :-) ) runs at 50 MHz and
it is bloody slow.

> Is it doing any performance
> critical job? We obviously don't have any assembly optimizations for
> Microblaze and Nios2 yet. As for the generic C code in pixman, it
> could be improved in some places too.
> 
> Also just in case, does pixman successfully pass the "make check"
> test on these architectures? In practice, it is more of a stress for
> the C compiler than for the pixman code itself. Running this test on
> real hardware can be very slow, so it may be preferable to run it in
> QEMU (thus testing QEMU too). I had an old wiki page describing how
> to do this for MIPS:
>     https://github.com/ssvb/QEMU/wiki/MIPS

That's a good point, once I get me some beefier hardware (probably the
Altera MAX10 DevKit) which actually does have some sort of storage from
which I can boot, I will have to test this.

> Running the full pixman test suite used to take more than 30 hours
> on my Asus RT N16 router (MIPS74K 480MHz) the last time I checked it.

Aha, I suspect that on nios2, this would be closer to a fortnight then.

> It was so slow primarily because of the missing FPU, and I had floating
> point instructions trapped and emulated by the kernel (the rootfs was
> not softfloat). The time is reduced to only half an hour when the
> pixman test suite is run emulated by QEMU on my Intel Core i7 desktop
> machine :-)

Lovely, this looks like something to look forward to :-)


More information about the Pixman mailing list