From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id 7CC793858D28 for ; Tue, 5 Sep 2023 23:01:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7CC793858D28 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-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-273527a8fdeso1601721a91.2 for ; Tue, 05 Sep 2023 16:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693954884; x=1694559684; 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=H3xf2f652zvNyh22JUcftz2VQ4M5Jqnr8+JKkze8P08=; b=bdqVILAgzYJ1cH1KjlZGgLvu25nACHCvdiEWXC6nZ5vVFo/10dt7BhwFhl5lpw6CLw kiPCBDYSCA3Bf+lVTrFZvFxMVcMEYhLLIZwi4l6IY9CjWqtIGpQYJZUnL+1XsiXX80LY beHBxepP0M8X7AAjDpqGPxRXupnx3svGDEak43gOyonUsqcOAlLVwkDTTnEFf8tvt0Fb oi0zYeEEJ/VM+hQZkpXVS10jGi6kCXw5OudLYmIj0Tg5fWNW5PoqwNU5hwciJPiQCCh1 nN63ho8S8tUx/clKVQkgyIqCM2fm3FmDdt/zjPwbmQY0dJGU5PSEFgT7OLQ4gIQajybd MjCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693954884; x=1694559684; 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=H3xf2f652zvNyh22JUcftz2VQ4M5Jqnr8+JKkze8P08=; b=UgSrbWXMQxFoNojd5PhlkUq/CDwWkyCeqhE/J/3hHa5pvP1m0p3BTyfWreEzufh+vZ xag3dOX5Yk74CJeAhyu4WF5zrsYagCjYjuYGcB0NS8X5qlptfbFBRlXZaT9MN36grYZZ Nt6KwpadGXvgvRmwiywxzPMehAOhQbbNtjXJtAzn+QQunpX0dLfuAXUFa7ZhsZgTYveK NmlWuuw2C5sLjs0ivHuNIxn/DjJzT3HrLaqzYr0BPisHgOTXe1QfgEnJHYRp9jUns3I/ M1ZwXMdMOoKQkQ4ecm+gaAjXlR+OS8Fj4GxKYkkT7ynwM0Qbw9yNfOxOZZdfNBGfOkz/ G7FA== X-Gm-Message-State: AOJu0Yx/P2WzgTAn2jg7F8Vj8nBLH34ny4zGO3/GjpCREQmqdHhmLaB5 kxman219URRt22+rwOpFlomCcyEABo44oGncbIk= X-Google-Smtp-Source: AGHT+IHBH4nSgDBfdFMUuDtEPiV4YBwC7cQW3j2ZbRivm+Wkq9si7VtYPGa2FRbyjy7CRo5eJNn/brB+xwoV/bwHhPs= X-Received: by 2002:a17:90a:744c:b0:268:ee6:6bdf with SMTP id o12-20020a17090a744c00b002680ee66bdfmr11418140pjk.47.1693954884390; Tue, 05 Sep 2023 16:01: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: Tue, 5 Sep 2023 16:01: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.6 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: Hi Suwa-san, 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 ISTM that test0 could be done with movnez in the same three instructions: movi a9, 1 movnez a2, a9, a2 xor a2, a2, a9 > test1: > movi.n a9, 1 > minu a2, a2, a9 > ret.n ISTM that test1 could be done with movnez in the same two instructions: movi a9, 1 movnez a2, a9, a2 --=20 Thanks. -- Max