This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/18041] OR of two single-bit bitfields is inefficient


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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-06 13:23:11 UTC ---
Mine.  With bitfield lowering I see

<bb 2>:
  BF.0_2 = MEM[(struct B *)b_1(D)];
  D.2686_3 = (<unnamed-unsigned:1>) BF.0_2;
  D.2687_4 = (unsigned char) D.2686_3;
  D.2694_6 = BF.0_2 >> 1;
  D.2688_7 = (<unnamed-unsigned:1>) D.2694_6;
  D.2689_8 = (unsigned char) D.2688_7;
  D.2690_9 = D.2689_8 | D.2687_4;
  D.2691_10 = (<unnamed-unsigned:1>) D.2690_9;
  D.2696_12 = BF.0_2 & 4294967294;
  D.2697_13 = (unsigned int) D.2691_10;
  BF.2_14 = D.2697_13 | D.2696_12;
  MEM[(struct B *)b_1(D)] = BF.2_14;
  return;

there is the possibility to associate truncations/widenings with |& so
D.2689_8 | D.2687_4 becomes (unsigned char) D.2688_7 | D.2686_3
and the truncation (<unnamed-unsigned:1>) D.2690_9 can be combined
with it.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]