From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by sourceware.org (Postfix) with ESMTPS id 08F25385841A for ; Wed, 6 Sep 2023 10:27:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 08F25385841A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-56a9c951aaaso1822716a12.3 for ; Wed, 06 Sep 2023 03:27:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693996045; x=1694600845; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pOxX2A/VGHaRwCY2mrksnome5+u09SSJrZuAyhc9Tjs=; b=BIO600if94T3Z2Vdal6OGTuT7y/FezoYTIdPHvNkowXn+jDWVGUDPvsNYrlemJkUMP aTw9wZTYKHSujQntz8v2lLHnBWi1tWaFblBJF83vaWmmWdOtXnPwxKLmFAlIhMsxWJJZ RPgAE4cNcbi17+jeT/vK0HwSlS3QbFiLJdeFMZzOT1QX7XiLlnc2VbxkxEY/dH9uAI0Q wKls3OTCqG1m9Izc6cyR6sThHBSLDl3WUuqQcdeuAlsQaQEGixpMsCGfFoVPwPPekpBk 3MLKwIKDykXVarXo999RrfpZkYjv8Rl+60jGKdOig0nahzZja6NZfT77lsjcvpOoH7fo OzPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693996045; x=1694600845; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pOxX2A/VGHaRwCY2mrksnome5+u09SSJrZuAyhc9Tjs=; b=X5lsIx3R9Px7GcfqeQJaWJnJg0CtZYEdjX/zCY54iX5s+bO3coqSRmUouKEnHEYtj0 qKtURUZ0S25ZKdEc/DbMEJ5i5sViMG+RvCe+g4U54rb/ORJRoqzg+iY/t66TpnlU5H37 z5oHNr3fd4tUsoSLUxesX5FGP0+qN04xtRau8LGIsovyx3lkkqJi20g0CM1azg+GN7K+ m7DFz84oOY0OjgbMuEWsI1OWF8ofEKl49VZfplF919BtgNh+izoKptkX7sS1lo+VPHDe YqCHCu2apnEurJSSCeRZyMPgRjTRPx3lWqfA9MKgq22p9RlqlDUziJ45osDeIdooZ7KN 20JQ== X-Gm-Message-State: AOJu0YxfoEPI4fRHJAMLwTd4JaCkZ04aHYCiqMohtEmkYlKCJ4L6C7Z6 DejughC41yZRISrJrAe5S2+WgwLy/0IT3k2bdRzeBr9wDYQ= X-Google-Smtp-Source: AGHT+IESH9iwT3aJzcnzJys5fjrtMB/rbMQCGbUx+KiCN8h7oy822qfGhoReGUuMcr424VdswJDSqxMcbrJLXd+do3w= X-Received: by 2002:a17:90a:7e82:b0:268:1745:b61 with SMTP id j2-20020a17090a7e8200b0026817450b61mr12224685pjl.34.1693996044893; Wed, 06 Sep 2023 03:27:24 -0700 (PDT) MIME-Version: 1.0 References: <0164dc5a-35a7-2848-8153-5016f7582576.ref@yahoo.co.jp> <0164dc5a-35a7-2848-8153-5016f7582576@yahoo.co.jp> In-Reply-To: <0164dc5a-35a7-2848-8153-5016f7582576@yahoo.co.jp> From: Max Filippov Date: Wed, 6 Sep 2023 03:27:13 -0700 Message-ID: Subject: Re: [PATCH] xtensa: Optimize boolean evaluation when SImode EQ/NE to zero if TARGET_MINMAX To: "Takayuki 'January June' Suwa" Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,FROM_LOCAL_NOVOWEL,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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 Tue, Sep 5, 2023 at 2:29=E2=80=AFAM Takayuki 'January June' Suwa wrote: > > This patch optimizes the boolean evaluation for equality to 0 in SImode > using the MINU (Minimum Value Unsigned) machine instruction available > when TARGET_MINMAX is configured, for example, (x !=3D 0) to MINU(x, 1) > and (x =3D=3D 0) to (MINU(x, 1) ^ 1). > > /* example */ > int test0(int x) { > return x =3D=3D 0; > } > int test1(int x) { > return x !=3D 0; > } > > ;; before > test0: > mov.n a10, a2 > movi.n a9, 1 > movi.n a2, 0 > moveqz a2, a9, a10 > ret.n > test1: > mov.n a10, a2 > movi.n a9, 1 > movi.n a2, 0 > movnez a2, a9, a10 > ret.n > > ;; after (prereq. TARGET_MINMAX) > test0: > movi.n a9, 1 > minu a2, a2, a9 > xor a2, a2, a9 > ret.n > test1: > movi.n a9, 1 > minu a2, a2, a9 > ret.n > > gcc/ChangeLog: > > * config/xtensa/xtensa.cc (xtensa_expand_scc): > Add code for particular constants (only 0 and INT_MIN for now) > for EQ/NE boolean evaluation in SImode. > * config/xtensa/xtensa.md (*eqne_INT_MIN): Remove because its > implementation has been integrated into the above. > --- > gcc/config/xtensa/xtensa.cc | 43 +++++++++++++++++++++++++++++++------ > gcc/config/xtensa/xtensa.md | 34 ----------------------------- > 2 files changed, 37 insertions(+), 40 deletions(-) Regtested for target=3Dxtensa-linux-uclibc, no new regressions. Committed to master. --=20 Thanks. -- Max