[llvm-dev] Weird behavior in LLVM regarding _finite math

Jinsong Ji via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 20 11:47:14 PDT 2020


Hi Masoud:

This is because the math.h in your system still has __FINITE_MATH_ONLY__
support.

-Ofast in clang will set macro `__FINITE_MATH_ONLY__` to 1,  so it will
preprocess your code,
and go into finite math path, which will do the renaming using __asm.

extern double log (double) __asm__ ("" "__log_finite") __attribute__
((__nothrow__ ));


This is expected. If you don't want it, you can use -fno-finite-math-only..

Or you can use newer version of glibc (hence no finite path in math.h at
all).



Best,

Jinsong Ji (纪金松), PhD.

XL/LLVM on Power Compiler Development
E-mail: jji at us.ibm.com



From:	Masoud Ataei via llvm-dev <llvm-dev at lists.llvm.org>
To:	llvm-dev <llvm-dev at lists.llvm.org>
Date:	07/20/2020 02:09 PM
Subject:	[EXTERNAL] [llvm-dev]  Weird behavior in LLVM regarding _finite
            math
Sent by:	"llvm-dev" <llvm-dev-bounces at lists.llvm.org>



Hi,

It seems _finite math is gone for LLVM right now (
https://reviews.llvm.org/D74712) but there are still trace of it here:
$ cat a1.c
#include <math.h>
double log(double x){
  return x;
}
$ cat a2.c
#include <math.h>
double mylog(double x){
  return log(x);
}
Let compile both with -Ofast. We won't see `__log_finite` in the `a2.s` but
we will see the function name in `a1.s` is changed to `__log_finite`. Is it
expected?

_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwIGaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=DvnnfavFQBGT2CDyHzTr_Q&m=zbduThVBp2RBmW4EQRb7kCGLYfVTYOjyl1u6cf_5nhE&s=BtIKdA2kQhOZKxos8S1bu3mThP2qJ1CzbVC6_ZWKjcU&e=



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200720/b5b7d8f0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200720/b5b7d8f0/attachment.gif>


More information about the llvm-dev mailing list