public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/37780] Conditional expression with __builtin_clz() should be optimized out
       [not found] <bug-37780-4@http.gcc.gnu.org/bugzilla/>
@ 2012-03-20  8:31 ` amker.cheng at gmail dot com
  0 siblings, 0 replies; 2+ messages in thread
From: amker.cheng at gmail dot com @ 2012-03-20  8:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from amker.cheng <amker.cheng at gmail dot com> 2012-03-20 07:58:09 UTC ---
the special case could be easily detected when gimplifying.
but actually I am not sure whether it can be done even in middle end, since the
middle end should not depend on any target information, like
CLZ_DEFINED_VALUE_AT_ZERO, right?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug middle-end/37780] Conditional expression with __builtin_clz() should be optimized out
  2008-10-09  7:13 [Bug fortran/37780] New: Optimize LEADZ/TRAILZ for zero arguments burnus at gcc dot gnu dot org
@ 2009-03-28 16:33 ` fxcoudert at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-03-28 16:33 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-20  7:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-37780-4@http.gcc.gnu.org/bugzilla/>
2012-03-20  8:31 ` [Bug middle-end/37780] Conditional expression with __builtin_clz() should be optimized out amker.cheng at gmail dot com
2008-10-09  7:13 [Bug fortran/37780] New: Optimize LEADZ/TRAILZ for zero arguments burnus at gcc dot gnu dot org
2009-03-28 16:33 ` [Bug middle-end/37780] Conditional expression with __builtin_clz() should be optimized out fxcoudert at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).