[Bug target/93002] while(i--) optimization

2021-12-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93002 Andrew Pinski changed: What|Removed |Added Severity|normal |enhancement

[Bug target/93002] while(i--) optimization

2020-01-08 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93002 --- Comment #10 from Jakub Jelinek --- The originally reported issue is fixed. Though, the following testcase shows we could do better: void foo (void); void bar (unsigned); unsigned f1 (unsigned x) { if (--x == -1U) foo (); return x; } unsigned

[Bug target/93002] while(i--) optimization

2020-01-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93002 --- Comment #9 from Richard Biener --- Fixed on trunk? countdown_i_used: .LFB0: .cfi_startproc movl$999, %eax .p2align 4,,10 .p2align 3 .L2: movl%eax, sink(%rip) subl$1, %eax jn

[Bug target/93002] while(i--) optimization

2019-12-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93002 --- Comment #8 from Jakub Jelinek --- Author: jakub Date: Fri Dec 20 08:22:46 2019 New Revision: 279632 URL: https://gcc.gnu.org/viewcvs?rev=279632&root=gcc&view=rev Log: PR target/93002 * config/i386/i386.md (dec reg; cmp $-1, r

[Bug target/93002] while(i--) optimization

2019-12-19 Thread getchar_gnu at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93002 --- Comment #7 from getchar_gnu at hotmail dot com --- Actually for `while (i--) sink=i;` with knowledge that `i!=0` it's valid to compile as .L11: subl$1, %edi movl%edi, sink(%rip) jne .L11 ret whic

[Bug target/93002] while(i--) optimization

2019-12-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93002 --- Comment #6 from Jakub Jelinek --- Created attachment 47525 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47525&action=edit gcc10-pr93002.patch Untested patch doing this the peephole2 way.

[Bug target/93002] while(i--) optimization

2019-12-19 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93002 --- Comment #5 from Uroš Bizjak --- (In reply to Uroš Bizjak from comment #4) > > Maybe we can introduce the above insn as insn_and_split pattern that is > later split to CCmode insns? cmpelim pass will then be able to synthesize > the insn. Ah

[Bug target/93002] while(i--) optimization

2019-12-19 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93002 --- Comment #4 from Uroš Bizjak --- (In reply to Jakub Jelinek from comment #2) > The question is where to do that. Is that something ivopts should do > (perhaps based on some rtl cost or whatever), or shall it be done during > expansion (unfort

[Bug target/93002] while(i--) optimization

2019-12-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93002 --- Comment #3 from Jakub Jelinek --- The peephole2, if we go that way, would need to change something like: (insn 8 7 10 3 (parallel [ (set (reg/v:SI 0 ax [orig:82 i ] [82]) (plus:SI (reg/v:SI 0 ax [orig:82 i ] [82])

[Bug target/93002] while(i--) optimization

2019-12-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93002 Jakub Jelinek changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed|

[Bug target/93002] while(i--) optimization

2019-12-18 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93002 Andrew Pinski changed: What|Removed |Added Target||x86_64-linux-gnu --- Comment #1 from And