[cfe-dev] clang does not use sincos with -O2 but gcc does

Craig Topper via cfe-dev cfe-dev at lists.llvm.org
Thu May 18 09:23:10 PDT 2017


A couple months ago, I filed this bug against gcc not recognizing that
sincos sets errno.  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80042

The x86 backend will use the fsincos instruction if both sin and cos are
used in code and sse is disabled. I think this is independent of whether
sincos function is used.

~Craig

On Thu, May 18, 2017 at 8:29 AM, Stephen Canon via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> On May 18, 2017, at 10:20 AM, René J.V. Bertin via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>
> To make matters even more complex: on Mac the situation is the opposite,
> that is clang always uses a sincos library function provided by Apple.
>
>
> Right; Apple’s libm does not ever set `errno`, and defines
> math_errhandling to MATH_ERREXCEPT, so we don’t need to worry about `errno`
> on Apple platforms; further our `sincos` produces the same result as
> separate calls to `sin` and `cos` do, so this transform never perturbs
> observable results.
>
> – Steve
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://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/20170518/faf40976/attachment.html>


More information about the cfe-dev mailing list