From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1130) id 74D283857C67; Tue, 30 Nov 2021 09:53:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74D283857C67 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Sandiford To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5604] Mark IFN_COMPLEX_MUL as commutative X-Act-Checkin: gcc X-Git-Author: Richard Sandiford X-Git-Refname: refs/heads/master X-Git-Oldrev: e9fff24cd2b365a236fcb31bdf186f6ec9e00f76 X-Git-Newrev: 71207246b02b33c1ceb169db54fddaa5c5c31824 Message-Id: <20211130095321.74D283857C67@sourceware.org> Date: Tue, 30 Nov 2021 09:53:21 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Nov 2021 09:53:21 -0000 https://gcc.gnu.org/g:71207246b02b33c1ceb169db54fddaa5c5c31824 commit r12-5604-g71207246b02b33c1ceb169db54fddaa5c5c31824 Author: Richard Sandiford 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" } } */