From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 2998838323DC for ; Mon, 6 Nov 2023 13:02:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2998838323DC Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2998838323DC Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.220.29 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699275752; cv=none; b=YZIdY2V4VLKyG1jR6HuJte5dXj35UspFg8/pICpn09yZLXHVbA3nO3phTmOzx8nplLRDRc6IZ45iyT6ErYj3qbC0yH0ScdACeUCgYsXYxwmBSDClURmhbv/OgjNMBTNDEenpsDldjpHqGd5L1KQ/bmRsR+L4BQ8qStxLjWrbWrs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699275752; c=relaxed/simple; bh=ZsHzqwrVVJT6vt6EGzF1dV2cgnQft2E2sdw0jJ2QXMQ=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=iN4JeIH3AKOboyXb5tl6dqnxZqk4So28jWXoQ00L6Z+AKtUAZZJihwpxL/KHFMAdlDkeMy3YTDF0kAvMLr9cmYTDsrV0PXpCLAD4cqqgXLe/I+rvqAriB7MVQubWaFYcMgQOqJ6u94pBjv2NsC8TU4ptNme1bn4MSPYJF4cGKdU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 5DA591FE28; Mon, 6 Nov 2023 13:02:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1699275740; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+FFBQ4sBqLK1mVWI8ijnonf+JVm8+4KUbJ3wJGawhkk=; b=e5hVMu2+87FJsmkksWvdwWAxJg1D3lDS+bsl2LpwW9XHCEx89a6d8eB5/r3MzN3FFlrCtf RN49qPJgFzuQLjgrU5d26SpPcv+7l7JL3Kex07gC2bE6ShL0hnLRqJJKcPN3HE+eWTditG MG8If294wTQ7TdTcEzczh8dKeU3f4BI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1699275740; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+FFBQ4sBqLK1mVWI8ijnonf+JVm8+4KUbJ3wJGawhkk=; b=r+8n1CW4qEO0w96cQEwMSnEQ/hEMViG5PwKHMYiijcF0s8iHjya58+gFPKtN0kxEUQeHq0 0IfN436/YpwLpNBw== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 229842C14F; Mon, 6 Nov 2023 13:02:20 +0000 (UTC) Date: Mon, 6 Nov 2023 13:02:20 +0000 (UTC) From: Richard Biener To: Tamar Christina cc: gcc-patches@gcc.gnu.org, nd@arm.com, jlaw@ventanamicro.com Subject: Re: [PATCH v3 1/2]middle-end: expand copysign handling from lockstep to nested iters In-Reply-To: Message-ID: References: User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, 6 Nov 2023, Tamar Christina wrote: > Hi All, > > various optimizations in match.pd only happened on COPYSIGN in lock step > which means they exclude IFN_COPYSIGN. COPYSIGN however is restricted to only > the C99 builtins and so doesn't work for vectors. > > The patch expands these optimizations to work as nested iters. > > This is needed for the second patch which will add the testcase. > > Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. > > Ok for master? OK. > Thanks, > Tamar > > gcc/ChangeLog: > > PR tree-optimization/109154 > * match.pd: expand existing copysign optimizations. > > --- inline copy of patch -- > diff --git a/gcc/match.pd b/gcc/match.pd > index 7d651a6582d169793cca4f9a70e334dd80014d92..db95931df0672cf4ef08cca36085c3aa6831519e 100644 > --- a/gcc/match.pd > +++ b/gcc/match.pd > @@ -1074,37 +1074,37 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > > /* cos(copysign(x, y)) -> cos(x). Similarly for cosh. */ > (for coss (COS COSH) > - copysigns (COPYSIGN) > - (simplify > - (coss (copysigns @0 @1)) > - (coss @0))) > + (for copysigns (COPYSIGN) > + (simplify > + (coss (copysigns @0 @1)) > + (coss @0)))) > > /* pow(copysign(x, y), z) -> pow(x, z) if z is an even integer. */ > (for pows (POW) > - copysigns (COPYSIGN) > - (simplify > - (pows (copysigns @0 @2) REAL_CST@1) > - (with { HOST_WIDE_INT n; } > - (if (real_isinteger (&TREE_REAL_CST (@1), &n) && (n & 1) == 0) > - (pows @0 @1))))) > + (for copysigns (COPYSIGN) > + (simplify > + (pows (copysigns @0 @2) REAL_CST@1) > + (with { HOST_WIDE_INT n; } > + (if (real_isinteger (&TREE_REAL_CST (@1), &n) && (n & 1) == 0) > + (pows @0 @1)))))) > /* Likewise for powi. */ > (for pows (POWI) > - copysigns (COPYSIGN) > - (simplify > - (pows (copysigns @0 @2) INTEGER_CST@1) > - (if ((wi::to_wide (@1) & 1) == 0) > - (pows @0 @1)))) > + (for copysigns (COPYSIGN) > + (simplify > + (pows (copysigns @0 @2) INTEGER_CST@1) > + (if ((wi::to_wide (@1) & 1) == 0) > + (pows @0 @1))))) > > (for hypots (HYPOT) > - copysigns (COPYSIGN) > - /* hypot(copysign(x, y), z) -> hypot(x, z). */ > - (simplify > - (hypots (copysigns @0 @1) @2) > - (hypots @0 @2)) > - /* hypot(x, copysign(y, z)) -> hypot(x, y). */ > - (simplify > - (hypots @0 (copysigns @1 @2)) > - (hypots @0 @1))) > + (for copysigns (COPYSIGN) > + /* hypot(copysign(x, y), z) -> hypot(x, z). */ > + (simplify > + (hypots (copysigns @0 @1) @2) > + (hypots @0 @2)) > + /* hypot(x, copysign(y, z)) -> hypot(x, y). */ > + (simplify > + (hypots @0 (copysigns @1 @2)) > + (hypots @0 @1)))) > > /* copysign(x, CST) -> [-]abs (x). */ > (for copysigns (COPYSIGN_ALL) > > > > > -- Richard Biener SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)