Re: [PATCH] x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns

2022-11-01 Thread Eric Botcazou via Gcc-patches
> Yes. But it is all the same: neither signed overflow nor unsigned > overflow (of an addition, say) can be described as the result of an > RTL comparison. I disagree, see for example the implementation of the addvdi4_sp3 pattern (for which we indeed use an UNSPEC) and of the uaddvdi4_sp32

Re: [PATCH] x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns

2022-11-01 Thread Segher Boessenkool
On Fri, Oct 28, 2022 at 11:55:35PM +0200, Eric Botcazou wrote: > > You mean in CCV? That works yes, but only because (or if) the setter > > and getter of the CC reg both use CCV (so never use any other flag at > > the same time; CCV has an empty intersection with all other CC modes). > > We're

Re: [PATCH] x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns

2022-10-28 Thread H.J. Lu via Gcc-patches
On Fri, Oct 28, 2022 at 2:34 PM Segher Boessenkool wrote: > > On Wed, Oct 26, 2022 at 11:58:57AM -0700, H.J. Lu via Gcc-patches wrote: > > In i386.md, neg patterns which set MODE_CC register like > > > > (set (reg:CCC FLAGS_REG) > > (ne:CCC (match_operand:SWI48 1 "general_reg_operand")

Re: [PATCH] x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns

2022-10-28 Thread Eric Botcazou via Gcc-patches
> You mean in CCV? That works yes, but only because (or if) the setter > and getter of the CC reg both use CCV (so never use any other flag at > the same time; CCV has an empty intersection with all other CC modes). We're talking about CCC here AFAIK, i.e. the carry, not CCV. -- Eric Botcazou

Re: [PATCH] x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns

2022-10-28 Thread Segher Boessenkool
Hi! On Fri, Oct 28, 2022 at 10:35:03AM +0200, Eric Botcazou via Gcc-patches wrote: > > (set (reg:SI 93) > > (neg:SI (ltu:SI (reg:CCC 17 flags) (const_int 0 [0] > > > > as > > > > (set (reg:SI 93) > > (neg:SI (ltu:SI (const_int 1) (const_int 0 [0] > > > > which leads to

Re: [PATCH] x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns

2022-10-28 Thread Segher Boessenkool
On Wed, Oct 26, 2022 at 11:58:57AM -0700, H.J. Lu via Gcc-patches wrote: > In i386.md, neg patterns which set MODE_CC register like > > (set (reg:CCC FLAGS_REG) > (ne:CCC (match_operand:SWI48 1 "general_reg_operand") (const_int 0))) > > can lead to errors when operand 1 is a constant value.

Re: [PATCH] x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns

2022-10-28 Thread Eric Botcazou via Gcc-patches
> COMPARE may also set CC register to a constant when both operands are > known constants. No, a COMPARE is never evaluated alone, only the CC user may be evaluated. -- Eric Botcazou

Re: [PATCH] x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns

2022-10-28 Thread H.J. Lu via Gcc-patches
On Fri, Oct 28, 2022 at 1:35 AM Eric Botcazou wrote: > > > (set (reg:SI 93) > > (neg:SI (ltu:SI (reg:CCC 17 flags) (const_int 0 [0] > > > > as > > > > (set (reg:SI 93) > > (neg:SI (ltu:SI (const_int 1) (const_int 0 [0] > > > > which leads to incorrect results since LTU on

Re: [PATCH] x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns

2022-10-28 Thread Eric Botcazou via Gcc-patches
> (set (reg:SI 93) > (neg:SI (ltu:SI (reg:CCC 17 flags) (const_int 0 [0] > > as > > (set (reg:SI 93) > (neg:SI (ltu:SI (const_int 1) (const_int 0 [0] > > which leads to incorrect results since LTU on MODE_CC register isn't the > same as "unsigned less than" in x86 backend.

Re: [PATCH] x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns

2022-10-28 Thread Hongtao Liu via Gcc-patches
On Fri, Oct 28, 2022 at 1:56 PM Hongtao Liu wrote: > > On Thu, Oct 27, 2022 at 2:59 AM H.J. Lu via Gcc-patches > wrote: > > > > In i386.md, neg patterns which set MODE_CC register like > > > > (set (reg:CCC FLAGS_REG) > > (ne:CCC (match_operand:SWI48 1 "general_reg_operand") (const_int 0)))

Re: [PATCH] x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns

2022-10-27 Thread Hongtao Liu via Gcc-patches
On Thu, Oct 27, 2022 at 2:59 AM H.J. Lu via Gcc-patches wrote: > > In i386.md, neg patterns which set MODE_CC register like > > (set (reg:CCC FLAGS_REG) > (ne:CCC (match_operand:SWI48 1 "general_reg_operand") (const_int 0))) > > can lead to errors when operand 1 is a constant value. If

Re: [PATCH] x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns

2022-10-27 Thread Uros Bizjak via Gcc-patches
On Wed, Oct 26, 2022 at 8:59 PM H.J. Lu wrote: > > In i386.md, neg patterns which set MODE_CC register like > > (set (reg:CCC FLAGS_REG) > (ne:CCC (match_operand:SWI48 1 "general_reg_operand") (const_int 0))) > > can lead to errors when operand 1 is a constant value. If FLAGS_REG in > >

[PATCH] x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns

2022-10-26 Thread H.J. Lu via Gcc-patches
In i386.md, neg patterns which set MODE_CC register like (set (reg:CCC FLAGS_REG) (ne:CCC (match_operand:SWI48 1 "general_reg_operand") (const_int 0))) can lead to errors when operand 1 is a constant value. If FLAGS_REG in (set (reg:CCC FLAGS_REG) (ne:CCC (const_int 2) (const_int