Skip to content

Commit

Permalink
[CodeGen] fix const-ness of builtin equivalents of <math.h> and <comp…
Browse files Browse the repository at this point in the history
…lex.h> functions that might set errno

This just makes const-ness of the builtins match const-ness of their lib function siblings. 
We're deferring fixing some of these that are obviously wrong to follow-up patches. 
Hopefully, the bugs are visible in the new test file (added at rL317220).

As the description in Builtins.def says: "e = const, but only when -fmath-errno=0".

This is step 2 of N to fix builtins and math calls as discussed in D39204.

Differential Revision: https://reviews.llvm.org/D39481

llvm-svn: 317265
  • Loading branch information
rotateright committed Nov 2, 2017
1 parent c542c3e commit c5c8207
Show file tree
Hide file tree
Showing 3 changed files with 260 additions and 262 deletions.
258 changes: 129 additions & 129 deletions clang/include/clang/Basic/Builtins.def
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,19 @@
#endif

// Standard libc/libm functions:
BUILTIN(__builtin_atan2 , "ddd" , "Fnc")
BUILTIN(__builtin_atan2f, "fff" , "Fnc")
BUILTIN(__builtin_atan2l, "LdLdLd", "Fnc")
BUILTIN(__builtin_atan2 , "ddd" , "Fne")
BUILTIN(__builtin_atan2f, "fff" , "Fne")
BUILTIN(__builtin_atan2l, "LdLdLd", "Fne")
BUILTIN(__builtin_abs , "ii" , "ncF")
BUILTIN(__builtin_copysign, "ddd", "ncF")
BUILTIN(__builtin_copysignf, "fff", "ncF")
BUILTIN(__builtin_copysignl, "LdLdLd", "ncF")
BUILTIN(__builtin_fabs , "dd" , "ncF")
BUILTIN(__builtin_fabsf, "ff" , "ncF")
BUILTIN(__builtin_fabsl, "LdLd", "ncF")
BUILTIN(__builtin_fmod , "ddd" , "Fnc")
BUILTIN(__builtin_fmodf, "fff" , "Fnc")
BUILTIN(__builtin_fmodl, "LdLdLd", "Fnc")
BUILTIN(__builtin_fmod , "ddd" , "Fne")
BUILTIN(__builtin_fmodf, "fff" , "Fne")
BUILTIN(__builtin_fmodl, "LdLdLd", "Fne")
BUILTIN(__builtin_frexp , "ddi*" , "Fn")
BUILTIN(__builtin_frexpf, "ffi*" , "Fn")
BUILTIN(__builtin_frexpl, "LdLdi*", "Fn")
Expand All @@ -127,9 +127,9 @@ BUILTIN(__builtin_inff , "f" , "nc")
BUILTIN(__builtin_infl , "Ld" , "nc")
BUILTIN(__builtin_labs , "LiLi" , "Fnc")
BUILTIN(__builtin_llabs, "LLiLLi", "Fnc")
BUILTIN(__builtin_ldexp , "ddi" , "Fnc")
BUILTIN(__builtin_ldexpf, "ffi" , "Fnc")
BUILTIN(__builtin_ldexpl, "LdLdi", "Fnc")
BUILTIN(__builtin_ldexp , "ddi" , "Fne")
BUILTIN(__builtin_ldexpf, "ffi" , "Fne")
BUILTIN(__builtin_ldexpl, "LdLdi", "Fne")
BUILTIN(__builtin_modf , "ddd*" , "Fn")
BUILTIN(__builtin_modff, "fff*" , "Fn")
BUILTIN(__builtin_modfl, "LdLdLd*", "Fn")
Expand All @@ -142,119 +142,119 @@ BUILTIN(__builtin_nansl, "LdcC*", "ncF")
BUILTIN(__builtin_powi , "ddi" , "Fnc")
BUILTIN(__builtin_powif, "ffi" , "Fnc")
BUILTIN(__builtin_powil, "LdLdi", "Fnc")
BUILTIN(__builtin_pow , "ddd" , "Fnc")
BUILTIN(__builtin_powf, "fff" , "Fnc")
BUILTIN(__builtin_powl, "LdLdLd", "Fnc")
BUILTIN(__builtin_pow , "ddd" , "Fne")
BUILTIN(__builtin_powf, "fff" , "Fne")
BUILTIN(__builtin_powl, "LdLdLd", "Fne")

// Standard unary libc/libm functions with double/float/long double variants:
BUILTIN(__builtin_acos , "dd" , "Fnc")
BUILTIN(__builtin_acosf, "ff" , "Fnc")
BUILTIN(__builtin_acosl, "LdLd", "Fnc")
BUILTIN(__builtin_acosh , "dd" , "Fnc")
BUILTIN(__builtin_acoshf, "ff" , "Fnc")
BUILTIN(__builtin_acoshl, "LdLd", "Fnc")
BUILTIN(__builtin_asin , "dd" , "Fnc")
BUILTIN(__builtin_asinf, "ff" , "Fnc")
BUILTIN(__builtin_asinl, "LdLd", "Fnc")
BUILTIN(__builtin_asinh , "dd" , "Fnc")
BUILTIN(__builtin_asinhf, "ff" , "Fnc")
BUILTIN(__builtin_asinhl, "LdLd", "Fnc")
BUILTIN(__builtin_atan , "dd" , "Fnc")
BUILTIN(__builtin_atanf, "ff" , "Fnc")
BUILTIN(__builtin_atanl, "LdLd", "Fnc")
BUILTIN(__builtin_atanh , "dd", "Fnc")
BUILTIN(__builtin_atanhf, "ff", "Fnc")
BUILTIN(__builtin_atanhl, "LdLd", "Fnc")
BUILTIN(__builtin_cbrt , "dd", "Fnc")
BUILTIN(__builtin_cbrtf, "ff", "Fnc")
BUILTIN(__builtin_cbrtl, "LdLd", "Fnc")
BUILTIN(__builtin_acos , "dd" , "Fne")
BUILTIN(__builtin_acosf, "ff" , "Fne")
BUILTIN(__builtin_acosl, "LdLd", "Fne")
BUILTIN(__builtin_acosh , "dd" , "Fne")
BUILTIN(__builtin_acoshf, "ff" , "Fne")
BUILTIN(__builtin_acoshl, "LdLd", "Fne")
BUILTIN(__builtin_asin , "dd" , "Fne")
BUILTIN(__builtin_asinf, "ff" , "Fne")
BUILTIN(__builtin_asinl, "LdLd", "Fne")
BUILTIN(__builtin_asinh , "dd" , "Fne")
BUILTIN(__builtin_asinhf, "ff" , "Fne")
BUILTIN(__builtin_asinhl, "LdLd", "Fne")
BUILTIN(__builtin_atan , "dd" , "Fne")
BUILTIN(__builtin_atanf, "ff" , "Fne")
BUILTIN(__builtin_atanl, "LdLd", "Fne")
BUILTIN(__builtin_atanh , "dd", "Fne")
BUILTIN(__builtin_atanhf, "ff", "Fne")
BUILTIN(__builtin_atanhl, "LdLd", "Fne")
BUILTIN(__builtin_cbrt , "dd", "Fne")
BUILTIN(__builtin_cbrtf, "ff", "Fne")
BUILTIN(__builtin_cbrtl, "LdLd", "Fne")
BUILTIN(__builtin_ceil , "dd" , "Fnc")
BUILTIN(__builtin_ceilf, "ff" , "Fnc")
BUILTIN(__builtin_ceill, "LdLd", "Fnc")
BUILTIN(__builtin_cos , "dd" , "Fnc")
BUILTIN(__builtin_cosf, "ff" , "Fnc")
BUILTIN(__builtin_cosh , "dd" , "Fnc")
BUILTIN(__builtin_coshf, "ff" , "Fnc")
BUILTIN(__builtin_coshl, "LdLd", "Fnc")
BUILTIN(__builtin_cosl, "LdLd", "Fnc")
BUILTIN(__builtin_erf , "dd", "Fnc")
BUILTIN(__builtin_erff, "ff", "Fnc")
BUILTIN(__builtin_erfl, "LdLd", "Fnc")
BUILTIN(__builtin_erfc , "dd", "Fnc")
BUILTIN(__builtin_erfcf, "ff", "Fnc")
BUILTIN(__builtin_erfcl, "LdLd", "Fnc")
BUILTIN(__builtin_exp , "dd" , "Fnc")
BUILTIN(__builtin_expf, "ff" , "Fnc")
BUILTIN(__builtin_expl, "LdLd", "Fnc")
BUILTIN(__builtin_exp2 , "dd" , "Fnc")
BUILTIN(__builtin_exp2f, "ff" , "Fnc")
BUILTIN(__builtin_exp2l, "LdLd", "Fnc")
BUILTIN(__builtin_expm1 , "dd", "Fnc")
BUILTIN(__builtin_expm1f, "ff", "Fnc")
BUILTIN(__builtin_expm1l, "LdLd", "Fnc")
BUILTIN(__builtin_fdim, "ddd", "Fnc")
BUILTIN(__builtin_fdimf, "fff", "Fnc")
BUILTIN(__builtin_fdiml, "LdLdLd", "Fnc")
BUILTIN(__builtin_cos , "dd" , "Fne")
BUILTIN(__builtin_cosf, "ff" , "Fne")
BUILTIN(__builtin_cosh , "dd" , "Fne")
BUILTIN(__builtin_coshf, "ff" , "Fne")
BUILTIN(__builtin_coshl, "LdLd", "Fne")
BUILTIN(__builtin_cosl, "LdLd", "Fne")
BUILTIN(__builtin_erf , "dd", "Fne")
BUILTIN(__builtin_erff, "ff", "Fne")
BUILTIN(__builtin_erfl, "LdLd", "Fne")
BUILTIN(__builtin_erfc , "dd", "Fne")
BUILTIN(__builtin_erfcf, "ff", "Fne")
BUILTIN(__builtin_erfcl, "LdLd", "Fne")
BUILTIN(__builtin_exp , "dd" , "Fne")
BUILTIN(__builtin_expf, "ff" , "Fne")
BUILTIN(__builtin_expl, "LdLd", "Fne")
BUILTIN(__builtin_exp2 , "dd" , "Fne")
BUILTIN(__builtin_exp2f, "ff" , "Fne")
BUILTIN(__builtin_exp2l, "LdLd", "Fne")
BUILTIN(__builtin_expm1 , "dd", "Fne")
BUILTIN(__builtin_expm1f, "ff", "Fne")
BUILTIN(__builtin_expm1l, "LdLd", "Fne")
BUILTIN(__builtin_fdim, "ddd", "Fne")
BUILTIN(__builtin_fdimf, "fff", "Fne")
BUILTIN(__builtin_fdiml, "LdLdLd", "Fne")
BUILTIN(__builtin_floor , "dd" , "Fnc")
BUILTIN(__builtin_floorf, "ff" , "Fnc")
BUILTIN(__builtin_floorl, "LdLd", "Fnc")
BUILTIN(__builtin_fma, "dddd", "Fnc")
BUILTIN(__builtin_fmaf, "ffff", "Fnc")
BUILTIN(__builtin_fmal, "LdLdLdLd", "Fnc")
BUILTIN(__builtin_fma, "dddd", "Fne")
BUILTIN(__builtin_fmaf, "ffff", "Fne")
BUILTIN(__builtin_fmal, "LdLdLdLd", "Fne")
BUILTIN(__builtin_fmax, "ddd", "Fnc")
BUILTIN(__builtin_fmaxf, "fff", "Fnc")
BUILTIN(__builtin_fmaxl, "LdLdLd", "Fnc")
BUILTIN(__builtin_fmin, "ddd", "Fnc")
BUILTIN(__builtin_fminf, "fff", "Fnc")
BUILTIN(__builtin_fminl, "LdLdLd", "Fnc")
BUILTIN(__builtin_hypot , "ddd" , "Fnc")
BUILTIN(__builtin_hypotf, "fff" , "Fnc")
BUILTIN(__builtin_hypotl, "LdLdLd", "Fnc")
BUILTIN(__builtin_ilogb , "id", "Fnc")
BUILTIN(__builtin_ilogbf, "if", "Fnc")
BUILTIN(__builtin_ilogbl, "iLd", "Fnc")
BUILTIN(__builtin_lgamma , "dd", "Fnc")
BUILTIN(__builtin_lgammaf, "ff", "Fnc")
BUILTIN(__builtin_lgammal, "LdLd", "Fnc")
BUILTIN(__builtin_llrint, "LLid", "Fnc")
BUILTIN(__builtin_llrintf, "LLif", "Fnc")
BUILTIN(__builtin_llrintl, "LLiLd", "Fnc")
BUILTIN(__builtin_llround , "LLid", "Fnc")
BUILTIN(__builtin_llroundf, "LLif", "Fnc")
BUILTIN(__builtin_llroundl, "LLiLd", "Fnc")
BUILTIN(__builtin_log , "dd" , "Fnc")
BUILTIN(__builtin_log10 , "dd" , "Fnc")
BUILTIN(__builtin_log10f, "ff" , "Fnc")
BUILTIN(__builtin_log10l, "LdLd", "Fnc")
BUILTIN(__builtin_log1p , "dd" , "Fnc")
BUILTIN(__builtin_log1pf, "ff" , "Fnc")
BUILTIN(__builtin_log1pl, "LdLd", "Fnc")
BUILTIN(__builtin_log2, "dd" , "Fnc")
BUILTIN(__builtin_log2f, "ff" , "Fnc")
BUILTIN(__builtin_log2l, "LdLd" , "Fnc")
BUILTIN(__builtin_logb , "dd", "Fnc")
BUILTIN(__builtin_logbf, "ff", "Fnc")
BUILTIN(__builtin_logbl, "LdLd", "Fnc")
BUILTIN(__builtin_logf, "ff" , "Fnc")
BUILTIN(__builtin_logl, "LdLd", "Fnc")
BUILTIN(__builtin_lrint , "Lid", "Fnc")
BUILTIN(__builtin_lrintf, "Lif", "Fnc")
BUILTIN(__builtin_lrintl, "LiLd", "Fnc")
BUILTIN(__builtin_lround , "Lid", "Fnc")
BUILTIN(__builtin_lroundf, "Lif", "Fnc")
BUILTIN(__builtin_lroundl, "LiLd", "Fnc")
BUILTIN(__builtin_hypot , "ddd" , "Fne")
BUILTIN(__builtin_hypotf, "fff" , "Fne")
BUILTIN(__builtin_hypotl, "LdLdLd", "Fne")
BUILTIN(__builtin_ilogb , "id", "Fne")
BUILTIN(__builtin_ilogbf, "if", "Fne")
BUILTIN(__builtin_ilogbl, "iLd", "Fne")
BUILTIN(__builtin_lgamma , "dd", "Fn")
BUILTIN(__builtin_lgammaf, "ff", "Fn")
BUILTIN(__builtin_lgammal, "LdLd", "Fn")
BUILTIN(__builtin_llrint, "LLid", "Fne")
BUILTIN(__builtin_llrintf, "LLif", "Fne")
BUILTIN(__builtin_llrintl, "LLiLd", "Fne")
BUILTIN(__builtin_llround , "LLid", "Fne")
BUILTIN(__builtin_llroundf, "LLif", "Fne")
BUILTIN(__builtin_llroundl, "LLiLd", "Fne")
BUILTIN(__builtin_log , "dd" , "Fne")
BUILTIN(__builtin_log10 , "dd" , "Fne")
BUILTIN(__builtin_log10f, "ff" , "Fne")
BUILTIN(__builtin_log10l, "LdLd", "Fne")
BUILTIN(__builtin_log1p , "dd" , "Fne")
BUILTIN(__builtin_log1pf, "ff" , "Fne")
BUILTIN(__builtin_log1pl, "LdLd", "Fne")
BUILTIN(__builtin_log2, "dd" , "Fne")
BUILTIN(__builtin_log2f, "ff" , "Fne")
BUILTIN(__builtin_log2l, "LdLd" , "Fne")
BUILTIN(__builtin_logb , "dd", "Fne")
BUILTIN(__builtin_logbf, "ff", "Fne")
BUILTIN(__builtin_logbl, "LdLd", "Fne")
BUILTIN(__builtin_logf, "ff" , "Fne")
BUILTIN(__builtin_logl, "LdLd", "Fne")
BUILTIN(__builtin_lrint , "Lid", "Fne")
BUILTIN(__builtin_lrintf, "Lif", "Fne")
BUILTIN(__builtin_lrintl, "LiLd", "Fne")
BUILTIN(__builtin_lround , "Lid", "Fne")
BUILTIN(__builtin_lroundf, "Lif", "Fne")
BUILTIN(__builtin_lroundl, "LiLd", "Fne")
BUILTIN(__builtin_nearbyint , "dd", "Fnc")
BUILTIN(__builtin_nearbyintf, "ff", "Fnc")
BUILTIN(__builtin_nearbyintl, "LdLd", "Fnc")
BUILTIN(__builtin_nextafter , "ddd", "Fnc")
BUILTIN(__builtin_nextafterf, "fff", "Fnc")
BUILTIN(__builtin_nextafterl, "LdLdLd", "Fnc")
BUILTIN(__builtin_nexttoward , "ddLd", "Fnc")
BUILTIN(__builtin_nexttowardf, "ffLd", "Fnc")
BUILTIN(__builtin_nexttowardl, "LdLdLd", "Fnc")
BUILTIN(__builtin_remainder , "ddd", "Fnc")
BUILTIN(__builtin_remainderf, "fff", "Fnc")
BUILTIN(__builtin_remainderl, "LdLdLd", "Fnc")
BUILTIN(__builtin_nextafter , "ddd", "Fne")
BUILTIN(__builtin_nextafterf, "fff", "Fne")
BUILTIN(__builtin_nextafterl, "LdLdLd", "Fne")
BUILTIN(__builtin_nexttoward , "ddLd", "Fne")
BUILTIN(__builtin_nexttowardf, "ffLd", "Fne")
BUILTIN(__builtin_nexttowardl, "LdLdLd", "Fne")
BUILTIN(__builtin_remainder , "ddd", "Fne")
BUILTIN(__builtin_remainderf, "fff", "Fne")
BUILTIN(__builtin_remainderl, "LdLdLd", "Fne")
BUILTIN(__builtin_remquo , "dddi*", "Fn")
BUILTIN(__builtin_remquof, "fffi*", "Fn")
BUILTIN(__builtin_remquol, "LdLdLdi*", "Fn")
Expand All @@ -264,30 +264,30 @@ BUILTIN(__builtin_rintl, "LdLd", "Fnc")
BUILTIN(__builtin_round, "dd" , "Fnc")
BUILTIN(__builtin_roundf, "ff" , "Fnc")
BUILTIN(__builtin_roundl, "LdLd" , "Fnc")
BUILTIN(__builtin_scalbln , "ddLi", "Fnc")
BUILTIN(__builtin_scalblnf, "ffLi", "Fnc")
BUILTIN(__builtin_scalblnl, "LdLdLi", "Fnc")
BUILTIN(__builtin_scalbn , "ddi", "Fnc")
BUILTIN(__builtin_scalbnf, "ffi", "Fnc")
BUILTIN(__builtin_scalbnl, "LdLdi", "Fnc")
BUILTIN(__builtin_sin , "dd" , "Fnc")
BUILTIN(__builtin_sinf, "ff" , "Fnc")
BUILTIN(__builtin_sinh , "dd" , "Fnc")
BUILTIN(__builtin_sinhf, "ff" , "Fnc")
BUILTIN(__builtin_sinhl, "LdLd", "Fnc")
BUILTIN(__builtin_sinl, "LdLd", "Fnc")
BUILTIN(__builtin_sqrt , "dd" , "Fnc")
BUILTIN(__builtin_sqrtf, "ff" , "Fnc")
BUILTIN(__builtin_sqrtl, "LdLd", "Fnc")
BUILTIN(__builtin_tan , "dd" , "Fnc")
BUILTIN(__builtin_tanf, "ff" , "Fnc")
BUILTIN(__builtin_tanh , "dd" , "Fnc")
BUILTIN(__builtin_tanhf, "ff" , "Fnc")
BUILTIN(__builtin_tanhl, "LdLd", "Fnc")
BUILTIN(__builtin_tanl, "LdLd", "Fnc")
BUILTIN(__builtin_tgamma , "dd", "Fnc")
BUILTIN(__builtin_tgammaf, "ff", "Fnc")
BUILTIN(__builtin_tgammal, "LdLd", "Fnc")
BUILTIN(__builtin_scalbln , "ddLi", "Fne")
BUILTIN(__builtin_scalblnf, "ffLi", "Fne")
BUILTIN(__builtin_scalblnl, "LdLdLi", "Fne")
BUILTIN(__builtin_scalbn , "ddi", "Fne")
BUILTIN(__builtin_scalbnf, "ffi", "Fne")
BUILTIN(__builtin_scalbnl, "LdLdi", "Fne")
BUILTIN(__builtin_sin , "dd" , "Fne")
BUILTIN(__builtin_sinf, "ff" , "Fne")
BUILTIN(__builtin_sinh , "dd" , "Fne")
BUILTIN(__builtin_sinhf, "ff" , "Fne")
BUILTIN(__builtin_sinhl, "LdLd", "Fne")
BUILTIN(__builtin_sinl, "LdLd", "Fne")
BUILTIN(__builtin_sqrt , "dd" , "Fne")
BUILTIN(__builtin_sqrtf, "ff" , "Fne")
BUILTIN(__builtin_sqrtl, "LdLd", "Fne")
BUILTIN(__builtin_tan , "dd" , "Fne")
BUILTIN(__builtin_tanf, "ff" , "Fne")
BUILTIN(__builtin_tanh , "dd" , "Fne")
BUILTIN(__builtin_tanhf, "ff" , "Fne")
BUILTIN(__builtin_tanhl, "LdLd", "Fne")
BUILTIN(__builtin_tanl, "LdLd", "Fne")
BUILTIN(__builtin_tgamma , "dd", "Fne")
BUILTIN(__builtin_tgammaf, "ff", "Fne")
BUILTIN(__builtin_tgammal, "LdLd", "Fne")
BUILTIN(__builtin_trunc , "dd", "Fnc")
BUILTIN(__builtin_truncf, "ff", "Fnc")
BUILTIN(__builtin_truncl, "LdLd", "Fnc")
Expand Down
Loading

0 comments on commit c5c8207

Please sign in to comment.