[Openmcl-devel] ARM hard-float

Gary Byers gb at clozure.com
Sat Oct 23 19:44:06 PDT 2010

The version of Ubuntu that ships on the Efika uses "soft-float" calling

This means that C functions that accept FP arguments or return FP results
accept those arguments and return those results in general-purpose registers.

That convention works regardless of whether or not an FPU is available and
regardless of whether or not the C function is compiled to use that FPU.

On systems that target the ARMv7 and use soft-float conventions, the C

double dsum(double x, double y)
   return x+y;

compiles into something like:

  (set-double-float-register d0 r0 r1)   ; x is passed in GPRs r0 & r1 [*]
  (set-double-float-register d1 r2 r3)   ; y is passed in GPRs r2 & r3 [*]
  (add-double-float d0 d0 d1)            ; d0 := d0 + d1
  (load-gprs-from-double-float r0 r1 d0) ; return sum in r0 & r1       [*]

If it was compiled to use hard-float conventions, then the arguments would
have been passed in d0 and d1, the sum returned in d0, and the instructions
marked with [*] (and any similar stuff in the caller) wouldn't have been

In this example, the extra work to transfer FP values to GPRs is
significant; in something that was more computationally expensive than
a single FADDD, it's probably not very significant.  For C code that's
very FP- and function-call-intensive, the improvement's probably measurable
and good but probably not overwhelmingly so.

The two conventions (soft- and hard-float) can't be easily mixed; the
rationale for using soft-float these days probably has more to do with
preserving binary compatibility than it does with supporting FPU-less
hardware.  (GCC support for hard-float conventions may also have
something to do with that; AFAIK, all ARM-based hardware that Apple
sells could support hard-float, but Apple's toolchain doesn't.)

The differences in CCL's FFI are pretty small and pretty well
localized.  Actually supporting hard-float conventions -probably-
means that we'd need to consider "linuxarm[-soft-float]" and
"linuxarm-hard-float" to be different platforms (with their own
incompatible FASL files/images/kernels), even though the differences
between those platforms are extremely minor.

It's reasonable to assume that more distributions (especially those
that already require "modern" ARM cores) will switch to the hard-float
ABI at some point, but it's also reasonable to assume that that transition
may be somewhat painful.

(It's also reasonable to assume that FPU-less ARMs will continue to be
sold and widely used.)

On Sat, 23 Oct 2010, Far?wrote:

> Dear CCL developers,
> some Efika MX pages suggest that one might use a debian or gentoo
> installation compiled with the arm hardware floating point variant of
> the ABI, but I suppose that CCL ARM is not compatible with this
> variant of the ABI - or is it?
> [ Fran?is-Ren??B Rideau | Reflection&Cybernethics | http://fare.tunes.org ]
> Law is always law of the strongest. The only question is what feedback
> mechanism selects this strongest and controls his behavior.
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel

More information about the Openmcl-devel mailing list