On Thu, Jan 06, 2022 at 05:52:03PM +0800, Zhao Wei Liew wrote:
> On Wed, 5 Jan 2022 at 17:55, Richard Biener
> wrote:
>
> > On Wed, Jan 5, 2022 at 10:42 AM Jakub Jelinek wrote:
> > >
> > > On Wed, Jan 05, 2022 at 10:38:53AM +0100, Richard Biener via Gcc-patches
> > wrote:
> > > > On Wed, Jan 5,
On Wed, 5 Jan 2022 at 17:55, Richard Biener
wrote:
> On Wed, Jan 5, 2022 at 10:42 AM Jakub Jelinek wrote:
> >
> > On Wed, Jan 05, 2022 at 10:38:53AM +0100, Richard Biener via Gcc-patches
> wrote:
> > > On Wed, Jan 5, 2022 at 10:18 AM Zhao Wei Liew
> wrote:
> > > >
> > > > > X >= -1 && X <= 1 is
On Wed, Jan 5, 2022 at 10:42 AM Jakub Jelinek wrote:
>
> On Wed, Jan 05, 2022 at 10:38:53AM +0100, Richard Biener via Gcc-patches
> wrote:
> > On Wed, Jan 5, 2022 at 10:18 AM Zhao Wei Liew wrote:
> > >
> > > > X >= -1 && X <= 1 is (hopefully?) going to be simplified
> > > > as (unsigned)X + 1 <
On Wed, Jan 05, 2022 at 10:38:53AM +0100, Richard Biener via Gcc-patches wrote:
> On Wed, Jan 5, 2022 at 10:18 AM Zhao Wei Liew wrote:
> >
> > > X >= -1 && X <= 1 is (hopefully?) going to be simplified
> > > as (unsigned)X + 1 <= 2, it might be good to simplify it this way
> > > here as well?
> >
On Wed, Jan 5, 2022 at 10:18 AM Zhao Wei Liew wrote:
>
> > X >= -1 && X <= 1 is (hopefully?) going to be simplified
> > as (unsigned)X + 1 <= 2, it might be good to simplify it this way
> > here as well?
>
> Yup, GCC does simplify it that way in the end, so I didn't really bother to
> simplify i
> X >= -1 && X <= 1 is (hopefully?) going to be simplified
> as (unsigned)X + 1 <= 2, it might be good to simplify it this way
> here as well?
Yup, GCC does simplify it that way in the end, so I didn't really bother to
simplify it here. That said, I'm open to simplifying it here as well, but
I'm
On Wed, Jan 5, 2022 at 7:15 AM Zhao Wei Liew via Gcc-patches
wrote:
>
> match.pd/95424: Simplify 1 / X for integer X
>
> This patch implements an optimization for the following C++ code:
>
> int f(int x) {
> return 1 / x;
> }
>
> int f(unsigned int x) {
> return 1 / x;
> }
>
> Before this
match.pd/95424: Simplify 1 / X for integer X
This patch implements an optimization for the following C++ code:
int f(int x) {
return 1 / x;
}
int f(unsigned int x) {
return 1 / x;
}
Before this patch, x86-64 gcc -std=c++20 -O3 produces the following
assembly:
f(int):
xor edx, edx