[PATCH] implement rint{,f,l}, floor{,f,l}. ceil{,f,l}, trunc{,f,l} and nearbyint{,f,l} as x87 built-in functions

Richard Henderson rth@redhat.com
Wed Aug 25 19:10:00 GMT 2004

On Wed, Aug 25, 2004 at 01:44:47PM +0200, Uros Bizjak wrote:
> Also, BUILT_IN_RINT{,F,L} can be treated as BUILT_IN_NEARBYINT{,F,L}.

Excuse me?

       The nearbyint functions round their argument to  an  integer  value  in
       floating point format, using the current rounding direction and without
       raising the inexact exception.
       The rint functions do the same, but will raise  the  inexact  exception
       when the result differs in value from the argument.

This has nothing at all to do with the exception enable bit in the fpucw.

> +(define_attr "i387cw" "any,floor,ceil,trunc,exception"
> +  (const_string "any"))

This is a good idea, except that it should replace

> +enum i387_cw_mode {FP_CW_FLOOR, FP_CW_CEIL, FP_CW_TRUNC,

this, so that you don't have to translate between them.


More information about the Gcc-patches mailing list