This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/71336] Suboptimal x86 code generated for "(a & 1) ? (CST1 + CST2) : CST1"
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 30 May 2016 08:08:29 +0000
- Subject: [Bug target/71336] Suboptimal x86 code generated for "(a & 1) ? (CST1 + CST2) : CST1"
- Auto-submitted: auto-generated
- References: <bug-71336-4 at http dot gcc dot gnu dot org/bugzilla/>
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).