On Mon, Aug 26, 2024 at 02:42:31PM +0800, Haochen Jiang wrote:
> * match.pd: Optimize (and ordered non-equal) to
> (not (or unordered equal))
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/i386/optimize_one.c: New test.
The testcase FAILs on i686-linux, because it uses -mfpmath=sse
without enabling -msse2.
I've committed the following fix as obvious to fix that.
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -6636,6 +6636,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
> (ltgt @0 @0)
> (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)))
I wonder whether there shouldn't be some :c (e.g. on bit_and and maybe
ne too), because ordered is commutative and so is ne and so is bit_and,
and perhaps you want to match also (bit_and (ne @0 @1) (ordered @1 @0))
etc. What about negation of this (bit_ior (unordered @0 @1) (eq @0 @1))?
And I think the test is really badly named...
2024-09-02 Jakub Jelinek <[email protected]>
* gcc.target/i386/optimize_one.c: Add -msse2 to dg-options.
--- gcc/testsuite/gcc.target/i386/optimize_one.c.jj 2024-09-02
15:41:30.070228957 +0200
+++ gcc/testsuite/gcc.target/i386/optimize_one.c 2024-09-02
20:09:14.151727645 +0200
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -mfpmath=sse" } */
+/* { dg-options "-O2 -mfpmath=sse -msse2" } */
/* { dg-final { scan-assembler-times "comi" 1 } } */
/* { dg-final { scan-assembler-times "set" 1 } } */
Jakub