RE: [PATCH v2] Match: Support __builtin_add_overflow branch form for unsigned SAT_ADD

2024-05-24 Thread Li, Pan2
...@gmail.com; tamar.christ...@arm.com; pins...@gmail.com Subject: Re: [PATCH v2] Match: Support __builtin_add_overflow branch form for unsigned SAT_ADD On Fri, May 24, 2024 at 8:56 AM Richard Biener wrote: > > On Fri, May 24, 2024 at 8:37 AM Li, Pan2 wrote: > > > > Thanks Je

Re: [PATCH v2] Match: Support __builtin_add_overflow branch form for unsigned SAT_ADD

2024-05-24 Thread Richard Biener
Richard. > > Richard. > > > + } > > + > > + return matched_p; > > +} > > + > > /* gimple_simplify_phiopt is like gimple_simplify but designed for PHIOPT. > > Return NULL if nothing can be simplified or the resulting simplified > >

Re: [PATCH v2] Match: Support __builtin_add_overflow branch form for unsigned SAT_ADD

2024-05-23 Thread Richard Biener
c_block cond_bb, > basic_block middle_bb, > So, given the condition COND, and the two PHI arguments, match and > simplify > can happen on (COND) ? arg0 : arg1. */ > > + if (match_phi_to_gimple_cond (cond_bb, phi, arg0, arg1)) > +return true; > + >stmt =

RE: [PATCH v2] Match: Support __builtin_add_overflow branch form for unsigned SAT_ADD

2024-05-23 Thread Li, Pan2
: gcc-patches@gcc.gnu.org; juzhe.zh...@rivai.ai; kito.ch...@gmail.com; tamar.christ...@arm.com; pins...@gmail.com Subject: Re: [PATCH v2] Match: Support __builtin_add_overflow branch form for unsigned SAT_ADD On 5/23/24 6:14 AM, Richard Biener wrote: > On Thu, May 23, 2024 at 1:08 PM Li, Pan2 wrote: &g

Re: [PATCH v2] Match: Support __builtin_add_overflow branch form for unsigned SAT_ADD

2024-05-23 Thread Jeff Law
On 5/23/24 6:14 AM, Richard Biener wrote: On Thu, May 23, 2024 at 1:08 PM Li, Pan2 wrote: I have a try to convert the PHI from Part-A to Part-B, aka PHI to _2 = phi_cond ? _1 : 255. And then we can do the matching on COND_EXPR in the underlying widen-mul pass. Unfortunately, meet some ICE

Re: [PATCH v2] Match: Support __builtin_add_overflow branch form for unsigned SAT_ADD

2024-05-23 Thread Richard Biener
_2 = phi_cond_6 ? _1 : 255; > return _2; > > } > > -Original Message- > From: Li, Pan2 > Sent: Thursday, May 23, 2024 12:17 PM > To: Richard Biener > Cc: gcc-patches@gcc.gnu.org; juzhe.zh...@rivai.ai; kito.ch...@gmail.com; > tamar.christ...@arm.com; pins...@gmail.

RE: [PATCH v2] Match: Support __builtin_add_overflow branch form for unsigned SAT_ADD

2024-05-23 Thread Li, Pan2
: Wednesday, May 22, 2024 9:14 PM To: Li, Pan2 Cc: gcc-patches@gcc.gnu.org; juzhe.zh...@rivai.ai; kito.ch...@gmail.com; tamar.christ...@arm.com; pins...@gmail.com Subject: Re: [PATCH v2] Match: Support __builtin_add_overflow branch form for unsigned SAT_ADD On Wed, May 22, 2024 at 3:17 AM wr

RE: [PATCH v2] Match: Support __builtin_add_overflow branch form for unsigned SAT_ADD

2024-05-22 Thread Li, Pan2
:14 PM To: Li, Pan2 Cc: gcc-patches@gcc.gnu.org; juzhe.zh...@rivai.ai; kito.ch...@gmail.com; tamar.christ...@arm.com; pins...@gmail.com Subject: Re: [PATCH v2] Match: Support __builtin_add_overflow branch form for unsigned SAT_ADD On Wed, May 22, 2024 at 3:17 AM wrote: > >

Re: [PATCH v2] Match: Support __builtin_add_overflow branch form for unsigned SAT_ADD

2024-05-22 Thread Richard Biener
On Wed, May 22, 2024 at 3:17 AM wrote: > > From: Pan Li > > This patch would like to support the __builtin_add_overflow branch form for > unsigned SAT_ADD. For example as below: > > uint64_t > sat_add (uint64_t x, uint64_t y) > { > uint64_t ret; > return __builtin_add_overflow (x, y, &ret) ?