* [Bug rtl-optimization/65651] Redundant cmp with zero instruction in loop for x86 target.
2015-04-01 12:33 [Bug rtl-optimization/65651] New: Redundant cmp with zero instruction in loop for x86 target ysrumyan at gmail dot com
@ 2015-04-01 12:35 ` ysrumyan at gmail dot com
2015-04-01 12:36 ` ysrumyan at gmail dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: ysrumyan at gmail dot com @ 2015-04-01 12:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65651
--- Comment #1 from Yuri Rumyantsev <ysrumyan at gmail dot com> ---
Created attachment 35202
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35202&action=edit
test-case to reproduce
Need to compile with -O2 flag only.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/65651] Redundant cmp with zero instruction in loop for x86 target.
2015-04-01 12:33 [Bug rtl-optimization/65651] New: Redundant cmp with zero instruction in loop for x86 target ysrumyan at gmail dot com
2015-04-01 12:35 ` [Bug rtl-optimization/65651] " ysrumyan at gmail dot com
@ 2015-04-01 12:36 ` ysrumyan at gmail dot com
2015-04-01 13:10 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: ysrumyan at gmail dot com @ 2015-04-01 12:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65651
--- Comment #2 from Yuri Rumyantsev <ysrumyan at gmail dot com> ---
Created attachment 35203
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35203&action=edit
test-case to reproduce
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/65651] Redundant cmp with zero instruction in loop for x86 target.
2015-04-01 12:33 [Bug rtl-optimization/65651] New: Redundant cmp with zero instruction in loop for x86 target ysrumyan at gmail dot com
2015-04-01 12:35 ` [Bug rtl-optimization/65651] " ysrumyan at gmail dot com
2015-04-01 12:36 ` ysrumyan at gmail dot com
@ 2015-04-01 13:10 ` jakub at gcc dot gnu.org
2015-04-01 13:45 ` ysrumyan at gmail dot com
2022-01-10 0:08 ` [Bug target/65651] " pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-01 13:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65651
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |uros at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Well, there is a significant difference between the two testcases, one uses the
result of the comparison just in == 0 test, thus CCZmode is appropriate, the
other uses it in two comparisons, one == 0 test and one < 0 test.
For combine to match *sub<mode>_2 insn, it has to match
ix86_match_ccmode (insn, CCGOCmode)
where CCGOCmode stands for:
Add CCGOC to indicate comparisons against zero that allows
unspecified garbage in the Carry and Overflow flag. This
mode is used to simulate comparisons of (a-b) and (a+b)
against zero using sub/cmp/add operations.
But the jle instruction tests ZF || SF <> OF and thus it isn't appropriate.
So the question is if the CCGOC test isn't too restrictive, say if CCGCmode
would be sufficient (but then we'd still need to arrange for the CCGCmode to be
used, rather than CCmode), or if the optimization you are looking for is simply
not possible.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/65651] Redundant cmp with zero instruction in loop for x86 target.
2015-04-01 12:33 [Bug rtl-optimization/65651] New: Redundant cmp with zero instruction in loop for x86 target ysrumyan at gmail dot com
` (2 preceding siblings ...)
2015-04-01 13:10 ` jakub at gcc dot gnu.org
@ 2015-04-01 13:45 ` ysrumyan at gmail dot com
2022-01-10 0:08 ` [Bug target/65651] " pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ysrumyan at gmail dot com @ 2015-04-01 13:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65651
--- Comment #4 from Yuri Rumyantsev <ysrumyan at gmail dot com> ---
Jakub,
Thanks for your comments.
We will try to fix this issue ourselves.
Best regards.
Yuri.
P.S. Note that icc does not produce such redundant cmp with zero.
2015-04-01 16:10 GMT+03:00 jakub at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65651
>
> Jakub Jelinek <jakub at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> CC| |jakub at gcc dot gnu.org,
> | |uros at gcc dot gnu.org
>
> --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> Well, there is a significant difference between the two testcases, one uses the
> result of the comparison just in == 0 test, thus CCZmode is appropriate, the
> other uses it in two comparisons, one == 0 test and one < 0 test.
> For combine to match *sub<mode>_2 insn, it has to match
> ix86_match_ccmode (insn, CCGOCmode)
> where CCGOCmode stands for:
> Add CCGOC to indicate comparisons against zero that allows
> unspecified garbage in the Carry and Overflow flag. This
> mode is used to simulate comparisons of (a-b) and (a+b)
> against zero using sub/cmp/add operations.
> But the jle instruction tests ZF || SF <> OF and thus it isn't appropriate.
> So the question is if the CCGOC test isn't too restrictive, say if CCGCmode
> would be sufficient (but then we'd still need to arrange for the CCGCmode to be
> used, rather than CCmode), or if the optimization you are looking for is simply
> not possible.
>
> --
> You are receiving this mail because:
> You reported the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/65651] Redundant cmp with zero instruction in loop for x86 target.
2015-04-01 12:33 [Bug rtl-optimization/65651] New: Redundant cmp with zero instruction in loop for x86 target ysrumyan at gmail dot com
` (3 preceding siblings ...)
2015-04-01 13:45 ` ysrumyan at gmail dot com
@ 2022-01-10 0:08 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-10 0:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65651
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2022-01-10
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed on the trunk still:
subl %r9d, %eax
testl %eax, %eax
jne .L4
^ permalink raw reply [flat|nested] 6+ messages in thread