[PATCH]: Add some folding of builtins fmin/fmax

Roger Sayle roger@eyesopen.com
Sat Nov 18 21:09:00 GMT 2006

On Tue, 14 Nov 2006, Kaveh R. GHAZI wrote:
> I'm not able to implement Roger's more elaborate solution here:
> http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00665.html

Not to worry.  That's a longer term plan, and if anything this
patch gets us a big step closer.

> 2006-11-13  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
> 	* builtins.c (integer_valued_real_p): Handle fmin/fmax.
> 	(fold_builtin_fmin_fmax): New.
> 	(fold_builtin_1): Use it.
> 	* gcc.dg/builtins-20.c: Add fmin/fmax cases.
> 	* gcc.dg/torture/builtin-minmax-1.c: New.

This is OK for mainline.

I'm sure you've already got it queued, but you can now easily add
fmin(x,NaN) -> x and fmin(NaN,y) -> y to your new fold_builtin_fmin_fmax.


More information about the Gcc-patches mailing list