From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by sourceware.org (Postfix) with ESMTPS id 2AAB93858C2D for ; Sun, 14 May 2023 07:43:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2AAB93858C2D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=ispras.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ispras.ru Received: from [10.10.3.121] (unknown [10.10.3.121]) by mail.ispras.ru (Postfix) with ESMTPS id 0080D44C1024; Sun, 14 May 2023 07:43:36 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 0080D44C1024 Date: Sun, 14 May 2023 10:43:36 +0300 (MSK) From: Alexander Monakov To: Andrew Pinski cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] MATCH: Add pattern for `signbit(x) ? x : -x` into abs (and swapped) In-Reply-To: <0a028947-85bc-f3e3-253e-b43831b0d4f0@ispras.ru> Message-ID: <61c155d8-615d-61e6-ae8e-e8c1e63acc48@ispras.ru> References: <20230514031258.1542461-1-apinski@marvell.com> <0a028947-85bc-f3e3-253e-b43831b0d4f0@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,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 Sun, 14 May 2023, Alexander Monakov wrote: > On Sat, 13 May 2023, Andrew Pinski via Gcc-patches wrote: > > > +/* signbit(x) != 0 ? -x : x -> abs(x) > > + signbit(x) == 0 ? -x : x -> -abs(x) */ > > +(for sign (SIGNBIT) > > Surprised to see a dummy iterator here. Was this meant to include > float and long double versions of the builtin too (SIGNBITF and SIGNBITL)? On the other hand, the following clauses both use SIGNBIT directly, and it would be nice to be consistent. > > + (for neeq (ne eq) > > + (simplify > > + (cond (neeq (sign @0) integer_zerop) (negate @0) @0) > > + (if (neeq == NE_EXPR) > > + (abs @0) > > + (negate (abs @0)))))) > > + > > (simplify > > /* signbit(x) -> 0 if x is nonnegative. */ > > (SIGNBIT tree_expr_nonnegative_p@0) > > Thanks. > Alexander >