From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id B251C3858D20 for ; Thu, 31 Aug 2023 12:18:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B251C3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2bcb89b4767so13106061fa.3 for ; Thu, 31 Aug 2023 05:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693484285; x=1694089085; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Kt7Gi6pYJRHyErxb9CmyXIqNVbwbQPPnPZg1OuxoFJQ=; b=K/NiXWK/QieAKfh9wy1HAhXqdPt6bRSCAM3yyAUVplFpj5GiOrNg4Bb+AilQApZcrk GQaUgWR/NODtCYbehHpIFv5yIvPgGjqL3i7N+eVpJSzG8LYGxC2M1QyzBlWbaLkw8Hrs gjk2MkLI2J2Yo5vbFPSZkyMy0od4spu51we2HCM3VxfW9Pgf+v3sYbjpvg9sp0zCunel s9huo+Rwj5gjPlO8d2toqwwX6+fFMqFeAzv8U+m9U57Wns6mkCKQA556690Nwfm0yv8e 2Luvr1CEdofk8IkEU79w870xkJ8QOpxgO0s1bYv+CdkE8d+znMGecGH0vXa0qRf1/MFd L7gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693484285; x=1694089085; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kt7Gi6pYJRHyErxb9CmyXIqNVbwbQPPnPZg1OuxoFJQ=; b=Vi2JXzNVM+Tr2LtvrcJ5Lx+Tjl+U/Y6MepOy8+UkVBVOELoZBBfBUJvzNNfrwJfeq1 2e847UVdcUID08Nex1HaLqv5g7FmIAVgoP5XiqnPcGksmqkkVmFPToif0Ok+WTrlVFse 7Q4N9DVqdmSNBB6RUdavq8zB+klvRPrEiWFBhUlDjkxruBR1T50W1qPAp7Km+3LDBX9G 0qpWUtai9q56Nv4m4GY2BTPId4pRaP8w24D6J0FBQ6TbK8AKLo40n51iN9od6wjpVwnU LIJVY+AlLOc6Wj5r7cZ/KIQT5dHJwfcFlyycgnvbQYTBj0JZkFlQsGwJ9g7SN6dPwxBq GHTQ== X-Gm-Message-State: AOJu0YwJJ2eB1vHEOCYZKSV2Twx9vdftvNziaaAGYYkdj7X1YD1UgPxk LupwaY4/65S31y/3R1eak/md+VNZAp6ww4xDq0U= X-Google-Smtp-Source: AGHT+IEwrpM1BhS7g6/9MMB6qHyLtZCHN3nNM5BZNcgB9jeP5M0ViidTm1o+pHc8ihxxSqy1sJjcQq02STIuMN7RYzE= X-Received: by 2002:a2e:9ed3:0:b0:2bb:a14c:f6de with SMTP id h19-20020a2e9ed3000000b002bba14cf6demr4361583ljk.21.1693484284629; Thu, 31 Aug 2023 05:18:04 -0700 (PDT) MIME-Version: 1.0 References: <20230830222511.685346-1-apinski@marvell.com> In-Reply-To: <20230830222511.685346-1-apinski@marvell.com> From: Richard Biener Date: Thu, 31 Aug 2023 14:16:22 +0200 Message-ID: Subject: Re: [PATCH] MATCH: extend min_value/max_value match to vectors To: Andrew Pinski Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Aug 31, 2023 at 12:27=E2=80=AFAM Andrew Pinski via Gcc-patches wrote: > > This simple patch extends the min_value/max_value match to vector integer= types. > Using uniform_integer_cst_p makes this easy. > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. > > The testcases pr110915-*.c are the same as pr88784-*.c except using vecto= r > types instead. OK. > PR tree-optimization/110915 > > gcc/ChangeLog: > > * match.pd (min_value, max_value): Extend to vector constants. > > gcc/testsuite/ChangeLog: > > * gcc.dg/pr110915-1.c: New test. > * gcc.dg/pr110915-10.c: New test. > * gcc.dg/pr110915-11.c: New test. > * gcc.dg/pr110915-12.c: New test. > * gcc.dg/pr110915-2.c: New test. > * gcc.dg/pr110915-3.c: New test. > * gcc.dg/pr110915-4.c: New test. > * gcc.dg/pr110915-5.c: New test. > * gcc.dg/pr110915-6.c: New test. > * gcc.dg/pr110915-7.c: New test. > * gcc.dg/pr110915-8.c: New test. > * gcc.dg/pr110915-9.c: New test. > --- > gcc/match.pd | 24 ++++++++++++++-------- > gcc/testsuite/gcc.dg/pr110915-1.c | 31 ++++++++++++++++++++++++++++ > gcc/testsuite/gcc.dg/pr110915-10.c | 33 ++++++++++++++++++++++++++++++ > gcc/testsuite/gcc.dg/pr110915-11.c | 31 ++++++++++++++++++++++++++++ > gcc/testsuite/gcc.dg/pr110915-12.c | 31 ++++++++++++++++++++++++++++ > gcc/testsuite/gcc.dg/pr110915-2.c | 31 ++++++++++++++++++++++++++++ > gcc/testsuite/gcc.dg/pr110915-3.c | 33 ++++++++++++++++++++++++++++++ > gcc/testsuite/gcc.dg/pr110915-4.c | 33 ++++++++++++++++++++++++++++++ > gcc/testsuite/gcc.dg/pr110915-5.c | 32 +++++++++++++++++++++++++++++ > gcc/testsuite/gcc.dg/pr110915-6.c | 32 +++++++++++++++++++++++++++++ > gcc/testsuite/gcc.dg/pr110915-7.c | 32 +++++++++++++++++++++++++++++ > gcc/testsuite/gcc.dg/pr110915-8.c | 32 +++++++++++++++++++++++++++++ > gcc/testsuite/gcc.dg/pr110915-9.c | 33 ++++++++++++++++++++++++++++++ > 13 files changed, 400 insertions(+), 8 deletions(-) > create mode 100644 gcc/testsuite/gcc.dg/pr110915-1.c > create mode 100644 gcc/testsuite/gcc.dg/pr110915-10.c > create mode 100644 gcc/testsuite/gcc.dg/pr110915-11.c > create mode 100644 gcc/testsuite/gcc.dg/pr110915-12.c > create mode 100644 gcc/testsuite/gcc.dg/pr110915-2.c > create mode 100644 gcc/testsuite/gcc.dg/pr110915-3.c > create mode 100644 gcc/testsuite/gcc.dg/pr110915-4.c > create mode 100644 gcc/testsuite/gcc.dg/pr110915-5.c > create mode 100644 gcc/testsuite/gcc.dg/pr110915-6.c > create mode 100644 gcc/testsuite/gcc.dg/pr110915-7.c > create mode 100644 gcc/testsuite/gcc.dg/pr110915-8.c > create mode 100644 gcc/testsuite/gcc.dg/pr110915-9.c > > diff --git a/gcc/match.pd b/gcc/match.pd > index 6a7edde5736..c01362ee359 100644 > --- a/gcc/match.pd > +++ b/gcc/match.pd > @@ -2750,16 +2750,24 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > & (bitpos / BITS_PER_UNIT))); })))) > > (match min_value > - INTEGER_CST > - (if ((INTEGRAL_TYPE_P (type) > - || POINTER_TYPE_P(type)) > - && wi::eq_p (wi::to_wide (t), wi::min_value (type))))) > + uniform_integer_cst_p > + (with { > + tree int_cst =3D uniform_integer_cst_p (t); > + tree inner_type =3D TREE_TYPE (int_cst); > + } > + (if ((INTEGRAL_TYPE_P (inner_type) > + || POINTER_TYPE_P (inner_type)) > + && wi::eq_p (wi::to_wide (int_cst), wi::min_value (inner_type))))= )) > > (match max_value > - INTEGER_CST > - (if ((INTEGRAL_TYPE_P (type) > - || POINTER_TYPE_P(type)) > - && wi::eq_p (wi::to_wide (t), wi::max_value (type))))) > + uniform_integer_cst_p > + (with { > + tree int_cst =3D uniform_integer_cst_p (t); > + tree itype =3D TREE_TYPE (int_cst); > + } > + (if ((INTEGRAL_TYPE_P (itype) > + || POINTER_TYPE_P (itype)) > + && wi::eq_p (wi::to_wide (int_cst), wi::max_value (itype)))))) > > /* x > y && x !=3D XXX_MIN --> x > y > x > y && x =3D=3D XXX_MIN --> false . */ > diff --git a/gcc/testsuite/gcc.dg/pr110915-1.c b/gcc/testsuite/gcc.dg/pr1= 10915-1.c > new file mode 100644 > index 00000000000..2e1e871b9a0 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr110915-1.c > @@ -0,0 +1,31 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fdump-tree-ifcombine" } */ > +#define vector __attribute__((vector_size(sizeof(unsigned)*2))) > + > +#include > + > +vector signed and1(vector unsigned x, vector unsigned y) > +{ > + /* (x > y) & (x !=3D 0) --> x > y */ > + return (x > y) & (x !=3D 0); > +} > + > +vector signed and2(vector unsigned x, vector unsigned y) > +{ > + /* (x < y) & (x !=3D UINT_MAX) --> x < y */ > + return (x < y) & (x !=3D UINT_MAX); > +} > + > +vector signed and3(vector signed x, vector signed y) > +{ > + /* (x > y) & (x !=3D INT_MIN) --> x > y */ > + return (x > y) & (x !=3D INT_MIN); > +} > + > +vector signed and4(vector signed x, vector signed y) > +{ > + /* (x < y) & (x !=3D INT_MAX) --> x < y */ > + return (x < y) & (x !=3D INT_MAX); > +} > + > +/* { dg-final { scan-tree-dump-not " !=3D " "ifcombine" } } */ > diff --git a/gcc/testsuite/gcc.dg/pr110915-10.c b/gcc/testsuite/gcc.dg/pr= 110915-10.c > new file mode 100644 > index 00000000000..b0644bf3123 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr110915-10.c > @@ -0,0 +1,33 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fdump-tree-optimized" } */ > +#define vector __attribute__((vector_size(sizeof(unsigned)*2))) > + > +#include > + > +vector unsigned or1(vector unsigned x, vector unsigned y) > +{ > + /* (x <=3D y) | (x !=3D 0)) --> true */ > + return (x <=3D y) | (x !=3D 0); > +} > + > +vector unsigned or2(vector unsigned x, vector unsigned y) > +{ > + /* (x >=3D y) | (x !=3D UINT_MAX) --> true */ > + return (x >=3D y) | (x !=3D UINT_MAX); > +} > + > +vector signed or3(vector signed x, vector signed y) > +{ > + /* (x <=3D y) | (x !=3D INT_MIN) --> true */ > + return (x <=3D y) | (x !=3D INT_MIN); > +} > + > +vector signed or4(vector signed x, vector signed y) > +{ > + /* (x >=3D y) | (x !=3D INT_MAX) --> true */ > + return (x >=3D y) | (x !=3D INT_MAX); > +} > + > +/* { dg-final { scan-tree-dump-not " !=3D " "optimized" } } */ > +/* { dg-final { scan-tree-dump-not " <=3D " "optimized" } } */ > +/* { dg-final { scan-tree-dump-not " >=3D " "optimized" } } */ > diff --git a/gcc/testsuite/gcc.dg/pr110915-11.c b/gcc/testsuite/gcc.dg/pr= 110915-11.c > new file mode 100644 > index 00000000000..0288e53b16b > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr110915-11.c > @@ -0,0 +1,31 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fdump-tree-ifcombine" } */ > +#define vector __attribute__((vector_size(sizeof(unsigned)*2))) > + > +#include > + > +vector unsigned or1(vector unsigned x, vector unsigned y) > +{ > + /* (x <=3D y) | (x =3D=3D 0) --> x <=3D y */ > + return (x <=3D y) | (x =3D=3D 0); > +} > + > +vector unsigned or2(vector unsigned x, vector unsigned y) > +{ > + /* (x >=3D y) | (x =3D=3D UINT_MAX) --> x >=3D y */ > + return (x >=3D y) | (x =3D=3D UINT_MAX); > +} > + > +vector signed or3(vector signed x, vector signed y) > +{ > + /* (x <=3D y) | (x =3D=3D INT_MIN) --> x <=3D y */ > + return (x <=3D y) | (x =3D=3D INT_MIN); > +} > + > +vector signed or4(vector signed x, vector signed y) > +{ > + /* (x >=3D y) | (x =3D=3D INT_MAX) --> x >=3D y */ > + return (x >=3D y) | (x =3D=3D INT_MAX); > +} > + > +/* { dg-final { scan-tree-dump-not " =3D=3D " "ifcombine" } } */ > diff --git a/gcc/testsuite/gcc.dg/pr110915-12.c b/gcc/testsuite/gcc.dg/pr= 110915-12.c > new file mode 100644 > index 00000000000..054a077ce3e > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr110915-12.c > @@ -0,0 +1,31 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fdump-tree-dce3" } */ > +#define vector __attribute__((vector_size(sizeof(unsigned)*2))) > + > +#include > + > +vector unsigned or1(vector unsigned x, vector unsigned y) > +{ > + /* (x <=3D y) | (x =3D=3D 0) --> x <=3D y */ > + return (x <=3D y) | (x =3D=3D 0); > +} > + > +vector unsigned or2(vector unsigned x, vector unsigned y) > +{ > + /* (x >=3D y) | (x =3D=3D UINT_MAX) --> x >=3D y */ > + return (x >=3D y) | (x =3D=3D UINT_MAX); > +} > + > +vector signed or3(vector signed x, vector signed y) > +{ > + /* (x <=3D y) | (x =3D=3D INT_MIN) --> x <=3D y */ > + return (x <=3D y) | (x =3D=3D INT_MIN); > +} > + > +vector signed or4(vector signed x, vector signed y) > +{ > + /* (x >=3D y) | (x =3D=3D INT_MAX) --> x >=3D y */ > + return (x >=3D y) | (x =3D=3D INT_MAX); > +} > + > +/* { dg-final { scan-tree-dump-not " =3D=3D " "dce3" } } */ > diff --git a/gcc/testsuite/gcc.dg/pr110915-2.c b/gcc/testsuite/gcc.dg/pr1= 10915-2.c > new file mode 100644 > index 00000000000..3962b152078 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr110915-2.c > @@ -0,0 +1,31 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fdump-tree-optimized" } */ > +#define vector __attribute__((vector_size(sizeof(unsigned)*2))) > + > +#include > + > +vector signed and1(vector unsigned x, vector unsigned y) > +{ > + /* (x > y) & (x !=3D 0) --> x > y */ > + return (x > y) & (x !=3D 0); > +} > + > +vector signed and2(vector unsigned x, vector unsigned y) > +{ > + /* (x < y) & (x !=3D UINT_MAX) --> x < y */ > + return (x < y) & (x !=3D UINT_MAX); > +} > + > +vector signed and3(vector signed x, vector signed y) > +{ > + /* (x > y) & (x !=3D INT_MIN) --> x > y */ > + return (x > y) & (x !=3D INT_MIN); > +} > + > +vector signed and4(vector signed x, vector signed y) > +{ > + /* (x < y) & (x !=3D INT_MAX) --> x < y */ > + return (x < y) & (x !=3D INT_MAX); > +} > + > +/* { dg-final { scan-tree-dump-not " !=3D " "optimized" } } */ > diff --git a/gcc/testsuite/gcc.dg/pr110915-3.c b/gcc/testsuite/gcc.dg/pr1= 10915-3.c > new file mode 100644 > index 00000000000..c6462b59526 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr110915-3.c > @@ -0,0 +1,33 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fdump-tree-ifcombine" } */ > +#define vector __attribute__((vector_size(sizeof(unsigned)*2))) > + > +#include > + > +vector signed and1(vector unsigned x, vector unsigned y) > +{ > + /* (x > y) & (x =3D=3D 0) --> false */ > + return (x > y) & (x =3D=3D 0); > +} > + > +vector signed and2(vector unsigned x, vector unsigned y) > +{ > + /* (x < y) & (x =3D=3D UINT_MAX) --> false */ > + return (x < y) & (x =3D=3D UINT_MAX); > +} > + > +vector signed and3(vector signed x, vector signed y) > +{ > + /* (x > y) & (x =3D=3D INT_MIN) --> false */ > + return (x > y) & (x =3D=3D INT_MIN); > +} > + > +vector signed and4(vector signed x, vector signed y) > +{ > + /* (x < y) & (x =3D=3D INT_MAX) --> false */ > + return (x < y) & (x =3D=3D INT_MAX); > +} > + > +/* { dg-final { scan-tree-dump-not " =3D=3D " "ifcombine" } } */ > +/* { dg-final { scan-tree-dump-not " > " "ifcombine" } } */ > +/* { dg-final { scan-tree-dump-not " < " "ifcombine" } } */ > diff --git a/gcc/testsuite/gcc.dg/pr110915-4.c b/gcc/testsuite/gcc.dg/pr1= 10915-4.c > new file mode 100644 > index 00000000000..5b28ccdd321 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr110915-4.c > @@ -0,0 +1,33 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fdump-tree-optimized" } */ > +#define vector __attribute__((vector_size(sizeof(unsigned)*2))) > + > +#include > + > +vector signed and1(vector unsigned x, vector unsigned y) > +{ > + /* (x > y) & (x =3D=3D 0) --> false */ > + return (x > y) & (x =3D=3D 0); > +} > + > +vector signed and2(vector unsigned x, vector unsigned y) > +{ > + /* (x < y) & (x =3D=3D UINT_MAX) --> false */ > + return (x < y) & (x =3D=3D UINT_MAX); > +} > + > +vector signed and3(vector signed x, vector signed y) > +{ > + /* (x > y) & (x =3D=3D INT_MIN) --> false */ > + return (x > y) & (x =3D=3D INT_MIN); > +} > + > +vector signed and4(vector signed x, vector signed y) > +{ > + /* (x < y) & (x =3D=3D INT_MAX) --> false */ > + return (x < y) & (x =3D=3D INT_MAX); > +} > + > +/* { dg-final { scan-tree-dump-not " =3D=3D " "optimized" } } */ > +/* { dg-final { scan-tree-dump-not " > " "optimized" } } */ > +/* { dg-final { scan-tree-dump-not " < " "optimized" } } */ > diff --git a/gcc/testsuite/gcc.dg/pr110915-5.c b/gcc/testsuite/gcc.dg/pr1= 10915-5.c > new file mode 100644 > index 00000000000..a8b871d5bca > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr110915-5.c > @@ -0,0 +1,32 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fdump-tree-ifcombine" } */ > +#define vector __attribute__((vector_size(sizeof(unsigned)*2))) > + > +#include > + > +vector signed and1(vector unsigned x, vector unsigned y) > +{ > + /* (x <=3D y) & (x =3D=3D 0) --> x =3D=3D 0 */ > + return (x <=3D y) & (x =3D=3D 0); > +} > + > +vector signed and2(vector unsigned x, vector unsigned y) > +{ > + /* (x >=3D y) & (x =3D=3D UINT_MAX) --> x =3D=3D UINT_MAX */ > + return (x >=3D y) & (x =3D=3D UINT_MAX); > +} > + > +vector signed and3(vector signed x, vector signed y) > +{ > + /* (x <=3D y) & (x =3D=3D INT_MIN) --> x =3D=3D INT_MIN */ > + return (x <=3D y) & (x =3D=3D INT_MIN); > +} > + > +vector signed and4(vector signed x, vector signed y) > +{ > + /* (x >=3D y) & (x =3D=3D INT_MAX) --> x =3D=3D INT_MAX */ > + return (x >=3D y) & (x =3D=3D INT_MAX); > +} > + > +/* { dg-final { scan-tree-dump-not " <=3D " "ifcombine" } } */ > +/* { dg-final { scan-tree-dump-not " >=3D " "ifcombine" } } */ > diff --git a/gcc/testsuite/gcc.dg/pr110915-6.c b/gcc/testsuite/gcc.dg/pr1= 10915-6.c > new file mode 100644 > index 00000000000..a3b9cc02a4b > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr110915-6.c > @@ -0,0 +1,32 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fdump-tree-optimized" } */ > +#define vector __attribute__((vector_size(sizeof(unsigned)*2))) > + > +#include > + > +vector signed and1(vector unsigned x, vector unsigned y) > +{ > + /* (x <=3D y) & (x =3D=3D 0) --> x =3D=3D 0 */ > + return (x <=3D y) & (x =3D=3D 0); > +} > + > +vector signed and2(vector unsigned x, vector unsigned y) > +{ > + /* (x >=3D y) & (x =3D=3D UINT_MAX) --> x =3D=3D UINT_MAX */ > + return (x >=3D y) & (x =3D=3D UINT_MAX); > +} > + > +vector signed and3(vector signed x, vector signed y) > +{ > + /* (x <=3D y) & (x =3D=3D INT_MIN) --> x =3D=3D INT_MIN */ > + return (x <=3D y) & (x =3D=3D INT_MIN); > +} > + > +vector signed and4(vector signed x, vector signed y) > +{ > + /* (x >=3D y) & (x =3D=3D INT_MAX) --> x =3D=3D INT_MAX */ > + return (x >=3D y) & (x =3D=3D INT_MAX); > +} > + > +/* { dg-final { scan-tree-dump-not " <=3D " "optimized" } } */ > +/* { dg-final { scan-tree-dump-not " >=3D " "optimized" } } */ > diff --git a/gcc/testsuite/gcc.dg/pr110915-7.c b/gcc/testsuite/gcc.dg/pr1= 10915-7.c > new file mode 100644 > index 00000000000..fd331e90e4a > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr110915-7.c > @@ -0,0 +1,32 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fdump-tree-ifcombine" } */ > +#define vector __attribute__((vector_size(sizeof(unsigned)*2))) > + > +#include > + > +vector signed or1(vector unsigned x, vector unsigned y) > +{ > + /* (x > y) | (x !=3D 0) --> x !=3D 0 */ > + return (x > y) | (x !=3D 0); > +} > + > +vector signed or2(vector unsigned x, vector unsigned y) > +{ > + /* (x < y) | (x !=3D UINT_MAX) --> x !=3D UINT_MAX */ > + return (x < y) | (x !=3D UINT_MAX); > +} > + > +vector signed or3(vector signed x, vector signed y) > +{ > + /* (x > y) | (x !=3D INT_MIN) --> x !=3D INT_MIN */ > + return (x > y) | (x !=3D INT_MIN); > +} > + > +vector signed or4(vector signed x, vector signed y) > +{ > + /* (x < y) | (x !=3D INT_MAX) --> x !=3D INT_MAX */ > + return (x < y) | (x !=3D INT_MAX); > +} > + > +/* { dg-final { scan-tree-dump-not " > " "ifcombine" } } */ > +/* { dg-final { scan-tree-dump-not " < " "ifcombine" } } */ > diff --git a/gcc/testsuite/gcc.dg/pr110915-8.c b/gcc/testsuite/gcc.dg/pr1= 10915-8.c > new file mode 100644 > index 00000000000..fae533cbf22 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr110915-8.c > @@ -0,0 +1,32 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fdump-tree-optimized" } */ > +#define vector __attribute__((vector_size(sizeof(unsigned)*2))) > + > +#include > + > +vector signed or1(vector unsigned x, vector unsigned y) > +{ > + /* (x > y) | (x !=3D 0) --> x !=3D 0 */ > + return (x > y) | (x !=3D 0); > +} > + > +vector signed or2(vector unsigned x, vector unsigned y) > +{ > + /* (x < y) | (x !=3D UINT_MAX) --> x !=3D UINT_MAX */ > + return (x < y) | (x !=3D UINT_MAX); > +} > + > +vector signed or3(vector signed x, vector signed y) > +{ > + /* (x > y) | (x !=3D INT_MIN) --> x !=3D INT_MIN */ > + return (x > y) | (x !=3D INT_MIN); > +} > + > +vector signed or4(vector signed x, vector signed y) > +{ > + /* (x < y) | (x !=3D INT_MAX) --> x !=3D INT_MAX */ > + return (x < y) | (x !=3D INT_MAX); > +} > + > +/* { dg-final { scan-tree-dump-not " > " "optimized" } } */ > +/* { dg-final { scan-tree-dump-not " < " "optimized" } } */ > diff --git a/gcc/testsuite/gcc.dg/pr110915-9.c b/gcc/testsuite/gcc.dg/pr1= 10915-9.c > new file mode 100644 > index 00000000000..07aa08ee00b > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr110915-9.c > @@ -0,0 +1,33 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fdump-tree-ifcombine" } */ > +#define vector __attribute__((vector_size(sizeof(unsigned)*2))) > + > +#include > + > +vector signed or1(vector unsigned x, vector unsigned y) > +{ > + /* (x <=3D y) | (x !=3D 0) --> true */ > + return (x <=3D y) | (x !=3D 0); > +} > + > +vector signed or2(vector unsigned x, vector unsigned y) > +{ > + /* (x >=3D y) | (x !=3D UINT_MAX) --> true */ > + return (x >=3D y) | (x !=3D UINT_MAX); > +} > + > +vector signed or3(vector signed x, vector signed y) > +{ > + /* (x <=3D y) | (x !=3D INT_MIN) --> true */ > + return (x <=3D y) | (x !=3D INT_MIN); > +} > + > +vector signed or4(vector signed x, vector signed y) > +{ > + /* (x >=3D y) | (x !=3D INT_MAX) --> true */ > + return (x >=3D y) | (x !=3D INT_MAX); > +} > + > +/* { dg-final { scan-tree-dump-not " !=3D " "ifcombine" } } */ > +/* { dg-final { scan-tree-dump-not " <=3D " "ifcombine" } } */ > +/* { dg-final { scan-tree-dump-not " >=3D " "ifcombine" } } */ > -- > 2.31.1 >