Commit 98ff7c4d by Kaveh R. Ghazi Committed by Kaveh Ghazi

builtin-types.def (BT_FN_INT_FLOAT, [...]): New.

	* builtin-types.def (BT_FN_INT_FLOAT, BT_FN_INT_DOUBLE,
	BT_FN_INT_LONGDOUBLE, BT_FN_LONG_FLOAT, BT_FN_LONG_DOUBLE,
	BT_FN_LONG_LONGDOUBLE, BT_FN_LONGLONG_FLOAT,
	BT_FN_LONGLONG_DOUBLE, BT_FN_LONGLONG_LONGDOUBLE,
	BT_FN_FLOAT_FLOAT_LONGDOUBLE, BT_FN_DOUBLE_DOUBLE_LONGDOUBLE,
	BT_FN_FLOAT_FLOAT_INT, BT_FN_DOUBLE_DOUBLE_INT,
	BT_FN_LONGDOUBLE_LONGDOUBLE_INT, BT_FN_FLOAT_FLOAT_LONG,
	BT_FN_DOUBLE_DOUBLE_LONG, BT_FN_LONGDOUBLE_LONGDOUBLE_LONG,
	BT_FN_FLOAT_FLOAT_FLOAT_FLOAT, BT_FN_DOUBLE_DOUBLE_DOUBLE_DOUBLE,
	BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE): New.

	* builtins.def (BUILT_IN_ACOS, BUILT_IN_ACOSF, BUILT_IN_ACOSH,
	BUILT_IN_ACOSHF, BUILT_IN_ACOSHL, BUILT_IN_ACOSL, BUILT_IN_ASIN,
	BUILT_IN_ASINF, BUILT_IN_ASINH, BUILT_IN_ASINHF, BUILT_IN_ASINHL,
	BUILT_IN_ASINL, BUILT_IN_ATANH, BUILT_IN_ATANHF, BUILT_IN_ATANHL,
	BUILT_IN_CBRT, BUILT_IN_CBRTF, BUILT_IN_CBRTL, BUILT_IN_COPYSIGN,
	BUILT_IN_COPYSIGNF, BUILT_IN_COPYSIGNL, BUILT_IN_COSH,
	BUILT_IN_COSHF, BUILT_IN_COSHL, BUILT_IN_DREM, BUILT_IN_DREMF,
	BUILT_IN_DREML, BUILT_IN_EXP10, BUILT_IN_EXP10F, BUILT_IN_EXP10L,
	BUILT_IN_EXP2, BUILT_IN_EXP2F, BUILT_IN_EXP2L, BUILT_IN_EXPM1,
	BUILT_IN_EXPM1F, BUILT_IN_EXPM1L, BUILT_IN_FDIM, BUILT_IN_FDIMF,
	BUILT_IN_FDIML, BUILT_IN_FMA, BUILT_IN_FMAF, BUILT_IN_FMAL,
	BUILT_IN_FMAX, BUILT_IN_FMAXF, BUILT_IN_FMAXL, BUILT_IN_FMIN,
	BUILT_IN_FMINF, BUILT_IN_FMINL, BUILT_IN_HYPOT, BUILT_IN_HYPOTF,
	BUILT_IN_HYPOTL, BUILT_IN_ILOGB, BUILT_IN_ILOGBF, BUILT_IN_ILOGBL,
	BUILT_IN_LDEXP, BUILT_IN_LDEXPF, BUILT_IN_LDEXPL, BUILT_IN_LLRINT,
	BUILT_IN_LLRINTF, BUILT_IN_LLRINTL, BUILT_IN_LLROUND,
	BUILT_IN_LLROUNDF, BUILT_IN_LLROUNDL, BUILT_IN_LOG10,
	BUILT_IN_LOG10F, BUILT_IN_LOG10L, BUILT_IN_LOG1P, BUILT_IN_LOG1PF,
	BUILT_IN_LOG1PL, BUILT_IN_LOG2, BUILT_IN_LOG2F, BUILT_IN_LOG2L,
	BUILT_IN_LOGB, BUILT_IN_LOGBF, BUILT_IN_LOGBL, BUILT_IN_LRINT,
	BUILT_IN_LRINTF, BUILT_IN_LRINTL, BUILT_IN_LROUND,
	BUILT_IN_LROUNDF, BUILT_IN_LROUNDL, BUILT_IN_NEXTAFTER,
	BUILT_IN_NEXTAFTERF, BUILT_IN_NEXTAFTERL, BUILT_IN_NEXTTOWARD,
	BUILT_IN_NEXTTOWARDF, BUILT_IN_NEXTTOWARDL, BUILT_IN_POW10,
	BUILT_IN_POW10F, BUILT_IN_POW10L, BUILT_IN_REMAINDER,
	BUILT_IN_REMAINDERF, BUILT_IN_REMAINDERL, BUILT_IN_RINT,
	BUILT_IN_RINTF, BUILT_IN_RINTL, BUILT_IN_SCALB, BUILT_IN_SCALBF,
	BUILT_IN_SCALBL, BUILT_IN_SCALBLN, BUILT_IN_SCALBLNF,
	BUILT_IN_SCALBLNL, BUILT_IN_SCALBN, BUILT_IN_SCALBNF,
	BUILT_IN_SCALBNL, BUILT_IN_SINH, BUILT_IN_SINHF, BUILT_IN_SINHL,
	BUILT_IN_TANH, BUILT_IN_TANHF, BUILT_IN_TANHL): New.

	* doc/extend.texi: Document new builtins.

testsuite:
	* gcc.dg/builtins-1.c: Add more math builtin tests.
	* gcc.dg/torture/builtin-attr-1.c: New test.

From-SVN: r70886
parent 0239631a
2003-08-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* builtin-types.def (BT_FN_INT_FLOAT, BT_FN_INT_DOUBLE,
BT_FN_INT_LONGDOUBLE, BT_FN_LONG_FLOAT, BT_FN_LONG_DOUBLE,
BT_FN_LONG_LONGDOUBLE, BT_FN_LONGLONG_FLOAT,
BT_FN_LONGLONG_DOUBLE, BT_FN_LONGLONG_LONGDOUBLE,
BT_FN_FLOAT_FLOAT_LONGDOUBLE, BT_FN_DOUBLE_DOUBLE_LONGDOUBLE,
BT_FN_FLOAT_FLOAT_INT, BT_FN_DOUBLE_DOUBLE_INT,
BT_FN_LONGDOUBLE_LONGDOUBLE_INT, BT_FN_FLOAT_FLOAT_LONG,
BT_FN_DOUBLE_DOUBLE_LONG, BT_FN_LONGDOUBLE_LONGDOUBLE_LONG,
BT_FN_FLOAT_FLOAT_FLOAT_FLOAT, BT_FN_DOUBLE_DOUBLE_DOUBLE_DOUBLE,
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE): New.
* builtins.def (BUILT_IN_ACOS, BUILT_IN_ACOSF, BUILT_IN_ACOSH,
BUILT_IN_ACOSHF, BUILT_IN_ACOSHL, BUILT_IN_ACOSL, BUILT_IN_ASIN,
BUILT_IN_ASINF, BUILT_IN_ASINH, BUILT_IN_ASINHF, BUILT_IN_ASINHL,
BUILT_IN_ASINL, BUILT_IN_ATANH, BUILT_IN_ATANHF, BUILT_IN_ATANHL,
BUILT_IN_CBRT, BUILT_IN_CBRTF, BUILT_IN_CBRTL, BUILT_IN_COPYSIGN,
BUILT_IN_COPYSIGNF, BUILT_IN_COPYSIGNL, BUILT_IN_COSH,
BUILT_IN_COSHF, BUILT_IN_COSHL, BUILT_IN_DREM, BUILT_IN_DREMF,
BUILT_IN_DREML, BUILT_IN_EXP10, BUILT_IN_EXP10F, BUILT_IN_EXP10L,
BUILT_IN_EXP2, BUILT_IN_EXP2F, BUILT_IN_EXP2L, BUILT_IN_EXPM1,
BUILT_IN_EXPM1F, BUILT_IN_EXPM1L, BUILT_IN_FDIM, BUILT_IN_FDIMF,
BUILT_IN_FDIML, BUILT_IN_FMA, BUILT_IN_FMAF, BUILT_IN_FMAL,
BUILT_IN_FMAX, BUILT_IN_FMAXF, BUILT_IN_FMAXL, BUILT_IN_FMIN,
BUILT_IN_FMINF, BUILT_IN_FMINL, BUILT_IN_HYPOT, BUILT_IN_HYPOTF,
BUILT_IN_HYPOTL, BUILT_IN_ILOGB, BUILT_IN_ILOGBF, BUILT_IN_ILOGBL,
BUILT_IN_LDEXP, BUILT_IN_LDEXPF, BUILT_IN_LDEXPL, BUILT_IN_LLRINT,
BUILT_IN_LLRINTF, BUILT_IN_LLRINTL, BUILT_IN_LLROUND,
BUILT_IN_LLROUNDF, BUILT_IN_LLROUNDL, BUILT_IN_LOG10,
BUILT_IN_LOG10F, BUILT_IN_LOG10L, BUILT_IN_LOG1P, BUILT_IN_LOG1PF,
BUILT_IN_LOG1PL, BUILT_IN_LOG2, BUILT_IN_LOG2F, BUILT_IN_LOG2L,
BUILT_IN_LOGB, BUILT_IN_LOGBF, BUILT_IN_LOGBL, BUILT_IN_LRINT,
BUILT_IN_LRINTF, BUILT_IN_LRINTL, BUILT_IN_LROUND,
BUILT_IN_LROUNDF, BUILT_IN_LROUNDL, BUILT_IN_NEXTAFTER,
BUILT_IN_NEXTAFTERF, BUILT_IN_NEXTAFTERL, BUILT_IN_NEXTTOWARD,
BUILT_IN_NEXTTOWARDF, BUILT_IN_NEXTTOWARDL, BUILT_IN_POW10,
BUILT_IN_POW10F, BUILT_IN_POW10L, BUILT_IN_REMAINDER,
BUILT_IN_REMAINDERF, BUILT_IN_REMAINDERL, BUILT_IN_RINT,
BUILT_IN_RINTF, BUILT_IN_RINTL, BUILT_IN_SCALB, BUILT_IN_SCALBF,
BUILT_IN_SCALBL, BUILT_IN_SCALBLN, BUILT_IN_SCALBLNF,
BUILT_IN_SCALBLNL, BUILT_IN_SCALBN, BUILT_IN_SCALBNF,
BUILT_IN_SCALBNL, BUILT_IN_SINH, BUILT_IN_SINHF, BUILT_IN_SINHL,
BUILT_IN_TANH, BUILT_IN_TANHF, BUILT_IN_TANHL): New.
* doc/extend.texi: Document new builtins.
2003-08-28 Ulrich Weigand <uweigand@de.ibm.com>
* config/s390/s390.c (legitmate_constant_p): Use LARL on
......
......@@ -118,6 +118,15 @@ DEF_FUNCTION_TYPE_1 (BT_FN_INT_INT, BT_INT, BT_INT)
DEF_FUNCTION_TYPE_1 (BT_FN_INT_LONG, BT_INT, BT_LONG)
DEF_FUNCTION_TYPE_1 (BT_FN_INT_LONGLONG, BT_INT, BT_LONGLONG)
DEF_FUNCTION_TYPE_1 (BT_FN_INT_PTR, BT_INT, BT_PTR)
DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT, BT_INT, BT_FLOAT)
DEF_FUNCTION_TYPE_1 (BT_FN_INT_DOUBLE, BT_INT, BT_DOUBLE)
DEF_FUNCTION_TYPE_1 (BT_FN_INT_LONGDOUBLE, BT_INT, BT_LONGDOUBLE)
DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT, BT_LONG, BT_FLOAT)
DEF_FUNCTION_TYPE_1 (BT_FN_LONG_DOUBLE, BT_LONG, BT_DOUBLE)
DEF_FUNCTION_TYPE_1 (BT_FN_LONG_LONGDOUBLE, BT_LONG, BT_LONGDOUBLE)
DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT, BT_LONGLONG, BT_FLOAT)
DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_DOUBLE, BT_LONGLONG, BT_DOUBLE)
DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_LONGDOUBLE, BT_LONGLONG, BT_LONGDOUBLE)
DEF_FUNCTION_TYPE_1 (BT_FN_VOID_PTR, BT_VOID, BT_PTR)
DEF_FUNCTION_TYPE_1 (BT_FN_SIZE_CONST_STRING, BT_SIZE, BT_CONST_STRING)
DEF_FUNCTION_TYPE_1 (BT_FN_INT_CONST_STRING, BT_INT, BT_CONST_STRING)
......@@ -161,6 +170,22 @@ DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_DOUBLE,
BT_DOUBLE, BT_DOUBLE, BT_DOUBLE)
DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE,
BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONGDOUBLE)
DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_FLOAT_LONGDOUBLE,
BT_FLOAT, BT_FLOAT, BT_LONGDOUBLE)
DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_LONGDOUBLE,
BT_DOUBLE, BT_DOUBLE, BT_LONGDOUBLE)
DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_FLOAT_INT,
BT_FLOAT, BT_FLOAT, BT_INT)
DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_INT,
BT_DOUBLE, BT_DOUBLE, BT_INT)
DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_INT,
BT_LONGDOUBLE, BT_LONGDOUBLE, BT_INT)
DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_FLOAT_LONG,
BT_FLOAT, BT_FLOAT, BT_LONG)
DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_LONG,
BT_DOUBLE, BT_DOUBLE, BT_LONG)
DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_LONG,
BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONG)
DEF_FUNCTION_TYPE_2 (BT_FN_INT_CONST_STRING_VALIST_ARG,
BT_INT, BT_CONST_STRING, BT_VALIST_ARG)
DEF_FUNCTION_TYPE_2 (BT_FN_PTR_SIZE_SIZE,
......@@ -188,6 +213,12 @@ DEF_FUNCTION_TYPE_3 (BT_FN_INT_PTR_CONST_STRING_VALIST_ARG,
BT_INT, BT_PTR, BT_CONST_STRING, BT_VALIST_ARG)
DEF_FUNCTION_TYPE_3 (BT_FN_STRING_CONST_STRING_CONST_STRING_INT,
BT_STRING, BT_CONST_STRING, BT_CONST_STRING, BT_INT)
DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT_FLOAT_FLOAT_FLOAT,
BT_FLOAT, BT_FLOAT, BT_FLOAT, BT_FLOAT)
DEF_FUNCTION_TYPE_3 (BT_FN_DOUBLE_DOUBLE_DOUBLE_DOUBLE,
BT_DOUBLE, BT_DOUBLE, BT_DOUBLE, BT_DOUBLE)
DEF_FUNCTION_TYPE_3 (BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE,
BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONGDOUBLE)
DEF_FUNCTION_TYPE_4 (BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR,
BT_SIZE, BT_CONST_PTR, BT_SIZE, BT_SIZE, BT_PTR)
......
......@@ -4725,14 +4725,31 @@ v4si f (v4si a, v4si b, v4si c)
@findex __builtin_islessequal
@findex __builtin_islessgreater
@findex __builtin_isunordered
@findex _Exit
@findex _exit
@findex abort
@findex abs
@findex acos
@findex acosf
@findex acosh
@findex acoshf
@findex acoshl
@findex acosl
@findex alloca
@findex asin
@findex asinf
@findex asinh
@findex asinhf
@findex asinhl
@findex asinl
@findex atan
@findex atan2
@findex atan2f
@findex atan2l
@findex atanf
@findex atanh
@findex atanhf
@findex atanhl
@findex atanl
@findex bcmp
@findex bzero
......@@ -4740,6 +4757,9 @@ v4si f (v4si a, v4si b, v4si c)
@findex cabsf
@findex cabsl
@findex calloc
@findex cbrt
@findex cbrtf
@findex cbrtl
@findex ceil
@findex ceilf
@findex ceill
......@@ -4749,27 +4769,55 @@ v4si f (v4si a, v4si b, v4si c)
@findex conj
@findex conjf
@findex conjl
@findex copysign
@findex copysignf
@findex copysignl
@findex cos
@findex cosf
@findex cosh
@findex coshf
@findex coshl
@findex cosl
@findex creal
@findex crealf
@findex creall
@findex dcgettext
@findex dgettext
@findex drem
@findex dremf
@findex dreml
@findex exit
@findex _exit
@findex _Exit
@findex exp
@findex exp10
@findex exp10f
@findex exp10l
@findex exp2
@findex exp2f
@findex exp2l
@findex expf
@findex expl
@findex expm1
@findex expm1f
@findex expm1l
@findex fabs
@findex fabsf
@findex fabsl
@findex fdim
@findex fdimf
@findex fdiml
@findex ffs
@findex floor
@findex floorf
@findex floorl
@findex fma
@findex fmaf
@findex fmal
@findex fmax
@findex fmaxf
@findex fmaxl
@findex fmin
@findex fminf
@findex fminl
@findex fmod
@findex fmodf
@findex fmodl
......@@ -4779,13 +4827,46 @@ v4si f (v4si a, v4si b, v4si c)
@findex fputs_unlocked
@findex fscanf
@findex gettext
@findex hypot
@findex hypotf
@findex hypotl
@findex ilogb
@findex ilogbf
@findex ilogbl
@findex imaxabs
@findex index
@findex labs
@findex ldexp
@findex ldexpf
@findex ldexpl
@findex llabs
@findex llrint
@findex llrintf
@findex llrintl
@findex llround
@findex llroundf
@findex llroundl
@findex log
@findex log10
@findex log10f
@findex log10l
@findex log1p
@findex log1pf
@findex log1pl
@findex log2
@findex log2f
@findex log2l
@findex logb
@findex logbf
@findex logbl
@findex logf
@findex logl
@findex lrint
@findex lrintf
@findex lrintl
@findex lround
@findex lroundf
@findex lroundl
@findex malloc
@findex memcmp
@findex memcpy
......@@ -4794,20 +4875,46 @@ v4si f (v4si a, v4si b, v4si c)
@findex nearbyint
@findex nearbyintf
@findex nearbyintl
@findex nextafter
@findex nextafterf
@findex nextafterl
@findex nexttoward
@findex nexttowardf
@findex nexttowardl
@findex pow
@findex pow10
@findex pow10f
@findex pow10l
@findex powf
@findex powl
@findex printf
@findex printf_unlocked
@findex putchar
@findex puts
@findex remainder
@findex remainderf
@findex remainderl
@findex rindex
@findex rint
@findex rintf
@findex rintl
@findex round
@findex roundf
@findex roundl
@findex scanf
@findex scalb
@findex scalbf
@findex scalbl
@findex scalbln
@findex scalblnf
@findex scalblnf
@findex scalbn
@findex scalbnf
@findex scanfnl
@findex sin
@findex sinf
@findex sinh
@findex sinhf
@findex sinhl
@findex sinl
@findex snprintf
@findex sprintf
......@@ -4834,6 +4941,9 @@ v4si f (v4si a, v4si b, v4si c)
@findex strstr
@findex tan
@findex tanf
@findex tanh
@findex tanhf
@findex tanhl
@findex tanl
@findex trunc
@findex truncf
......@@ -4866,54 +4976,75 @@ be emitted.
@opindex ansi
@opindex std
Outside strict ISO C mode (@option{-ansi}, @option{-std=c89} or
@option{-std=c99}), the functions @code{alloca}, @code{bcmp},
@code{bzero}, @code{dcgettext}, @code{dgettext}, @code{_exit},
@code{ffs}, @code{fprintf_unlocked},
@code{fputs_unlocked}, @code{gettext},
@code{index}, @code{mempcpy}, @code{printf_unlocked},
@code{rindex}, @code{stpcpy}, @code{strdup} and @code{strfmon}
@option{-std=c99}), the functions
@code{_exit}, @code{alloca}, @code{bcmp}, @code{bzero},
@code{dcgettext}, @code{dgettext}, @code{dremf}, @code{dreml},
@code{drem}, @code{exp10f}, @code{exp10l}, @code{exp10}, @code{ffsll},
@code{ffsl}, @code{ffs}, @code{fprintf_unlocked}, @code{fputs_unlocked},
@code{gettext}, @code{index}, @code{mempcpy}, @code{pow10f},
@code{pow10l}, @code{pow10}, @code{printf_unlocked}, @code{rindex},
@code{scalbf}, @code{scalbl}, @code{scalb}, @code{stpcpy},
@code{strdup} and @code{strfmon}
may be handled as built-in functions.
All these functions have corresponding versions
prefixed with @code{__builtin_}, which may be used even in strict C89
mode.
The ISO C99 functions
@code{cabs}, @code{cabsf}, @code{cabsl},
@code{conj}, @code{conjf}, @code{conjl},
@code{creal}, @code{crealf}, @code{creall},
@code{cimag}, @code{cimagf}, @code{cimagl},
@code{_Exit}, @code{imaxabs}, @code{llabs},
@code{nearbyint}, @code{nearbyintf}, @code{nearbyintl},
@code{round}, @code{roundf}, @code{roundl}, @code{snprintf},
@code{trunc}, @code{truncf}, @code{truncl}, @code{vfscanf},
@code{vscanf}, @code{vsnprintf} and @code{vsscanf}
@code{_Exit}, @code{acoshf}, @code{acoshl}, @code{acosh}, @code{asinhf},
@code{asinhl}, @code{asinh}, @code{atanhf}, @code{atanhl}, @code{atanh},
@code{cabsf}, @code{cabsl}, @code{cabs}, @code{cbrtf}, @code{cbrtl},
@code{cbrt}, @code{cimagf}, @code{cimagl}, @code{cimag}, @code{conjf},
@code{conjl}, @code{conj}, @code{copysignf}, @code{copysignl},
@code{copysign}, @code{crealf}, @code{creall}, @code{creal},
@code{exp2f}, @code{exp2l}, @code{exp2}, @code{expm1f}, @code{expm1l},
@code{expm1}, @code{fdimf}, @code{fdiml}, @code{fdim}, @code{fmaf},
@code{fmal}, @code{fmaxf}, @code{fmaxl}, @code{fmax}, @code{fma},
@code{fminf}, @code{fminl}, @code{fmin}, @code{hypotf}, @code{hypotl},
@code{hypot}, @code{ilogbf}, @code{ilogbl}, @code{ilogb},
@code{imaxabs}, @code{llabs}, @code{llrintf}, @code{llrintl},
@code{llrint}, @code{llroundf}, @code{llroundl}, @code{llround},
@code{log1pf}, @code{log1pl}, @code{log1p}, @code{log2f}, @code{log2l},
@code{log2}, @code{logbf}, @code{logbl}, @code{logb}, @code{lrintf},
@code{lrintl}, @code{lrint}, @code{lroundf}, @code{lroundl},
@code{lround}, @code{nearbyintf}, @code{nearbyintl}, @code{nearbyint},
@code{nextafterf}, @code{nextafterl}, @code{nextafter},
@code{nexttowardf}, @code{nexttowardl}, @code{nexttoward},
@code{remainderf}, @code{remainderl}, @code{remainder}, @code{rintf},
@code{rintl}, @code{rint}, @code{roundf}, @code{roundl}, @code{round},
@code{scalblnf}, @code{scalblnl}, @code{scalbln}, @code{scalbnf},
@code{scalbnl}, @code{scalbn}, @code{snprintf}, @code{truncf},
@code{truncl}, @code{trunc}, @code{vfscanf}, @code{vscanf},
@code{vsnprintf} and @code{vsscanf},
are handled as built-in functions
except in strict ISO C90 mode (@option{-ansi} or @option{-std=c89}).
There are also built-in versions of the ISO C99 functions @code{atan2f},
There are also built-in versions of the ISO C99 functions
@code{acosf}, @code{acosl}, @code{asinf}, @code{asinl}, @code{atan2f},
@code{atan2l}, @code{atanf}, @code{atanl}, @code{ceilf}, @code{ceill},
@code{cosf}, @code{cosl},
@code{expf}, @code{expl}, @code{fabsf}, @code{fabsl}, @code{floorf},
@code{floorl}, @code{fmodf}, @code{fmodl},
@code{logf}, @code{logl}, @code{powf}, @code{powl},
@code{sinf}, @code{sinl}, @code{sqrtf}, @code{sqrtl},
@code{tanf} and @code{tanl}
@code{cosf}, @code{coshf}, @code{coshl}, @code{cosl}, @code{expf},
@code{expl}, @code{fabsf}, @code{fabsl}, @code{floorf}, @code{floorl},
@code{fmodf}, @code{fmodl}, @code{ldexpf}, @code{ldexpl}, @code{log10f},
@code{log10l}, @code{logf}, @code{logl}, @code{powf}, @code{powl},
@code{sinf}, @code{sinhf}, @code{sinhl}, @code{sinl}, @code{sqrtf},
@code{sqrtl}, @code{tanf}, @code{tanhf}, @code{tanhl} and @code{tanl}
that are recognized in any mode since ISO C90 reserves these names for
the purpose to which ISO C99 puts them. All these functions have
corresponding versions prefixed with @code{__builtin_}.
The ISO C90 functions @code{abort}, @code{abs}, @code{atan}, @code{atan2},
@code{calloc}, @code{ceil}, @code{cos}, @code{exit},
@code{exp}, @code{fabs}, @code{floor}, @code{fmod},
@code{fprintf}, @code{fputs}, @code{fscanf},
@code{labs}, @code{log}, @code{malloc},
@code{memcmp}, @code{memcpy}, @code{memset}, @code{pow}, @code{printf},
@code{putchar}, @code{puts}, @code{scanf}, @code{sin}, @code{snprintf},
@code{sprintf}, @code{sqrt}, @code{sscanf},
@code{strcat}, @code{strchr}, @code{strcmp},
@code{strcpy}, @code{strcspn}, @code{strlen}, @code{strncat}, @code{strncmp},
@code{strncpy}, @code{strpbrk}, @code{strrchr}, @code{strspn}, @code{strstr},
@code{tan}, @code{vfprintf}, @code{vprintf} and @code{vsprintf}
The ISO C90 functions
@code{abort}, @code{abs}, @code{acos}, @code{asin}, @code{atan2},
@code{atan}, @code{calloc}, @code{ceil}, @code{cosh}, @code{cos},
@code{exit}, @code{exp}, @code{fabs}, @code{floor}, @code{fmod},
@code{fprintf}, @code{fputs}, @code{fscanf}, @code{labs}, @code{ldexp},
@code{log10}, @code{log}, @code{malloc}, @code{memcmp}, @code{memcpy},
@code{memset}, @code{pow}, @code{printf}, @code{putchar}, @code{puts},
@code{scanf}, @code{sinh}, @code{sin}, @code{snprintf}, @code{sprintf},
@code{sqrt}, @code{sscanf}, @code{strcat}, @code{strchr}, @code{strcmp},
@code{strcpy}, @code{strcspn}, @code{strlen}, @code{strncat},
@code{strncmp}, @code{strncpy}, @code{strpbrk}, @code{strrchr},
@code{strspn}, @code{strstr}, @code{tanh}, @code{tan}, @code{vfprintf},
@code{vprintf} and @code{vsprintf},
are all recognized as built-in functions unless
@option{-fno-builtin} is specified (or @option{-fno-builtin-@var{function}}
is specified for an individual function). All of these functions have
......
......@@ -6,6 +6,7 @@
Written by Roger Sayle, 11th July 2002. */
/* { dg-do compile } */
/* { dg-options "" } */
/* { dg-final { scan-assembler-not "__builtin_" } } */
/* These helper macros ensure we also check the float and long double
......@@ -24,35 +25,92 @@ float test_##FN##f(float x) { return __builtin_##FN##f(x); } \
long double test_##FN##l(long double x) { return __builtin_##FN##l(x); }
/* Test FP functions taking one argument of a supplied type. */
#define FPTEST1TYPE(FN, TYPE) \
#define FPTEST1ARG(FN, TYPE) \
double test_##FN(TYPE x) { return __builtin_##FN(x); } \
float test_##FN##f(TYPE x) { return __builtin_##FN##f(x); } \
long double test_##FN##l(TYPE x) { return __builtin_##FN##l(x); }
/* Test FP functions taking two arguments, the second argument is of a
supplied type. */
#define FPTEST2ARG(FN, TYPE) \
double test_##FN(double x, TYPE y) { return __builtin_##FN(x, y); } \
float test_##FN##f(float x, TYPE y) { return __builtin_##FN##f(x, y); } \
long double test_##FN##l(long double x, TYPE y) { return __builtin_##FN##l(x, y); }
/* Test FP functions taking one FP argument and a supplied return
type. */
#define FPTEST1RET(FN, TYPE) \
TYPE test_##FN(double x) { return __builtin_##FN(x); } \
TYPE test_##FN##f(float x) { return __builtin_##FN##f(x); } \
TYPE test_##FN##l(long double x) { return __builtin_##FN##l(x); }
/* Test FP functions taking two FP arguments. */
#define FPTEST2(FN) \
double test_##FN(double x, double y) { return __builtin_##FN(x, y); } \
float test_##FN##f(float x, float y) { return __builtin_##FN##f(x, y); } \
long double test_##FN##l(long double x, long double y) { return __builtin_##FN##l(x, y); }
/* Test FP functions taking three FP arguments. */
#define FPTEST3(FN) \
double test_##FN(double x, double y, double z) { return __builtin_##FN(x, y, z); } \
float test_##FN##f(float x, float y, float z) { return __builtin_##FN##f(x, y, z); } \
long double test_##FN##l(long double x, long double y, long double z) { return __builtin_##FN##l(x, y, z); }
/* Keep this list sorted alphabetically by function name. */
FPTEST1 (acos)
FPTEST1 (acosh)
FPTEST1 (asin)
FPTEST1 (asinh)
FPTEST1 (atan)
FPTEST2 (atan2)
FPTEST1 (atanh)
FPTEST1 (cbrt)
FPTEST1 (ceil)
FPTEST2 (copysign)
FPTEST1 (cos)
FPTEST1 (cosh)
FPTEST2 (drem)
FPTEST1 (exp)
FPTEST1 (exp10)
FPTEST1 (exp2)
FPTEST1 (expm1)
FPTEST1 (fabs)
FPTEST2 (fdim)
FPTEST1 (floor)
FPTEST3 (fma)
FPTEST2 (fmax)
FPTEST2 (fmin)
FPTEST2 (fmod)
FPTEST0 (huge_val)
FPTEST2 (hypot)
FPTEST1 (ilogb)
FPTEST0 (inf)
FPTEST2ARG (ldexp, int)
FPTEST1RET (llrint, long long)
FPTEST1RET (llround, long long)
FPTEST1 (log)
FPTEST1TYPE (nan, char *)
FPTEST1TYPE (nans, char *)
FPTEST1 (log10)
FPTEST1 (log1p)
FPTEST1 (log2)
FPTEST1 (logb)
FPTEST1RET (lrint, long)
FPTEST1RET (lround, long)
FPTEST1ARG (nan, char *)
FPTEST1ARG (nans, char *)
FPTEST1 (nearbyint)
FPTEST2 (nextafter)
FPTEST2 (nexttoward)
FPTEST2 (pow)
FPTEST1 (pow10)
FPTEST2 (remainder)
FPTEST1 (rint)
FPTEST1 (round)
FPTEST2 (scalb)
FPTEST2ARG (scalbln, int)
FPTEST2ARG (scalbn, int)
FPTEST1 (sin)
FPTEST1 (sinh)
FPTEST1 (sqrt)
FPTEST1 (tan)
FPTEST1 (tanh)
FPTEST1 (trunc)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment