Type wrong hongtao's e-mail address.

> -----Original Message-----
> From: Hu, Lin1 <lin1...@intel.com>
> Sent: Wednesday, September 4, 2024 1:44 PM
> To: gcc-patches@gcc.gnu.org
> Cc: hontao....@intel.com; ubiz...@gmail.com; rguent...@suse.de;
> ja...@redhat.com; pins...@gmail.com
> Subject: [PATCH] Match: Fix ordered and nonequal
> 
> Hi, all
> 
> This patch is a fix patch.
> 
> Need to add :c for bit_and, because bit_and is commutative. And is (ltgt @0 
> @1)
> is simpler than (bit_not (uneq @0 @1)).
> 
> Bootstrapped/regtested on x86-64-pc-linux-gnu, OK for trunk?
> 
> BRs,
> Lin
> 
> gcc/ChangeLog:
> 
>       * match.pd: Fix match for (bit_and (ordered @0 @1) (ne @0 @1)).
> 
> gcc/testsuite/ChangeLog:
> 
>       * gcc.dg/opt-ordered-and-nonequal-1.c: New test.
>       * gcc.target/i386/optimize_one.c: Change name to opt-comi-1.c.
>       * gcc.target/i386/opt-comi-1.c: New test.
> ---
>  gcc/match.pd                                  |  4 +-
>  .../gcc.dg/opt-ordered-and-nonequal-1.c       | 49 +++++++++++++++++++
>  gcc/testsuite/gcc.target/i386/opt-comi-1.c    | 49 +++++++++++++++++++
>  gcc/testsuite/gcc.target/i386/optimize_one.c  |  9 ----
>  4 files changed, 100 insertions(+), 11 deletions(-)  create mode 100644
> gcc/testsuite/gcc.dg/opt-ordered-and-nonequal-1.c
>  create mode 100644 gcc/testsuite/gcc.target/i386/opt-comi-1.c
>  delete mode 100644 gcc/testsuite/gcc.target/i386/optimize_one.c
> 
> diff --git a/gcc/match.pd b/gcc/match.pd index 4298e89dad6..621306213e4
> 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -6652,8 +6652,8 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>   (if (!flag_trapping_math || !tree_expr_maybe_nan_p (@0))
>    { constant_boolean_node (false, type); }))  (simplify
> - (bit_and (ordered @0 @1) (ne @0 @1))
> - (bit_not (uneq @0 @1)))
> + (bit_and:c (ordered @0 @1) (ne @0 @1)) (ltgt @0 @1))
> 
>  /* x == ~x -> false */
>  /* x != ~x -> true */
> diff --git a/gcc/testsuite/gcc.dg/opt-ordered-and-nonequal-1.c
> b/gcc/testsuite/gcc.dg/opt-ordered-and-nonequal-1.c
> new file mode 100644
> index 00000000000..6d102c2bd0c
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/opt-ordered-and-nonequal-1.c
> @@ -0,0 +1,49 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -fdump-tree-forwprop1-details" } */
> +
> +int is_ordered_and_nonequal_sh_1 (float a, float b) {
> +  return !__builtin_isunordered (a, b) && (a != b); }
> +
> +int is_ordered_and_nonequal_sh_2 (float a, float b) {
> +  return !__builtin_isunordered (a, b) && (b != a); }
> +
> +int is_ordered_and_nonequal_sh_3 (float a, float b) {
> +  return (b != a) && !__builtin_isunordered (a, b); }
> +
> +int is_ordered_and_nonequal_sh_4 (float a, float b) {
> +  return !__builtin_isunordered (a, b) && !(a == b); }
> +
> +int is_ordered_and_nonequal_sh_5 (float a, float b) {
> +  return !__builtin_isunordered (a, b) && !(b == a); }
> +
> +int is_ordered_and_nonequal_sh_6 (float a, float b) {
> +  return !(b == a) && !__builtin_isunordered (a, b); }
> +
> +int is_ordered_or_nonequal_sh_7 (float a, float b) {
> +  return !(__builtin_isunordered (a, b) || (a == b)); }
> +
> +int is_ordered_or_nonequal_sh_8 (float a, float b) {
> +  return !(__builtin_isunordered (a, b) || (b == a)); }
> +
> +int is_ordered_or_nonequal_sh_9 (float a, float b) {
> +  return !((a == b) || __builtin_isunordered (b, a)); }
> +
> +/* { dg-final { scan-tree-dump-times "gimple_simplified to\[^\n\r]*<>"
> +9 "forwprop1" } } */
> diff --git a/gcc/testsuite/gcc.target/i386/opt-comi-1.c
> b/gcc/testsuite/gcc.target/i386/opt-comi-1.c
> new file mode 100644
> index 00000000000..fc7b8632004
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/opt-comi-1.c
> @@ -0,0 +1,49 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -mfpmath=sse -msse2" } */
> +/* { dg-final { scan-assembler-times "comiss" 9 } } */
> +/* { dg-final { scan-assembler-times "set" 9 } } */
> +
> +int is_ordered_and_nonequal_sh_1 (float a, float b) {
> +  return !__builtin_isunordered (a, b) && (a != b); }
> +
> +int is_ordered_and_nonequal_sh_2 (float a, float b) {
> +  return !__builtin_isunordered (a, b) && (b != a); }
> +
> +int is_ordered_and_nonequal_sh_3 (float a, float b) {
> +  return (b != a) && !__builtin_isunordered (a, b); }
> +
> +int is_ordered_and_nonequal_sh_4 (float a, float b) {
> +  return !__builtin_isunordered (a, b) && !(a == b); }
> +
> +int is_ordered_and_nonequal_sh_5 (float a, float b) {
> +  return !__builtin_isunordered (a, b) && !(b == a); }
> +
> +int is_ordered_and_nonequal_sh_6 (float a, float b) {
> +  return !(b == a) && !__builtin_isunordered (a, b); }
> +
> +int is_ordered_or_nonequal_sh_7 (float a, float b) {
> +  return !(__builtin_isunordered (a, b) || (a == b)); }
> +
> +int is_ordered_or_nonequal_sh_8 (float a, float b) {
> +  return !(__builtin_isunordered (a, b) || (b == a)); }
> +
> +int is_ordered_or_nonequal_sh_9 (float a, float b) {
> +  return !((a == b) || __builtin_isunordered (b, a)); }
> diff --git a/gcc/testsuite/gcc.target/i386/optimize_one.c
> b/gcc/testsuite/gcc.target/i386/optimize_one.c
> deleted file mode 100644
> index 3a682ed4028..00000000000
> --- a/gcc/testsuite/gcc.target/i386/optimize_one.c
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-O2 -mfpmath=sse -msse2" } */
> -/* { dg-final { scan-assembler-times "comi" 1 } } */
> -/* { dg-final { scan-assembler-times "set" 1 } } */
> -
> -int is_ordered_or_nonequal_sh (float a, float b) -{
> -  return !__builtin_isunordered (a, b) && (a != b); -}
> --
> 2.31.1

Reply via email to