[MLton] Re: MLton codegen combines divison on arm

Adam Goode adam at spicenitz.org
Sat Nov 13 19:36:34 PST 2010


On 11/13/2010 08:05 AM, Wesley W. Terpstra wrote:
> On Sat, Nov 13, 2010 at 1:27 PM, Adam Goode <adam at spicenitz.org> wrote:
>> On 11/11/2010 10:49 AM, Wesley W. Terpstra wrote:
>>> On Thu, Nov 11, 2010 at 3:15 PM, Matthew Fluet <matthew.fluet at gmail.com> wrote:
>>>> Were you able to declare success with the ARM floating-point rounding?
>>> What needs to be done IMO is to turn on the rounding mode support in
>>> libgcc. It's absurd that something as simple as wiring it to a public
>>> symbol is considered a roadblock to fixing this problem. I don't have
>>> the time or energy needed to try and push a change like this through
>>> the sorts of people who gather around libc development.
>>>
>>
>> It is not this simple.
>> If you are using software floating point, then, at a start, you need to hack these files:
> 
> I did say there is some assembler code that doesn't support rounding
> modes which is used in some configurations. However, there is also a
> nice C library in libgcc which DOES support rounding modes. Where that
> is enabled, it IS as simple as exporting a symbol that can control the
> rounding mode.
> 
> I suppose there are people who prefer performance over correctness,
> and these people may prefer the assembler emulation to the C
> emulation. Since both are broken at the moment, I guess there is no
> downside to the assembler variant. If the C variant were fixed, in my
> opinion correctness should trump speed with default compile options.

Well, it isn't really a simple matter to change these things as you've
found. These kinds of decisions are really system-wide and ABI-changing.
And the standard ARM ABI doesn't require rounding modes.

Specifically, switching gcc to emit the soft-fp code (the C version you
mention) into libgcc instead of the ARM assembly version would be a big
change and not well tested. According to gcc/gcc/config/arm/t-elf-arm,
the asm version is used everywhere on ARM except for ARMv6M which uses
soft-fp. After hacking around with GCC, you would then need to recompile
your OS, since libgcc is statically linked on ARM by default.

At that point, you might as well only compile for the newer ARMv7-A
processors and just do something like:
http://wiki.debian.org/ArmHardFloatPort

By the way, this shouldn't be silently failing for you since I made this
change:
http://mlton.org/cgi-bin/viewsvn.cgi?rev=7082&view=rev

... unless of course you are running on a system that actually has
hardware VFP and then you are hitting the glibc bug that will happily
set the rounding mode of the hardware even if your floating point is all
in software.


Adam

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
Url : http://mlton.org/pipermail/mlton/attachments/20101113/6d1b356c/signature.pgp


More information about the MLton mailing list