public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/88841] Missed optimization transforming cascading ||s into a bit select
[not found] <bug-88841-4@http.gcc.gnu.org/bugzilla/>
@ 2021-12-17 8:35 ` pinskia at gcc dot gnu.org
2021-12-17 8:37 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-17 8:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88841
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Last reconfirmed|2019-01-15 00:00:00 |2021-12-17
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is the full testcase where all three functions should produce the same
assembly code, right now _2 and _3 produce the same and the best code:
bool isspc_1(char c)
{
return c == ' '
|| c == '\n'
|| c == '\r'
|| c == '\t';
}
bool isspc_2(char c)
{
return c == ' '
|| c == '\r'
|| c == '\n'
|| c == '\t';
}
bool isspc_3(char c)
{
switch(c)
{
case ' ':
case '\r':
case '\n':
case '\t':
return 1;
}
return 0;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug tree-optimization/88841] Missed optimization transforming cascading ||s into a bit select
[not found] <bug-88841-4@http.gcc.gnu.org/bugzilla/>
2021-12-17 8:35 ` [Bug tree-optimization/88841] Missed optimization transforming cascading ||s into a bit select pinskia at gcc dot gnu.org
@ 2021-12-17 8:37 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-17 8:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88841
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For the trunk for _2, if_to_switch can convert that one to:
;; Canonical GIMPLE case clusters: 9-10 13 32
;; BT can be built: BT:9-32
Removing basic block 3
Expanded into a new gimple STMT: switch (c_6(D)) <default: <L6> [INV], case 9
... 10: <L5> [INV], case 13: <L5> [INV], case 32: <L5> [INV]>
For _1, we get the following IR (because fold-const decided to convert the ||
to | in some cases already):
_1 = c_8(D) == 32;
_2 = c_8(D) == 10;
_3 = _1 | _2;
if (_3 != 0)
goto <bb 4>; [INV]
else
goto <bb 3>; [INV]
<bb 3> :
_4 = c_8(D) == 13;
_5 = c_8(D) == 9;
_6 = _4 | _5;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-17 8:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-88841-4@http.gcc.gnu.org/bugzilla/>
2021-12-17 8:35 ` [Bug tree-optimization/88841] Missed optimization transforming cascading ||s into a bit select pinskia at gcc dot gnu.org
2021-12-17 8:37 ` pinskia at gcc dot gnu.org
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).