wandboard / imx6 hard float

Ian Lepore ian at FreeBSD.org
Fri Feb 28 03:23:51 UTC 2014


After some testing last week I determined that hard float works on imx6,
so I enabled it (added option VFP) in the kernel configs.  To check
whether it's enabled, see if "sysctl hw.floatingpoint" is set to 1.

To actually use the hardware floating point you have to add some options
to CFLAGS:

      * For clang CFLAGS="-mfloat-abi=softfp"
      * For gcc   CFLAGS="-mfloat-abi=softfp -mfpu=vfp"
      * You can do that on the make command line, in the environment, or
        in /etc/make.conf.

I think the implication of float-abi=softfp is that floating point
arguments are passed in integer registers, and we're losing some
performance with that.  But as I vaguely understand it, we're still
missing some piece of support code to enable full eabihf.  Maybe
somebody who knows the status of that can fill in my hand-wavy blanks.

Hardware floating point makes a huge performance difference in apps that
use floating point.  Using the venerable benchmarks/flops program from
ports, here's the results on my Wandboard quad running @ 984 MHz...

-------------------------------------------------------
   FLOPS C Program (Double Precision), V2.0 18 Dec 1992

   Module     Error        RunTime      MFLOPS
                            (usec)
     1     -1.5632e-13      3.0377      4.6087
     2     -1.0347e-13      1.8709      3.7416
     3     -3.1197e-14      3.1652      5.3709
     4      7.7938e-14      2.7834      5.3890
     5     -3.2641e-14      6.2713      4.6243
     6     -9.9920e-16      5.4799      5.2920
     7     -5.5650e-11      4.0721      2.9469
     8      2.7700e-14      5.7273      5.2381

   Iterations      =    8000000
   NullTime (usec) =     0.0000
   MFLOPS(1)       =     4.1535
   MFLOPS(2)       =     4.1052
   MFLOPS(3)       =     4.7811
   MFLOPS(4)       =     5.3043

-------------------------------------------------------
   FLOPS C Program (Double Precision), V2.0 18 Dec 1992

   Module     Error        RunTime      MFLOPS
                            (usec)
     1     -7.6739e-13      0.1058    132.2879
     2     -5.7021e-13      0.0621    112.7249
     3     -2.4314e-14      0.0967    175.8202
     4      6.8501e-14      0.0875    171.3418
     5     -1.6320e-14      0.1924    150.7668
     6      1.3961e-13      0.1730    167.6504
     7     -3.6152e-11      0.1160    103.4433
     8      9.0483e-15      0.1771    169.3994

   Iterations      =  256000000
   NullTime (usec) =     0.0081
   MFLOPS(1)       =   127.7076
   MFLOPS(2)       =   135.7852
   MFLOPS(3)       =   153.9281
   MFLOPS(4)       =   170.3133

------------------------------------------------------

-- Ian




More information about the freebsd-arm mailing list