------- Comment #4 from rguenth at gcc dot gnu dot org 2008-04-29 10:01 ------- The ifcombine pass would do this since 4.3.0 if there were not an extra conversion for a bittest of bit zero:
<bb 2>: a.0_2 = (int) a_1(D); D.1556_3 = a.0_2 & 1; if (D.1556_3 != 0) goto <bb 4> (heaven); else goto <bb 3>; <bb 3>: D.1558_5 = a_1(D) & 4; if (D.1558_5 != 0) goto <bb 4> (heaven); else goto <bb 5>; this is probably due to fold. I will have a look. For void foo (unsigned int a) { if (a & 2) goto heaven; if (a & 4) goto heaven; return; heaven: bar (); } this is optimized to optimizing bits or bits test to a_1(D) & T != 0 with temporary T = 4 | 2 Merging blocks 2 and 3 foo (unsigned int a) { unsigned int D.1583; unsigned int D.1556; unsigned int D.1555; <bb 2>: D.1555_2 = a_1(D) & 2; D.1556_3 = a_1(D) & 4; D.1583_5 = a_1(D) & 6; if (D.1583_5 != 0) goto <bb 3> (heaven); else goto <bb 4>; Invalid sum of incoming frequencies 6100, should be 7231 heaven:; bar (); <bb 4>: Invalid sum of incoming frequencies 11131, should be 10000 return; } -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2006-02-05 21:36:17 |2008-04-29 10:01:23 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14847