Re: [PATCH V3] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-07-04 Thread Jiufu Guo via Gcc-patches
Hi Richard/Andrew! Richard Biener writes: > On Thu, 29 Jun 2023, Jiufu Guo wrote: > >> >> Hi, >> >> Jiufu Guo writes: >> >> > Hi, >> > >> > Integer expression "(X - N * M) / N" can be optimized to "X / N - M" if >> > there is no wrap/overflow/underflow and "X - N * M" has the same sign >>

Re: [PATCH V3] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-07-04 Thread Richard Biener via Gcc-patches
On Thu, 29 Jun 2023, Jiufu Guo wrote: > > Hi, > > Jiufu Guo writes: > > > Hi, > > > > Integer expression "(X - N * M) / N" can be optimized to "X / N - M" if > > there is no wrap/overflow/underflow and "X - N * M" has the same sign > > with "X". > > > > Compare with the previous version: > >

Re: [PATCH V3] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-06-28 Thread Jiufu Guo via Gcc-patches
Hi, Jiufu Guo writes: > Hi, > > Integer expression "(X - N * M) / N" can be optimized to "X / N - M" if > there is no wrap/overflow/underflow and "X - N * M" has the same sign > with "X". > > Compare with the previous version: > https://gcc.gnu.org/pipermail/gcc-patches/2023-June/620896.html

[PATCH V3] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-06-28 Thread Jiufu Guo via Gcc-patches
Hi, Integer expression "(X - N * M) / N" can be optimized to "X / N - M" if there is no wrap/overflow/underflow and "X - N * M" has the same sign with "X". Compare with the previous version: https://gcc.gnu.org/pipermail/gcc-patches/2023-June/620896.html This version changes: 1. Remove the