[Bug middle-end/37780] Conditional expression with __builtin_clz() should be optimized out

fxcoudert at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Mar 28 16:33:00 GMT 2009



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2009-03-28 16:33 -------
This is not a Fortran issue, it should be done in the middle-end. On platforms
that have a defined value for __builtin_clz(0), the conditional in the function
below should be optimized out:

int foo (int i)
{
  return (i == 0) ? sizeof (int) * 8 : __builtin_clz (i);
}

Targets where this is expected to be an issue are: alpha, cris, rs6000, m68k,
arm and s390.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|fortran                     |middle-end
     Ever Confirmed|0                           |1
 GCC target triplet|                            |CLZ_DEFINED_VALUE_AT_ZERO !=
                   |                            |0
   Last reconfirmed|0000-00-00 00:00:00         |2009-03-28 16:33:36
               date|                            |
            Summary|Optimize LEADZ/TRAILZ for   |Conditional expression with
                   |zero arguments              |__builtin_clz() should be
                   |                            |optimized out


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37780



More information about the Gcc-bugs mailing list