[cfe-dev] Floating-point traps on x86-64
Vlad Tsyrklevich via cfe-dev
cfe-dev at lists.llvm.org
Thu Mar 7 10:44:24 PST 2019
Unfortunately the LLVM x86 backend has at least one bug that causes FPU
exceptions on valid FP operations that I know of:
https://bugs.llvm.org/show_bug.cgi?id=30885. You can work around that bug
by using -march=haswell, if you continue to hit other exceptions you can
file LLVM bugs against them, though I'm not sure if there is anyone
actively interested in fixing them. Good luck.
On Thu, Mar 7, 2019 at 4:38 AM Dallman, John via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> I produce a mathematical modelling library on several platforms, including
> iOS, macOS and Android, all of which use Clang. On x86-based platforms, the
> hardware can generate floating-point traps. I prefer to run testing with
> traps for Invalid Operation, Divide-by-Zero and Overflow active, since that
> finds me problem sites more quickly than working backwards from “this test
> case failed.”
>
>
>
> However, I had a problem with Apple Clang 8.x, which I believe was LLVM
> 3.9, targeting x86-64, in that the optimiser was assuming that
> floating-point traps were turned off. This was shown, for example, by the
> way it hoisted floating-point divides above tests of the divisor that were
> meant to safeguard the divides.
>
>
>
> After a long support case with Apple, they gave me some Clang command-line
> options for LLVM that suppressed the problem:
>
>
>
> -mllvm -speculate-one-expensive-inst=false
>
> -mllvm -bonus-inst-threshold=0
>
>
>
> I appreciate that this costs some performance, and I can accept that.
> These options worked fine for Apple Clang 9.x, whose various versions seem
> to have been based on LLVM 4.x and 5.x.
>
>
>
> Now I’ve come to Apple Clang 10.0, which seems to be based on LLVM 6.0.1,
> and I have lots of floating-point traps again in optimised x86-64 code. It
> seems possible that I need some further LLVM options: does this seem
> plausible?
>
>
>
> I’m not familiar with the LLVM codebase, and while I can find the source
> files that list the options I can use with -mllvm, I’d be guessing at which
> options are worth trying. Can anyone make suggestions?
>
>
>
> Thanks very much,
>
>
>
> --
>
> John Dallman
>
> -----------------
> Siemens Industry Software Limited is a limited company registered in
> England and Wales.
> Registered number: 3476850.
> Registered office: Faraday House, Sir William Siemens Square, Frimley,
> Surrey, GU16 8QD.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190307/63dbf3c0/attachment.html>
More information about the cfe-dev
mailing list