public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
[parent not found: <bug-18908-4@http.gcc.gnu.org/bugzilla/>]
* [Bug middle-end/18908] New: Missed folding opportunities with bools
@ 2004-12-09 17:39 falk at debian dot org
  2004-12-09 17:45 ` [Bug middle-end/18908] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: falk at debian dot org @ 2004-12-09 17:39 UTC (permalink / raw)
  To: gcc-bugs

GNU C version 4.0.0 20041209 (experimental)

_Bool f1(const _Bool *p) { return *p & 1; }
_Bool f2(const _Bool *p) { return *p + 0; }
_Bool f3(_Bool *p) { *p ^= 1; }
_Bool f4(_Bool *p) { *p = ~*p; }

yields

f1:	ldbu    v0,0(a0)
	and     v0,0x1,v0
	ret

f2:	ldbu    v0,0(a0)
	cmpult  zero,v0,v0
	ret

f3:	ldbu    t0,0(a0)
	cmpeq   t0,0x1,t0
	cmpeq   t0,0,t0
	stb     t0,0(a0)
	ret

f4:	ldbu    t0,0(a0)
	not     t0,t0
	sextl   t0,t0
	cmpult  zero,t0,t0
	stb     t0,0(a0)
	ret

all of which contain at least one superfluous instruction.

-- 
           Summary: Missed folding opportunities with bools
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: falk at debian dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: alphaev68-unknown-linux-gnu
  GCC host triplet: alphaev68-unknown-linux-gnu
GCC target triplet: alphaev68-unknown-linux-gnu


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


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

end of thread, other threads:[~2011-07-20 13:37 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-18908-2744@http.gcc.gnu.org/bugzilla/>
2005-11-22 20:57 ` [Bug middle-end/18908] Missed folding opportunities with bools pinskia at gcc dot gnu dot org
2005-11-22 21:00 ` pinskia at gcc dot gnu dot org
2005-11-22 22:24 ` pinskia at gcc dot gnu dot org
2005-11-25  5:06 ` pinskia at gcc dot gnu dot org
2006-02-18 17:32 ` pinskia at gcc dot gnu dot org
2006-03-02 14:21 ` pinskia at gcc dot gnu dot org
2008-04-30 19:27 ` rguenth at gcc dot gnu dot org
2008-04-30 20:01 ` pinskia at gcc dot gnu dot org
     [not found] <bug-18908-4@http.gcc.gnu.org/bugzilla/>
2011-07-18 23:23 ` pinskia at gcc dot gnu.org
2011-07-19  8:07 ` rguenth at gcc dot gnu.org
2011-07-19  8:34 ` rguenth at gcc dot gnu.org
2011-07-19 13:28 ` rguenth at gcc dot gnu.org
2011-07-19 13:31 ` rguenth at gcc dot gnu.org
2011-07-20 13:37 ` rguenth at gcc dot gnu.org
2011-07-20 13:37 ` rguenth at gcc dot gnu.org
2004-12-09 17:39 [Bug middle-end/18908] New: " falk at debian dot org
2004-12-09 17:45 ` [Bug middle-end/18908] " pinskia at gcc dot gnu dot org
2005-04-25 20:42 ` sabre at nondot dot org
2005-05-01 18:25 ` pinskia at gcc dot gnu dot org
2005-05-04  1:52 ` pinskia at gcc dot gnu dot org
2005-05-04 18:15 ` pinskia 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).