public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Sandiford <rsandifo@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-5604] Mark IFN_COMPLEX_MUL as commutative
Date: Tue, 30 Nov 2021 09:53:21 +0000 (GMT)	[thread overview]
Message-ID: <20211130095321.74D283857C67@sourceware.org> (raw)

https://gcc.gnu.org/g:71207246b02b33c1ceb169db54fddaa5c5c31824

commit r12-5604-g71207246b02b33c1ceb169db54fddaa5c5c31824
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Tue Nov 30 09:52:26 2021 +0000

    Mark IFN_COMPLEX_MUL as commutative
    
    gcc/
            * internal-fn.c (commutative_binary_fn_p): Handle IFN_COMPLEX_MUL.
    
    gcc/testsuite/
            * gcc.target/aarch64/sve/complex_mul_1.c: New test.

Diff:
---
 gcc/internal-fn.c                                    |  1 +
 gcc/testsuite/gcc.target/aarch64/sve/complex_mul_1.c | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
index 514ce899211..3d4055d29ee 100644
--- a/gcc/internal-fn.c
+++ b/gcc/internal-fn.c
@@ -3831,6 +3831,7 @@ commutative_binary_fn_p (internal_fn fn)
     case IFN_MULHRS:
     case IFN_FMIN:
     case IFN_FMAX:
+    case IFN_COMPLEX_MUL:
       return true;
 
     default:
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/complex_mul_1.c b/gcc/testsuite/gcc.target/aarch64/sve/complex_mul_1.c
new file mode 100644
index 00000000000..d197e7d0d8e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/complex_mul_1.c
@@ -0,0 +1,16 @@
+/* { dg-options "-O2 -fgimple -fdump-tree-optimized" } */
+
+void __GIMPLE
+foo (__SVFloat64_t x, __SVFloat64_t y, __SVFloat64_t *res1,
+     __SVFloat64_t *res2)
+{
+  __SVFloat64_t a1;
+  __SVFloat64_t a2;
+
+  a1 = .COMPLEX_MUL (x, y);
+  a2 = .COMPLEX_MUL (y, x);
+  __MEM<__SVFloat64_t> (res1) = a1;
+  __MEM<__SVFloat64_t> (res2) = a2;
+}
+
+/* { dg-final { scan-tree-dump-times {\.COMPLEX_MUL} 1 "optimized" } } */


                 reply	other threads:[~2021-11-30  9:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211130095321.74D283857C67@sourceware.org \
    --to=rsandifo@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).