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 tree-optimization/40052] missed optimizations on (extended) logical types: (x | 1) --> 1



------- Comment #2 from rguenth at gcc dot gnu dot org  2009-05-07 09:36 -------
Of course this only works if logicals are zero-extended.

We manage to fold

int foo(unsigned char b)
{
  return b | 0xff;
}

but not

int bar(unsigned char b)
{
  return b & (~0 << 8);
}

appearantly because the C FE for the former generates (int) (b | 255)
because of some premature optimization in build_binary_op.

We still do not fold

int foo(unsigned char b)
{
  return b | 0xfff;
}


-- 


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


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