This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[3.4-BIB] Add trunc/round/floor/ceil/rint builtins III


Hi,
this patch combines all the problems we found so far:
1) I've changed rint builtin to nearbyint.  None of the other builtins
do exception, so nearbyint completes the familly, not rint.  In next
turn we can add rint one that will exapnd into nearbyint when inlining
and rint call when not when the hypotesis about not trapping is correct
or do that for fast-math when not.
2) I've added attrs to C99 builtins per Richard's request
3) I kept floorl/floorf/ceill/ceilf as LIB_BUILTINS, so in C90 mode we
recognize floorl and expand it into floorl call by default.
This is consistent as C90 reserve the name. 

To be C90 library compliant, we probably want prevent the implicit
construction of these, but this can be done by separate patch as we
produce none (but we produce similar cases in the other patch)

We can still produce floorf style functions and expand these into
(float)floor((double)x) when in-line expansion fails, but this is
complicated, so I would like to handle this incrementaly.

Honza


Wed Nov  6 23:23:27 CET 2002  Jan Hubicka  <jh@suse.cz>

	* builtins.c (expand_builtin_mathfn): Handle floor/ceil/trunc/round/nearbyint
	(expand_builtin): Likewise.
	* builtins.def: Add
	__builtin_floor, __builtin_floorf, __builtin_floorl
	__builtin_ceil, __builtin_ceilf, __builtin_ceill
	__builtin_round, __builtin_roundf, __builtin_roundl
	__builtin_trunc, __builtin_truncf, __builtin_truncl
	__builtin_nearbyint, __builtin_nearbyintf, __builtin_nearbyintl.
	* genopinit.c (optabs): Initialize the new optabs.
	* optab.c (init_optabs): Likewise.
	* optabs.h (optab_index): Add OTI_floor, OTI_ceil, OTI_trunc,
	OTI_round, OTI_nearbyint.
	(floor_optab, ceil_optab, trunc_optab, round_optab, nearbyint_optab): New.
	* doc/md.texi: Document new named patterns.
	* doc/extend.texi (builtin functions)  Document
	floor, floorf, floorl, ceil, ceilf,
	ceill, round, roundf, roundl, trunc,
	truncf, truncl, nearbyint, nearbyintf, nearbyintl.

Index: builtins.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/builtins.c,v
retrieving revision 1.159.4.4
diff -c -3 -p -r1.159.4.4 builtins.c
*** builtins.c	4 Nov 2002 00:04:22 -0000	1.159.4.4
--- builtins.c	7 Nov 2002 10:45:54 -0000
*************** expand_builtin_mathfn (exp, target, subt
*** 1483,1488 ****
--- 1483,1489 ----
    tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
    tree arglist = TREE_OPERAND (exp, 1);
    enum machine_mode argmode;
+   bool errno_set = true;
  
    if (!validate_arglist (arglist, REAL_TYPE, VOID_TYPE))
      return 0;
*************** expand_builtin_mathfn (exp, target, subt
*** 1533,1538 ****
--- 1534,1559 ----
      case BUILT_IN_LOGF:
      case BUILT_IN_LOGL:
        builtin_optab = log_optab; break;
+     case BUILT_IN_FLOOR:
+     case BUILT_IN_FLOORF:
+     case BUILT_IN_FLOORL:
+       errno_set = false ; builtin_optab = floor_optab; break;
+     case BUILT_IN_CEIL:
+     case BUILT_IN_CEILF:
+     case BUILT_IN_CEILL:
+       errno_set = false ; builtin_optab = ceil_optab; break;
+     case BUILT_IN_TRUNC:
+     case BUILT_IN_TRUNCF:
+     case BUILT_IN_TRUNCL:
+       errno_set = false ; builtin_optab = trunc_optab; break;
+     case BUILT_IN_ROUND:
+     case BUILT_IN_ROUNDF:
+     case BUILT_IN_ROUNDL:
+       errno_set = false ; builtin_optab = round_optab; break;
+     case BUILT_IN_NEARBYINT:
+     case BUILT_IN_NEARBYINTF:
+     case BUILT_IN_NEARBYINTL:
+       errno_set = false ; builtin_optab = nearbyint_optab; break;
      default:
        abort ();
      }
*************** expand_builtin_mathfn (exp, target, subt
*** 1553,1559 ****
  
    /* If errno must be maintained, we must set it to EDOM for NaN results.  */
  
!   if (flag_errno_math && HONOR_NANS (argmode))
      {
        rtx lab1;
  
--- 1574,1580 ----
  
    /* If errno must be maintained, we must set it to EDOM for NaN results.  */
  
!   if (flag_errno_math && errno_set && HONOR_NANS (argmode))
      {
        rtx lab1;
  
*************** expand_builtin (exp, target, subtarget, 
*** 3743,3748 ****
--- 3764,3784 ----
        case BUILT_IN_FPUTC_UNLOCKED:
        case BUILT_IN_FPUTS_UNLOCKED:
        case BUILT_IN_FWRITE_UNLOCKED:
+       case BUILT_IN_FLOOR:
+       case BUILT_IN_FLOORF:
+       case BUILT_IN_FLOORL:
+       case BUILT_IN_CEIL:
+       case BUILT_IN_CEILF:
+       case BUILT_IN_CEILL:
+       case BUILT_IN_TRUNC:
+       case BUILT_IN_TRUNCF:
+       case BUILT_IN_TRUNCL:
+       case BUILT_IN_ROUND:
+       case BUILT_IN_ROUNDF:
+       case BUILT_IN_ROUNDL:
+       case BUILT_IN_NEARBYINT:
+       case BUILT_IN_NEARBYINTF:
+       case BUILT_IN_NEARBYINTL:
  	return expand_call (exp, target, ignore);
  
        default:
*************** expand_builtin (exp, target, subtarget, 
*** 3793,3798 ****
--- 3829,3849 ----
      case BUILT_IN_SQRT:
      case BUILT_IN_SQRTF:
      case BUILT_IN_SQRTL:
+     case BUILT_IN_FLOOR:
+     case BUILT_IN_FLOORF:
+     case BUILT_IN_FLOORL:
+     case BUILT_IN_CEIL:
+     case BUILT_IN_CEILF:
+     case BUILT_IN_CEILL:
+     case BUILT_IN_TRUNC:
+     case BUILT_IN_TRUNCF:
+     case BUILT_IN_TRUNCL:
+     case BUILT_IN_ROUND:
+     case BUILT_IN_ROUNDF:
+     case BUILT_IN_ROUNDL:
+     case BUILT_IN_NEARBYINT:
+     case BUILT_IN_NEARBYINTF:
+     case BUILT_IN_NEARBYINTL:
        target = expand_builtin_mathfn (exp, target, subtarget);
        if (target)
  	return target;
Index: builtins.def
===================================================================
RCS file: /cvs/gcc/egcs/gcc/builtins.def,v
retrieving revision 1.34.4.3
diff -c -3 -p -r1.34.4.3 builtins.def
*** builtins.def	1 Oct 2002 17:31:36 -0000	1.34.4.3
--- builtins.def	7 Nov 2002 10:45:54 -0000
*************** Software Foundation, 59 Temple Place - S
*** 112,120 ****
  /* Like DEF_LIB_BUILTIN, except that the function is only a part of
     the standard in C99 or above.  */
  #undef DEF_C99_BUILTIN					
! #define DEF_C99_BUILTIN(ENUM, NAME, TYPE)		\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
!    	       true, !flag_isoc99, true, ATTR_NOTHROW_LIST)
  
  /* Like DEF_LIB_BUILTIN, except that the function is expanded in the
     front-end.  */
--- 112,120 ----
  /* Like DEF_LIB_BUILTIN, except that the function is only a part of
     the standard in C99 or above.  */
  #undef DEF_C99_BUILTIN					
! #define DEF_C99_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
!    	       true, !flag_isoc99, true, ATTRS)
  
  /* Like DEF_LIB_BUILTIN, except that the function is expanded in the
     front-end.  */
*************** DEF_LIB_ALWAYS_BUILTIN(BUILT_IN_FABSL,
*** 169,207 ****
  		       "__builtin_fabsl",
  		       BT_FN_LONG_DOUBLE_LONG_DOUBLE)
  
  DEF_C99_BUILTIN(BUILT_IN_LLABS,
  		"__builtin_llabs",
! 		BT_FN_LONGLONG_LONGLONG)
  DEF_C99_BUILTIN(BUILT_IN_IMAXABS,
  		"__builtin_imaxabs",
! 		BT_FN_INTMAX_INTMAX)
  DEF_C99_BUILTIN(BUILT_IN_CONJ,
  		"__builtin_conj",
! 		BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE)
  DEF_C99_BUILTIN(BUILT_IN_CONJF,
  		"__builtin_conjf",
! 		BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT)
  DEF_C99_BUILTIN(BUILT_IN_CONJL,
  		"__builtin_conjl",
! 		BT_FN_COMPLEX_LONG_DOUBLE_COMPLEX_LONG_DOUBLE)
  DEF_C99_BUILTIN(BUILT_IN_CREAL,
  		"__builtin_creal",
! 		BT_FN_DOUBLE_COMPLEX_DOUBLE)
  DEF_C99_BUILTIN(BUILT_IN_CREALF,
  		"__builtin_crealf",
! 		BT_FN_FLOAT_COMPLEX_FLOAT)
  DEF_C99_BUILTIN(BUILT_IN_CREALL,
  		"__builtin_creall",
! 		BT_FN_LONG_DOUBLE_COMPLEX_LONG_DOUBLE)
  DEF_C99_BUILTIN(BUILT_IN_CIMAG,
  		"__builtin_cimag",
! 		BT_FN_DOUBLE_COMPLEX_DOUBLE)
  DEF_C99_BUILTIN(BUILT_IN_CIMAGF,
  		"__builtin_cimagf",
! 		BT_FN_FLOAT_COMPLEX_FLOAT)
  DEF_C99_BUILTIN(BUILT_IN_CIMAGL,
  		"__builtin_cimagl",
! 		BT_FN_LONG_DOUBLE_COMPLEX_LONG_DOUBLE)
  
  DEF_UNUSED_BUILTIN(BUILT_IN_DIV)
  DEF_UNUSED_BUILTIN(BUILT_IN_LDIV)
--- 169,283 ----
  		       "__builtin_fabsl",
  		       BT_FN_LONG_DOUBLE_LONG_DOUBLE)
  
+ DEF_LIB_BUILTIN(BUILT_IN_FLOOR,
+                 "__builtin_floor",
+                 BT_FN_DOUBLE_DOUBLE,
+ 		ATTR_CONST_NOTHROW_LIST)
+ DEF_LIB_BUILTIN(BUILT_IN_FLOORF,
+                 "__builtin_floorf",
+                 BT_FN_FLOAT_FLOAT,
+ 		ATTR_CONST_NOTHROW_LIST)
+ DEF_LIB_BUILTIN(BUILT_IN_FLOORL,
+                 "__builtin_floorl",
+                 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
+ 		ATTR_CONST_NOTHROW_LIST)
+ 
+ DEF_LIB_BUILTIN(BUILT_IN_CEIL,
+                 "__builtin_ceil",
+                 BT_FN_DOUBLE_DOUBLE,
+ 		ATTR_CONST_NOTHROW_LIST)
+ DEF_LIB_BUILTIN(BUILT_IN_CEILF,
+                 "__builtin_ceilf",
+                 BT_FN_FLOAT_FLOAT,
+ 		ATTR_CONST_NOTHROW_LIST)
+ DEF_LIB_BUILTIN(BUILT_IN_CEILL,
+ 		"__builtin_ceill",
+ 		BT_FN_LONG_DOUBLE_LONG_DOUBLE,
+ 		ATTR_CONST_NOTHROW_LIST)
+ 
+ DEF_C99_BUILTIN(BUILT_IN_ROUND,
+ 		"__builtin_round",
+ 		BT_FN_DOUBLE_DOUBLE,
+ 		ATTR_CONST_NOTHROW_LIST)
+ DEF_C99_BUILTIN(BUILT_IN_ROUNDF,
+ 		"__builtin_roundf",
+ 		BT_FN_FLOAT_FLOAT,
+ 		ATTR_CONST_NOTHROW_LIST)
+ DEF_C99_BUILTIN(BUILT_IN_ROUNDL,
+ 		"__builtin_roundl",
+ 		BT_FN_LONG_DOUBLE_LONG_DOUBLE,
+ 		ATTR_CONST_NOTHROW_LIST)
+ 
+ DEF_C99_BUILTIN(BUILT_IN_TRUNC,
+ 		"__builtin_trunc",
+ 		BT_FN_DOUBLE_DOUBLE,
+ 		ATTR_CONST_NOTHROW_LIST)
+ DEF_C99_BUILTIN(BUILT_IN_TRUNCF,
+ 		"__builtin_truncf",
+ 		BT_FN_FLOAT_FLOAT,
+ 		ATTR_CONST_NOTHROW_LIST)
+ DEF_C99_BUILTIN(BUILT_IN_TRUNCL,
+ 		"__builtin_truncl",
+ 		BT_FN_LONG_DOUBLE_LONG_DOUBLE,
+ 		ATTR_CONST_NOTHROW_LIST)
+ 
+ DEF_C99_BUILTIN(BUILT_IN_NEARBYINT,
+ 		"__builtin_nearbyint",
+ 		BT_FN_DOUBLE_DOUBLE,
+ 		ATTR_CONST_NOTHROW_LIST)
+ DEF_C99_BUILTIN(BUILT_IN_NEARBYINTF,
+ 		"__builtin_nearbyintf",
+ 		BT_FN_FLOAT_FLOAT,
+ 		ATTR_CONST_NOTHROW_LIST)
+ DEF_C99_BUILTIN(BUILT_IN_NEARBYINTL,
+ 		"__builtin_nearbyintl",
+ 		BT_FN_LONG_DOUBLE_LONG_DOUBLE,
+ 		ATTR_CONST_NOTHROW_LIST)
+ 
  DEF_C99_BUILTIN(BUILT_IN_LLABS,
  		"__builtin_llabs",
! 		BT_FN_LONGLONG_LONGLONG,
! 		ATTR_CONST_NOTHROW_LIST)
  DEF_C99_BUILTIN(BUILT_IN_IMAXABS,
  		"__builtin_imaxabs",
! 		BT_FN_INTMAX_INTMAX,
! 		ATTR_CONST_NOTHROW_LIST)
  DEF_C99_BUILTIN(BUILT_IN_CONJ,
  		"__builtin_conj",
! 		BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE,
! 		ATTR_CONST_NOTHROW_LIST)
  DEF_C99_BUILTIN(BUILT_IN_CONJF,
  		"__builtin_conjf",
! 		BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT,
! 		ATTR_CONST_NOTHROW_LIST)
  DEF_C99_BUILTIN(BUILT_IN_CONJL,
  		"__builtin_conjl",
! 		BT_FN_COMPLEX_LONG_DOUBLE_COMPLEX_LONG_DOUBLE,
! 		ATTR_CONST_NOTHROW_LIST)
  DEF_C99_BUILTIN(BUILT_IN_CREAL,
  		"__builtin_creal",
! 		BT_FN_DOUBLE_COMPLEX_DOUBLE,
! 		ATTR_CONST_NOTHROW_LIST)
  DEF_C99_BUILTIN(BUILT_IN_CREALF,
  		"__builtin_crealf",
! 		BT_FN_FLOAT_COMPLEX_FLOAT,
! 		ATTR_CONST_NOTHROW_LIST)
  DEF_C99_BUILTIN(BUILT_IN_CREALL,
  		"__builtin_creall",
! 		BT_FN_LONG_DOUBLE_COMPLEX_LONG_DOUBLE,
! 		ATTR_CONST_NOTHROW_LIST)
  DEF_C99_BUILTIN(BUILT_IN_CIMAG,
  		"__builtin_cimag",
! 		BT_FN_DOUBLE_COMPLEX_DOUBLE,
! 		ATTR_CONST_NOTHROW_LIST)
  DEF_C99_BUILTIN(BUILT_IN_CIMAGF,
  		"__builtin_cimagf",
! 		BT_FN_FLOAT_COMPLEX_FLOAT,
! 		ATTR_CONST_NOTHROW_LIST)
  DEF_C99_BUILTIN(BUILT_IN_CIMAGL,
  		"__builtin_cimagl",
! 		BT_FN_LONG_DOUBLE_COMPLEX_LONG_DOUBLE,
! 		ATTR_CONST_NOTHROW_LIST)
  
  DEF_UNUSED_BUILTIN(BUILT_IN_DIV)
  DEF_UNUSED_BUILTIN(BUILT_IN_LDIV)
Index: genopinit.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/genopinit.c,v
retrieving revision 1.53
diff -c -3 -p -r1.53 genopinit.c
*** genopinit.c	3 Aug 2002 23:21:30 -0000	1.53
--- genopinit.c	7 Nov 2002 10:45:54 -0000
*************** static const char * const optabs[] =
*** 112,117 ****
--- 112,122 ----
      abs_optab->handlers[(int) $A].insn_code = CODE_FOR_$(abs$F$a2$)",
    "absv_optab->handlers[(int) $A].insn_code = CODE_FOR_$(absv$I$a2$)",
    "sqrt_optab->handlers[$A].insn_code = CODE_FOR_$(sqrt$a2$)",
+   "floor_optab->handlers[$A].insn_code = CODE_FOR_$(floor$a2$)",
+   "ceil_optab->handlers[$A].insn_code = CODE_FOR_$(ceil$a2$)",
+   "round_optab->handlers[$A].insn_code = CODE_FOR_$(round$a2$)",
+   "trunc_optab->handlers[$A].insn_code = CODE_FOR_$(trunc$a2$)",
+   "nearbyint_optab->handlers[$A].insn_code = CODE_FOR_$(nearbyint$a2$)",
    "sin_optab->handlers[$A].insn_code = CODE_FOR_$(sin$a2$)",
    "cos_optab->handlers[$A].insn_code = CODE_FOR_$(cos$a2$)",
    "exp_optab->handlers[$A].insn_code = CODE_FOR_$(exp$a2$)",
Index: optabs.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/optabs.c,v
retrieving revision 1.143.4.5
diff -c -3 -p -r1.143.4.5 optabs.c
*** optabs.c	28 Oct 2002 19:47:07 -0000	1.143.4.5
--- optabs.c	7 Nov 2002 10:45:55 -0000
*************** init_optabs ()
*** 5173,5178 ****
--- 5173,5183 ----
    one_cmpl_optab = init_optab (NOT);
    ffs_optab = init_optab (FFS);
    sqrt_optab = init_optab (SQRT);
+   floor_optab = init_optab (UNKNOWN);
+   ceil_optab = init_optab (UNKNOWN);
+   round_optab = init_optab (UNKNOWN);
+   trunc_optab = init_optab (UNKNOWN);
+   nearbyint_optab = init_optab (UNKNOWN);
    sin_optab = init_optab (UNKNOWN);
    cos_optab = init_optab (UNKNOWN);
    exp_optab = init_optab (UNKNOWN);
Index: optabs.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/optabs.h,v
retrieving revision 1.7
diff -c -3 -p -r1.7 optabs.h
*** optabs.h	3 Aug 2002 23:21:30 -0000	1.7
--- optabs.h	7 Nov 2002 10:45:56 -0000
*************** enum optab_index
*** 135,140 ****
--- 135,146 ----
    OTI_exp,
    /* Natural Logarithm */
    OTI_log,
+   /* Rounding functions */
+   OTI_floor,
+   OTI_ceil,
+   OTI_trunc,
+   OTI_round,
+   OTI_nearbyint,
  
    /* Compare insn; two operands.  */
    OTI_cmp,
*************** extern GTY(()) optab optab_table[OTI_MAX
*** 204,209 ****
--- 210,220 ----
  #define cos_optab (optab_table[OTI_cos])
  #define exp_optab (optab_table[OTI_exp])
  #define log_optab (optab_table[OTI_log])
+ #define floor_optab (optab_table[OTI_floor])
+ #define ceil_optab (optab_table[OTI_ceil])
+ #define trunc_optab (optab_table[OTI_trunc])
+ #define round_optab (optab_table[OTI_round])
+ #define nearbyint_optab (optab_table[OTI_nearbyint])
  
  #define cmp_optab (optab_table[OTI_cmp])
  #define ucmp_optab (optab_table[OTI_ucmp])
Index: doc/extend.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/doc/extend.texi,v
retrieving revision 1.95.4.5
diff -c -3 -p -r1.95.4.5 extend.texi
*** doc/extend.texi	21 Oct 2002 17:52:59 -0000	1.95.4.5
--- doc/extend.texi	7 Nov 2002 10:46:01 -0000
*************** v4si f (v4si a, v4si b, v4si c)
*** 4568,4573 ****
--- 4568,4588 ----
  @findex strrchr
  @findex strspn
  @findex strstr
+ @findex floor
+ @findex floorf
+ @findex floorl
+ @findex ceil
+ @findex ceilf
+ @findex ceill
+ @findex round
+ @findex roundf
+ @findex roundl
+ @findex trunc
+ @findex truncf
+ @findex truncl
+ @findex nearbyint
+ @findex nearbyintf
+ @findex nearbyintl
  
  GCC provides a large number of built-in functions other than the ones
  mentioned above.  Some of these are for internal use in the processing
*************** built-in functions.  All these functions
*** 4603,4630 ****
  prefixed with @code{__builtin_}, which may be used even in strict C89
  mode.
  
! The ISO C99 functions @code{conj}, @code{conjf}, @code{conjl},
! @code{creal}, @code{crealf}, @code{creall}, @code{cimag}, @code{cimagf},
! @code{cimagl}, @code{llabs} and @code{imaxabs} are handled as built-in
! functions except in strict ISO C90 mode.  There are also built-in
! versions of the ISO C99 functions @code{cosf}, @code{cosl},
! @code{expf}, @code{expl}, @code{fabsf}, @code{fabsl},
! @code{logf}, @code{logl}, @code{sinf}, @code{sinl}, @code{sqrtf}, and
! @code{sqrtl}, 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{abs}, @code{cos}, @code{exp}, @code{fabs},
! @code{fprintf}, @code{fputs}, @code{labs}, @code{log},
! @code{memcmp}, @code{memcpy},
! @code{memset}, @code{printf}, @code{sin}, @code{sqrt}, @code{strcat},
! @code{strchr}, @code{strcmp}, @code{strcpy}, @code{strcspn},
! @code{strlen}, @code{strncat}, @code{strncmp}, @code{strncpy},
! @code{strpbrk}, @code{strrchr}, @code{strspn}, and @code{strstr} 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 corresponding
! versions prefixed with @code{__builtin_}.
  
  GCC provides built-in versions of the ISO C99 floating point comparison
  macros that avoid raising exceptions for unordered operands.  They have
--- 4618,4646 ----
  prefixed with @code{__builtin_}, which may be used even in strict C89
  mode.
  
! The ISO C99 functions @code{conj}, @code{conjf}, @code{conjl}, @code{creal},
! @code{crealf}, @code{creall}, @code{cimag}, @code{cimagf}, @code{cimagl},
! @code{llabs}, @code{imaxabs}, @code{round}, @code{trunc}, @code{nearbyint},
! @code{roundf}, @code{truncf}, @code{nearbyintf}, @code{roundl}, @code{truncl} and
! @code{nearbyintl} are handled as built-in functions except in strict ISO C90 mode.
! There are also built-in versions of the ISO C99 functions @code{cosf},
! @code{cosl}, @code{expf}, @code{expl}, @code{fabsf}, @code{fabsl}, @code{logf},
! @code{logl}, @code{sinf}, @code{sinl}, @code{sqrtf}, @code{sqrtl},
! @code{ceilf}, @code{ceill}, @code{floorf} and @code{floorl} 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{abs}, @code{cos}, @code{exp}, @code{fabs},
! @code{fprintf}, @code{fputs}, @code{labs}, @code{log}, @code{floor},
! @code{ceil} @code{memcmp}, @code{memcpy}, @code{memset}, @code{printf},
! @code{sin}, @code{sqrt}, @code{strcat}, @code{strchr}, @code{strcmp},
! @code{strcpy}, @code{strcspn}, @code{strlen}, @code{strncat}, @code{strncmp},
! @code{strncpy}, @code{strpbrk}, @code{strrchr}, @code{strspn}, and
! @code{strstr} 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
! corresponding versions prefixed with @code{__builtin_}.
  
  GCC provides built-in versions of the ISO C99 floating point comparison
  macros that avoid raising exceptions for unordered operands.  They have
Index: doc/md.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/doc/md.texi,v
retrieving revision 1.47.2.3
diff -c -3 -p -r1.47.2.3 md.texi
*** doc/md.texi	5 Nov 2002 19:12:27 -0000	1.47.2.3
--- doc/md.texi	7 Nov 2002 10:46:02 -0000
*************** corresponds to the C data type @code{dou
*** 2569,2574 ****
--- 2569,2619 ----
  built-in function uses the mode which corresponds to the C data
  type @code{float}.
  
+ @cindex @code{floor@var{m}2} instruction pattern
+ @item @samp{floor@var{m}2}
+ Store the largest integral value not greater than argument.
+ 
+ The @code{floor} built-in function of C always uses the mode which
+ corresponds to the C data type @code{double} and the @code{floorf}
+ built-in function uses the mode which corresponds to the C data
+ type @code{float}.
+ 
+ @cindex @code{trunc@var{m}2} instruction pattern
+ @item @samp{trunc@var{m}2}
+ Store the argument rounded to integer towards zero.
+ 
+ The @code{trunc} built-in function of C always uses the mode which
+ corresponds to the C data type @code{double} and the @code{truncf}
+ built-in function uses the mode which corresponds to the C data
+ type @code{float}.
+ 
+ @cindex @code{round@var{m}2} instruction pattern
+ @item @samp{round@var{m}2}
+ Store the argument rounded to integer away from zero.
+ 
+ The @code{round} built-in function of C always uses the mode which
+ corresponds to the C data type @code{double} and the @code{roundf}
+ built-in function uses the mode which corresponds to the C data
+ type @code{float}.
+ 
+ @cindex @code{ceil@var{m}2} instruction pattern
+ @item @samp{ceil@var{m}2}
+ Store the argument rounded to integer away from zero.
+ 
+ The @code{ceil} built-in function of C always uses the mode which
+ corresponds to the C data type @code{double} and the @code{ceilf}
+ built-in function uses the mode which corresponds to the C data
+ type @code{float}.
+ 
+ @cindex @code{nearbyint@var{m}2} instruction pattern
+ @item @samp{nearbyint@var{m}2}
+ Store the argument rounded according to the default rounding mode
+ 
+ The @code{nearbyint} built-in function of C always uses the mode which
+ corresponds to the C data type @code{double} and the @code{nearbyintf}
+ built-in function uses the mode which corresponds to the C data
+ type @code{float}.
+ 
  @cindex @code{ffs@var{m}2} instruction pattern
  @item @samp{ffs@var{m}2}
  Store into operand 0 one plus the index of the least significant 1-bit


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]