public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Target dependence of conditional expression gimplification
@ 2014-03-03 12:04 Florian Weimer
  2014-05-05 15:05 ` Florian Weimer
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2014-03-03 12:04 UTC (permalink / raw)
  To: gcc-help

I have code like this:

      if (auth_info->attrs.pin.flags & SC_PKCS15_PIN_FLAG_SO_PIN) {
         preferred = 1;
     } else {
         preferred = current;
         /* PINs are even numbered, PUKs are odd */
         if (!(preferred & 1))
             preferred++;
         if (preferred >= 126)
             return SC_ERROR_TOO_MANY_OBJECTS;
     }

     if (current > preferred || preferred > CARDOS_PIN_ID_MAX)
         return SC_ERROR_TOO_MANY_OBJECTS;

On x86_64, the condition in the final if statement is gimplified as:

-  D.8003 = current > preferred;
-  D.8004 = preferred > 15;
-  D.8005 = D.8003 | D.8004;
-  if (D.8005 != 0) goto <D.8006>; else goto <D.8007>;

On rs6000 (-mtune=power7 -mcpu=power7), I get this instead:

+  if (current > preferred) goto <D.8376>; else goto <D.8378>;
+  <D.8378>:
+  if (preferred > 15) goto <D.8376>; else goto <D.8377>;

Obviously, this affects optimization-dependent warnings later in the 
compilation.

I wonder why this happens.  Shouldn't gimplification be roughly 
target-independent?

-- 
Florian Weimer / Red Hat Product Security Team

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

end of thread, other threads:[~2014-05-06 12:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-03 12:04 Target dependence of conditional expression gimplification Florian Weimer
2014-05-05 15:05 ` Florian Weimer
2014-05-05 16:01   ` Manuel López-Ibáñez
2014-05-05 16:11   ` Jeff Law
2014-05-06  8:24     ` Florian Weimer
2014-05-06 12:16       ` Jeff Law

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).