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/18908] Missed folding opportunities with bools



------- Comment #11 from rguenth at gcc dot gnu dot org  2008-04-30 19:26 -------
On the trunk we have:

f1 (const _Bool * p)
{
<bb 2>:
  return (_Bool) ((int) *p & 1);

f2 (const _Bool * p)
{
<bb 2>:
  return *p;

f3 (_Bool * p)
{
<bb 2>:
  *p = (_Bool) !*p;

f4 (_Bool * p)
{
<bb 2>:
  *p = 1;

where i686 assembly looks good for all cases.

Still f4 looks weird (wrong-code?!) as we fold *p = ~*p to *p = (int) *p != -1;
I'll open a PR for this.


-- 


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


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