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 target/71336] Suboptimal x86 code generated for "(a & 1) ? (CST1 + CST2) : CST1"


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71336

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
  <bb 2>:
  _1 = a_3(D) & 1;
  if (_1 != 0)
    goto <bb 4>;
  else
    goto <bb 3>;

  <bb 3>:

  <bb 4>:
  # iftmp.0_2 = PHI <7(2), 3(3)>

$op requests

  iftmp.0_2 = _1 * 4;
  _3 = iftmp.0_2 + 3;

I can see how this is profitable only on targets that can do sth like lea,
thus RTL optimization.  GIMPLE might aide here by (always?) using
a COND_EXPR for PHIs with args all defined in the condition block or earlier
(that is, empty BBs feeding the PHI).

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