]> git.ipfire.org Git - thirdparty/gcc.git/commit
match.pd: Further fma negation fixes [PR116891]
authorJakub Jelinek <jakub@redhat.com>
Tue, 15 Oct 2024 17:38:46 +0000 (19:38 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 15 Oct 2024 17:38:46 +0000 (19:38 +0200)
commit4366f0c7e296ea0d7279343c9b0a1d597588a1da
tree513b036d7c93f53bb88594d046e2eabf5d0f2b1d
parent8161c4adea7f1842f9d28633d82e912ebb7a4cf9
match.pd: Further fma negation fixes [PR116891]

On Mon, Oct 14, 2024 at 08:53:29AM +0200, Jakub Jelinek wrote:
> >     PR middle-end/116891
> >     * match.pd ((negate (IFN_FNMS@3 @0 @1 @2)) -> (IFN_FMA @0 @1 @2)):
> >     Only enable for !HONOR_SIGN_DEPENDENT_ROUNDING.
>
> Guess it would be nice to have a testcase which FAILs without the patch and
> PASSes with it, but it can be added later.

I've added such a testcase now, and additionally found the fix only fixed
one of the 4 problematic similar cases.

Here is a patch which fixes the others too and adds the testcases.
fma-pr116891.c FAILed without your patch, FAILs with your patch too (but
only due to the bar/baz/qux checks) and PASSes with the patch.

2024-10-15  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/116891
* match.pd ((negate (fmas@3 @0 @1 @2)) -> (IFN_FNMS @0 @1 @2)):
Only enable for !HONOR_SIGN_DEPENDENT_ROUNDING.
((negate (IFN_FMS@3 @0 @1 @2)) -> (IFN_FNMA @0 @1 @2)): Likewise.
((negate (IFN_FNMA@3 @0 @1 @2)) -> (IFN_FMS @0 @1 @2)): Likewise.

* gcc.dg/pr116891.c: New test.
* gcc.target/i386/fma-pr116891.c: New test.
gcc/match.pd
gcc/testsuite/gcc.dg/pr116891.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/fma-pr116891.c [new file with mode: 0644]