> Just the first patch - I didn't have time to look at the second one yet.
I see, thanks a lot. Pan -----Original Message----- From: Richard Biener <richard.guent...@gmail.com> Sent: Tuesday, November 12, 2024 10:39 PM To: Li, Pan2 <pan2...@intel.com> Cc: gcc-patches@gcc.gnu.org; tamar.christ...@arm.com; juzhe.zh...@rivai.ai; kito.ch...@gmail.com; jeffreya...@gmail.com; rdapp....@gmail.com Subject: Re: [PATCH v1 1/2] Revert "Match: Simplify branch form 3 of unsigned SAT_ADD into branchless" On Tue, Nov 12, 2024 at 3:18 PM Li, Pan2 <pan2...@intel.com> wrote: > > Thanks Richard for reviewing. > > > OK. > > Sorry for disturbing, is the approval for the series or just the first patch. Just the first patch - I didn't have time to look at the second one yet. Richard. > Pan > > -----Original Message----- > From: Richard Biener <richard.guent...@gmail.com> > Sent: Tuesday, November 12, 2024 8:16 PM > To: Li, Pan2 <pan2...@intel.com> > Cc: gcc-patches@gcc.gnu.org; tamar.christ...@arm.com; juzhe.zh...@rivai.ai; > kito.ch...@gmail.com; jeffreya...@gmail.com; rdapp....@gmail.com > Subject: Re: [PATCH v1 1/2] Revert "Match: Simplify branch form 3 of unsigned > SAT_ADD into branchless" > > On Mon, Nov 11, 2024 at 9:46 AM <pan2...@intel.com> wrote: > > > > From: Pan Li <pan2...@intel.com> > > > > This reverts commit df4af89bc3eabbeaccb16539aa1082cb9863e187. > > OK. > > > --- > > gcc/match.pd | 11 ++++------- > > .../gcc.dg/tree-ssa/sat_u_add-simplify-1-u16.c | 15 --------------- > > .../gcc.dg/tree-ssa/sat_u_add-simplify-1-u32.c | 15 --------------- > > .../gcc.dg/tree-ssa/sat_u_add-simplify-1-u64.c | 15 --------------- > > .../gcc.dg/tree-ssa/sat_u_add-simplify-1-u8.c | 15 --------------- > > 5 files changed, 4 insertions(+), 67 deletions(-) > > delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u16.c > > delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u32.c > > delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u64.c > > delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u8.c > > > > diff --git a/gcc/match.pd b/gcc/match.pd > > index 00988241348..af3272eac55 100644 > > --- a/gcc/match.pd > > +++ b/gcc/match.pd > > @@ -3146,13 +3146,10 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > > (match (unsigned_integer_sat_add @0 @1) > > (bit_ior:c (usadd_left_part_2 @0 @1) (usadd_right_part_2 @0 @1))) > > > > -/* Simplify SAT_U_ADD to the cheap form > > - From: SAT_U_ADD = (X + Y) >= x ? (X + Y) : -1. > > - To: SAT_U_ADD = (X + Y) | - ((X + Y) < X). */ > > -(simplify (cond (ge (plus:c@2 @0 @1) @0) @2 integer_minus_onep) > > - (if (INTEGRAL_TYPE_P (type) && TYPE_UNSIGNED (type) > > - && types_match (type, @0, @1)) > > - (bit_ior @2 (negate (convert (lt @2 @0)))))) > > +/* Unsigned saturation add, case 3 (branch with ge): > > + SAT_U_ADD = (X + Y) >= x ? (X + Y) : -1. */ > > +(match (unsigned_integer_sat_add @0 @1) > > + (cond^ (ge (usadd_left_part_1@2 @0 @1) @0) @2 integer_minus_onep)) > > > > /* Unsigned saturation add, case 4 (branch with lt): > > SAT_U_ADD = (X + Y) < x ? -1 : (X + Y). */ > > diff --git a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u16.c > > b/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u16.c > > deleted file mode 100644 > > index 7617fbaca45..00000000000 > > --- a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u16.c > > +++ /dev/null > > @@ -1,15 +0,0 @@ > > -/* { dg-do compile } */ > > -/* { dg-options "-O2 -fdump-tree-gimple-details" } */ > > - > > -#include <stdint.h> > > - > > -#define T uint16_t > > - > > -T sat_add_u_1 (T x, T y) > > -{ > > - return (T)(x + y) >= x ? (x + y) : -1; > > -} > > - > > -/* { dg-final { scan-tree-dump-not " if " "gimple" } } */ > > -/* { dg-final { scan-tree-dump-not " else " "gimple" } } */ > > -/* { dg-final { scan-tree-dump-not " goto " "gimple" } } */ > > diff --git a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u32.c > > b/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u32.c > > deleted file mode 100644 > > index efea85bfbb7..00000000000 > > --- a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u32.c > > +++ /dev/null > > @@ -1,15 +0,0 @@ > > -/* { dg-do compile } */ > > -/* { dg-options "-O2 -fdump-tree-gimple-details" } */ > > - > > -#include <stdint.h> > > - > > -#define T uint32_t > > - > > -T sat_add_u_1 (T x, T y) > > -{ > > - return (T)(x + y) >= x ? (x + y) : -1; > > -} > > - > > -/* { dg-final { scan-tree-dump-not " if " "gimple" } } */ > > -/* { dg-final { scan-tree-dump-not " else " "gimple" } } */ > > -/* { dg-final { scan-tree-dump-not " goto " "gimple" } } */ > > diff --git a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u64.c > > b/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u64.c > > deleted file mode 100644 > > index b7b55d72ede..00000000000 > > --- a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u64.c > > +++ /dev/null > > @@ -1,15 +0,0 @@ > > -/* { dg-do compile } */ > > -/* { dg-options "-O2 -fdump-tree-gimple-details" } */ > > - > > -#include <stdint.h> > > - > > -#define T uint64_t > > - > > -T sat_add_u_1 (T x, T y) > > -{ > > - return (T)(x + y) >= x ? (x + y) : -1; > > -} > > - > > -/* { dg-final { scan-tree-dump-not " if " "gimple" } } */ > > -/* { dg-final { scan-tree-dump-not " else " "gimple" } } */ > > -/* { dg-final { scan-tree-dump-not " goto " "gimple" } } */ > > diff --git a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u8.c > > b/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u8.c > > deleted file mode 100644 > > index 77e9af3dd29..00000000000 > > --- a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u8.c > > +++ /dev/null > > @@ -1,15 +0,0 @@ > > -/* { dg-do compile } */ > > -/* { dg-options "-O2 -fdump-tree-gimple-details" } */ > > - > > -#include <stdint.h> > > - > > -#define T uint8_t > > - > > -T sat_add_u_1 (T x, T y) > > -{ > > - return (T)(x + y) >= x ? (x + y) : -1; > > -} > > - > > -/* { dg-final { scan-tree-dump-not " if " "gimple" } } */ > > -/* { dg-final { scan-tree-dump-not " else " "gimple" } } */ > > -/* { dg-final { scan-tree-dump-not " goto " "gimple" } } */ > > -- > > 2.43.0 > >