[{"id":3685434,"web_url":"http://patchwork.ozlabs.org/comment/3685434/","msgid":"<87zf2gtj7l.fsf@googlemail.com>","list_archive_url":null,"date":"2026-05-03T18:57:02","subject":"Re: [to-be-committed][RISC-V][PR rtl-optimization/124766] Simplify\n x + y == y into x == 0","submitter":{"id":4363,"url":"http://patchwork.ozlabs.org/api/people/4363/","name":"Richard Sandiford","email":"rdsandiford@googlemail.com"},"content":"Jeffrey Law <jeffrey.law@oss.qualcomm.com> writes:\n> So this is derived from S_regmatch in spec2017, so fairly hot.\n>\n>\n>\n> long\n> frob (unsigned short *y, long z)\n> {\n>    long ret = (*y << 2) + z;\n>    if (ret != z)\n>      return 0;\n>    return ret;\n> }\n>\n> It generates this code on riscv:\n>\n>\n>          lhu     a5,0(a0)\n>          sh2add  a5,a5,a1\n>          sub     a1,a1,a5\n>          czero.nez       a0,a5,a1\n>          ret\n>\n> That's not bad, but the sh2add and sub are not actually needed. This may \n> look familiar to a case Daniel was recently discussing, the major \n> difference are the types of the function args which I got wrong the \n> first time I reduced this case.\n>\n> czero instructions check their condition for zero/nonzero status. So we \n> just need to know if a1 has a zero/nonzero value at the czero \n> instruction.  So working backwards\n>\n> a1 = a1 - a5                // sub instruction\n> a1 = a1 - ((a5 << 2) + a1)  // substitute from sh2add\n> a1 = a5 << 2                // a1 terms cancel out\n>\n> So we just need the nonzero state of a5 << 2.  Now since a5 was set by \n> the lhu instruction, the upper 48 bits are already known zero, so \n> critically we know the upper 2 bits are zero. Meaning that we can just \n> test a5 as set by the lhu instruction for zero/nonzero.  The net is we \n> can generate this code instead:\n>\n>          lhu     a0,0(a0)\n>          czero.nez       a0,a1,a0\n>          ret\n>\n>\n> It's a small, but visible instruction count savings and likely a small \n> performance improvement on most designs.\n>\n> So the trick to get there is a small simplify-rtx improvement. We just \n> need to simplify\n> (eq/ne (plus (x) (y)) (y)) ->  (eq/ne (x) (0))\n>\n> And all the right things just happen.  Bootstrapped and regression \n> tested on a variety of native platforms including x86, aarch64, riscv \n> and tested across the various embedded targets in my tester.  I'll wait \n> for the RISC-V pre-commit CI tester to render a verdict before going \n> forward.\n>\n>\n> Jeff\n>\n>\n> diff --git a/gcc/testsuite/gcc.target/riscv/pr124766.c b/gcc/testsuite/gcc.target/riscv/pr124766.c\n> new file mode 100644\n> index 000000000000..b16c31e8a9bd\n> --- /dev/null\n> +++ b/gcc/testsuite/gcc.target/riscv/pr124766.c\n> @@ -0,0 +1,17 @@\n> +/* { dg-do compile } */\n> +/* { dg-options \"-march=rv64gcbv_zicond -mabi=lp64d\" { target rv64 } } */\n> +/* { dg-options \"-march=rv32gcbv_zicond -mabi=ilp32\" { target rv32 } } */\n> +/* { dg-skip-if \"\" { *-*-* } { \"-O0\" \"-Og\" } } */\n> +\n> +long\n> +frob (unsigned short *y, long z)\n> +{\n> +  long ret = (*y << 2) + z;\n> +  if (ret != z)\n> +    return 0;\n> +  return ret;\n> +}\n> +\n> +/* { dg-final { scan-assembler-not \"sh2add\" } } */\n> +/* { dg-final { scan-assembler-not \"sub\" } } */\n> +\n> diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc\n> index 50fc51152cab..23de16800065 100644\n> --- a/gcc/simplify-rtx.cc\n> +++ b/gcc/simplify-rtx.cc\n> @@ -6649,6 +6649,14 @@ simplify_context::simplify_relational_operation_1 (rtx_code code,\n>        return simplify_gen_relational (code, mode, cmp_mode, x, tem);\n>      }\n>  \n> +  /* (eq/ne (plus (x) (y)) y) simplifies to (eq/ne x 0).  */\n> +  if ((code == EQ || code == NE)\n> +      && op0code == PLUS\n> +      && XEXP (op0, 1) == op1\n\nLooks like this would be better as rtx_equal_p, since it applies even\nto y that aren't shared.  Also...\n\n> +      && (INTEGRAL_MODE_P (cmp_mode) || flag_unsafe_math_optimizations))\n> +    return simplify_gen_relational (code, mode, cmp_mode,\n> +\t\t\t\t    XEXP (op0, 0), const0_rtx);\n\nif we want to support the non-integral flag_unsafe_math_optimizations case,\nwe'd need to use CONST0_RTX (cmp_mode) instead of const0_rtx.\n\nThanks,\nRichard\n\n> +\n>    /* (ne:SI (zero_extract:SI FOO (const_int 1) BAR) (const_int 0))) is\n>       the same as (zero_extract:SI FOO (const_int 1) BAR).  */\n>    scalar_int_mode int_mode, int_cmp_mode;","headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=googlemail.com header.i=@googlemail.com\n header.a=rsa-sha256 header.s=20251104 header.b=ec9iNk7z;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=googlemail.com header.i=@googlemail.com\n header.a=rsa-sha256 header.s=20251104 header.b=ec9iNk7z","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=googlemail.com","sourceware.org; spf=pass smtp.mailfrom=googlemail.com","server2.sourceware.org;\n arc=none smtp.remote-ip=2a00:1450:4864:20::331"],"Received":["from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g7vD55YGFz1yJ0\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 04 May 2026 04:57:40 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 663644BB24CC\n\tfor <incoming@patchwork.ozlabs.org>; Sun,  3 May 2026 18:57:38 +0000 (GMT)","from mail-wm1-x331.google.com (mail-wm1-x331.google.com\n [IPv6:2a00:1450:4864:20::331])\n by sourceware.org (Postfix) with ESMTPS id A95894BAE7DD\n for <gcc-patches@gcc.gnu.org>; Sun,  3 May 2026 18:57:09 +0000 (GMT)","by mail-wm1-x331.google.com with SMTP id\n 5b1f17b1804b1-4852a9c6309so26625275e9.0\n for <gcc-patches@gcc.gnu.org>; Sun, 03 May 2026 11:57:09 -0700 (PDT)","from localhost ([2a00:23c7:ef4f:7201::fad])\n by smtp.googlemail.com with ESMTPSA id\n 5b1f17b1804b1-48a8eb75fe8sm217809195e9.8.2026.05.03.11.57.07\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 03 May 2026 11:57:08 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 663644BB24CC","OpenDKIM Filter v2.11.0 sourceware.org A95894BAE7DD"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org A95894BAE7DD","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org A95894BAE7DD","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777834629; cv=none;\n b=hXoQ17LJG5AXEppJuaIjk4x+JSRwTq9t+3nswb4KDCARJzmgHuFxjDy+0T+Q8KkyiNYyYvCbrhU7Mr/hTguNyJceTMU97mbwc6uQgfDKkjyUZtRSuTZyqc+StPJ+Bk9AePka11bX8Kv0A7riSnr2jD/vzoJo3lsqkiJ2az7BaW8=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777834629; c=relaxed/simple;\n bh=8Pgtd/hX+jQHdFkoVxVqYhVLj9gbTX2qqzObbLXHw1s=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=lnZW29EjdfdZNw+GkyJsKiwSbirnjzDt9S6h5xPO9p+E/beF/1vn9yQCEz5lO0S+hd8apkQ+RAKK9CXrssQYN/jmVtUq19fypsaWjI2NK3gZP371MdGiH1L7qU/ErMpdXOJO7VUSSKw8QE/MRMjrHasJS0jErqnar5lS+Cka8/0=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=googlemail.com; s=20251104; t=1777834628; x=1778439428; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:user-agent:message-id:date\n :references:in-reply-to:subject:cc:mail-followup-to:to:from:from:to\n :cc:subject:date:message-id:reply-to;\n bh=xMBAV32pgzZIgB/2SegN6GkCJdnJvHYMtIQwR0EdrCc=;\n b=ec9iNk7zmg9StR0XVdVD2AVM/ODGIEyt0XCr1Z944ZQMITFpn+NN04jUjbKibuLuHS\n lNAGwXraa0hHtPw9Y6i7MYEOxjVBAyzySXhH/aVSQT6s3J5QuQHMfLVgBOxfiX3bAMhu\n WksDgboNNlxnhqYBmy+nIcTJNB74LeRX4VR2lLZh2Pjd+2S7mA79yhY9HQMxpZ5Nzp1h\n XpEM2XdrtncxiAgNYifqOKfnBKG/IUzdlO+wFeL/HcjZC2LribjqLP8q8BbHOjNk7m8P\n 7OEk+KXpD2v65TdmFrvMxdcAmmn785b/IO2FuONCTxA6SAoa1/RI0T9EgU1hZJRGkj4F\n n+Tg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777834628; x=1778439428;\n h=content-transfer-encoding:mime-version:user-agent:message-id:date\n :references:in-reply-to:subject:cc:mail-followup-to:to:from:x-gm-gg\n :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n bh=xMBAV32pgzZIgB/2SegN6GkCJdnJvHYMtIQwR0EdrCc=;\n b=Vd+jAdYLAsSoKYRtDVrtSOAjFMEFmf3lnsPdSYG5ztQjoV45jlhJAA8htBISLVrC/9\n qEtv/VfKJxr93d/5lmB3SvgAFf0iiLFHOUs2mnQjx/4Dqi51mZzjEc4qA1UUP/DhmF1k\n FQH/iN1S1ElQUhTExfPGHHk/XvDrfG6vg4kQYzaLbUDPknhqnfYwa9vL/9V8byCMjtJx\n H7J+NhrOVLyFFhyMGMLa1APVdNHfSt/nagyk9f+QRfBrfSemc2nc98PZqI3g12Sg91Wm\n PGVrZmCAp6CAkSkuJFqZOG6DgZtOsu6sOuGUdc3iJAwXPmI8Dt0OO95JaLLBpUAodd/S\n 6SlQ==","X-Gm-Message-State":"AOJu0Yzk193QaUqgE7lF7ncZ/QT4kNZET8PDDnwtcRTtUIBott7fEJJb\n 9bhu6OzTF4ORQD6/eO91U6gIpAQ7MO80uilAsMJZX+k5NK2axvTlaGhX0eguHg==","X-Gm-Gg":"AeBDietxcvtOF2UatadXVoxdBSxXv3ic6etYWOJk5TyWPF8aI8dRDHbYAquYhcskTXf\n 4x1X3RBSRZwZ4dTNxtMt9bQVM4qRWLNqMKSAKi3oK6nMP/O7eqEpKl2xm6yzNKUdUXWjZky5WuM\n j8MCfXfQLXgsw7kgt5KWPAR9RnZgFkqmLPMsyHYhCQVmtUpPGQS/9KwU6UfjR9SbUQPWcQbnc43\n 9cPlkuGHLXlSLePytqcUudZRy3SEmoZI1RIUS8DkoQelvbIuZdiHv+bQQ2I6+7eXx+OWw39jImX\n gsgWWf6Sphcrm0K1jhAp/jbNuqf9rkbRo8x0xfYR7wKlfMrEjoqHG/upjd/w9fhA+2TZcVrBfvV\n 0Z9htBSORfWH2/bJqhHWM5e4PSMqhgvUVTquK749mOrGTPKleHBpxNPeKtyjHh2m4IPy8qLniB9\n Sirt14oaw88T6qD4AmxwjWXiA=","X-Received":"by 2002:a05:600d:f:b0:488:904b:f31 with SMTP id\n 5b1f17b1804b1-48a9866a9a3mr89143375e9.22.1777834628550;\n Sun, 03 May 2026 11:57:08 -0700 (PDT)","From":"Richard Sandiford <rdsandiford@googlemail.com>","To":"Jeffrey Law <jeffrey.law@oss.qualcomm.com>","Mail-Followup-To":"Jeffrey Law <jeffrey.law@oss.qualcomm.com>,'GCC Patches'\n <gcc-patches@gcc.gnu.org>, rdsandiford@googlemail.com","Cc":"'GCC Patches' <gcc-patches@gcc.gnu.org>","Subject":"Re: [to-be-committed][RISC-V][PR rtl-optimization/124766] Simplify\n x + y == y into x == 0","In-Reply-To":"<57d65cb4-e71b-41c6-a038-41ac3d993cd3@oss.qualcomm.com> (Jeffrey\n Law's message of \"Sun, 3 May 2026 08:01:42 -0600\")","References":"<57d65cb4-e71b-41c6-a038-41ac3d993cd3@oss.qualcomm.com>","Date":"Sun, 03 May 2026 19:57:02 +0100","Message-ID":"<87zf2gtj7l.fsf@googlemail.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"}},{"id":3685436,"web_url":"http://patchwork.ozlabs.org/comment/3685436/","msgid":"<87tssotix8.fsf@googlemail.com>","list_archive_url":null,"date":"2026-05-03T19:03:15","subject":"Re: [to-be-committed][RISC-V][PR rtl-optimization/124766] Simplify\n x + y == y into x == 0","submitter":{"id":4363,"url":"http://patchwork.ozlabs.org/api/people/4363/","name":"Richard Sandiford","email":"rdsandiford@googlemail.com"},"content":"Richard Sandiford <rdsandiford@googlemail.com> writes:\n> Jeffrey Law <jeffrey.law@oss.qualcomm.com> writes:\n>> So this is derived from S_regmatch in spec2017, so fairly hot.\n>>\n>>\n>>\n>> long\n>> frob (unsigned short *y, long z)\n>> {\n>>    long ret = (*y << 2) + z;\n>>    if (ret != z)\n>>      return 0;\n>>    return ret;\n>> }\n>>\n>> It generates this code on riscv:\n>>\n>>\n>>          lhu     a5,0(a0)\n>>          sh2add  a5,a5,a1\n>>          sub     a1,a1,a5\n>>          czero.nez       a0,a5,a1\n>>          ret\n>>\n>> That's not bad, but the sh2add and sub are not actually needed. This may \n>> look familiar to a case Daniel was recently discussing, the major \n>> difference are the types of the function args which I got wrong the \n>> first time I reduced this case.\n>>\n>> czero instructions check their condition for zero/nonzero status. So we \n>> just need to know if a1 has a zero/nonzero value at the czero \n>> instruction.  So working backwards\n>>\n>> a1 = a1 - a5                // sub instruction\n>> a1 = a1 - ((a5 << 2) + a1)  // substitute from sh2add\n>> a1 = a5 << 2                // a1 terms cancel out\n>>\n>> So we just need the nonzero state of a5 << 2.  Now since a5 was set by \n>> the lhu instruction, the upper 48 bits are already known zero, so \n>> critically we know the upper 2 bits are zero. Meaning that we can just \n>> test a5 as set by the lhu instruction for zero/nonzero.  The net is we \n>> can generate this code instead:\n>>\n>>          lhu     a0,0(a0)\n>>          czero.nez       a0,a1,a0\n>>          ret\n>>\n>>\n>> It's a small, but visible instruction count savings and likely a small \n>> performance improvement on most designs.\n>>\n>> So the trick to get there is a small simplify-rtx improvement. We just \n>> need to simplify\n>> (eq/ne (plus (x) (y)) (y)) ->  (eq/ne (x) (0))\n>>\n>> And all the right things just happen.  Bootstrapped and regression \n>> tested on a variety of native platforms including x86, aarch64, riscv \n>> and tested across the various embedded targets in my tester.  I'll wait \n>> for the RISC-V pre-commit CI tester to render a verdict before going \n>> forward.\n>>\n>>\n>> Jeff\n>>\n>>\n>> diff --git a/gcc/testsuite/gcc.target/riscv/pr124766.c b/gcc/testsuite/gcc.target/riscv/pr124766.c\n>> new file mode 100644\n>> index 000000000000..b16c31e8a9bd\n>> --- /dev/null\n>> +++ b/gcc/testsuite/gcc.target/riscv/pr124766.c\n>> @@ -0,0 +1,17 @@\n>> +/* { dg-do compile } */\n>> +/* { dg-options \"-march=rv64gcbv_zicond -mabi=lp64d\" { target rv64 } } */\n>> +/* { dg-options \"-march=rv32gcbv_zicond -mabi=ilp32\" { target rv32 } } */\n>> +/* { dg-skip-if \"\" { *-*-* } { \"-O0\" \"-Og\" } } */\n>> +\n>> +long\n>> +frob (unsigned short *y, long z)\n>> +{\n>> +  long ret = (*y << 2) + z;\n>> +  if (ret != z)\n>> +    return 0;\n>> +  return ret;\n>> +}\n>> +\n>> +/* { dg-final { scan-assembler-not \"sh2add\" } } */\n>> +/* { dg-final { scan-assembler-not \"sub\" } } */\n>> +\n>> diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc\n>> index 50fc51152cab..23de16800065 100644\n>> --- a/gcc/simplify-rtx.cc\n>> +++ b/gcc/simplify-rtx.cc\n>> @@ -6649,6 +6649,14 @@ simplify_context::simplify_relational_operation_1 (rtx_code code,\n>>        return simplify_gen_relational (code, mode, cmp_mode, x, tem);\n>>      }\n>>  \n>> +  /* (eq/ne (plus (x) (y)) y) simplifies to (eq/ne x 0).  */\n>> +  if ((code == EQ || code == NE)\n>> +      && op0code == PLUS\n>> +      && XEXP (op0, 1) == op1\n>\n> Looks like this would be better as rtx_equal_p, since it applies even\n> to y that aren't shared.\n\n...although I suppose that would also mean checking !side_effects_p (op1),\nsince we drop one instance.\n\n> Also...\n>\n>> +      && (INTEGRAL_MODE_P (cmp_mode) || flag_unsafe_math_optimizations))\n>> +    return simplify_gen_relational (code, mode, cmp_mode,\n>> +\t\t\t\t    XEXP (op0, 0), const0_rtx);\n>\n> if we want to support the non-integral flag_unsafe_math_optimizations case,\n> we'd need to use CONST0_RTX (cmp_mode) instead of const0_rtx.\n>\n> Thanks,\n> Richard\n>\n>> +\n>>    /* (ne:SI (zero_extract:SI FOO (const_int 1) BAR) (const_int 0))) is\n>>       the same as (zero_extract:SI FOO (const_int 1) BAR).  */\n>>    scalar_int_mode int_mode, int_cmp_mode;","headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=googlemail.com header.i=@googlemail.com\n header.a=rsa-sha256 header.s=20251104 header.b=AP0JEH8g;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=googlemail.com header.i=@googlemail.com\n header.a=rsa-sha256 header.s=20251104 header.b=AP0JEH8g","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=googlemail.com","sourceware.org; spf=pass smtp.mailfrom=googlemail.com","server2.sourceware.org;\n arc=none smtp.remote-ip=2a00:1450:4864:20::434"],"Received":["from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g7vM926XHz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 04 May 2026 05:03:47 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id B12D64B9700B\n\tfor <incoming@patchwork.ozlabs.org>; Sun,  3 May 2026 19:03:45 +0000 (GMT)","from mail-wr1-x434.google.com (mail-wr1-x434.google.com\n [IPv6:2a00:1450:4864:20::434])\n by sourceware.org (Postfix) with ESMTPS id 403414BA540B\n for <gcc-patches@gcc.gnu.org>; Sun,  3 May 2026 19:03:18 +0000 (GMT)","by mail-wr1-x434.google.com with SMTP id\n ffacd0b85a97d-43fe608cb92so1921552f8f.2\n for <gcc-patches@gcc.gnu.org>; Sun, 03 May 2026 12:03:18 -0700 (PDT)","from localhost ([2a00:23c7:ef4f:7201::fad])\n by smtp.googlemail.com with ESMTPSA id\n 5b1f17b1804b1-48a8fe4b4edsm78438865e9.0.2026.05.03.12.03.16\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 03 May 2026 12:03:16 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org B12D64B9700B","OpenDKIM Filter v2.11.0 sourceware.org 403414BA540B"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 403414BA540B","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 403414BA540B","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777834998; cv=none;\n b=PpqCreXBat3YnTWgHaNA+yRjbNyVfqhvOCsmaOJVssgwp2sNKX7uVN1UCRTdgHgDNwEI9k9ul0lN1jiN5UEthMkhxU0PAtEy62xL1yVZNDMX1iZklUHvo2O0i/XsIqmPSjVr9Bq8LopSMh6GPOPnmN5u4oZ8n9xuwQdgeaqPMM4=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777834998; c=relaxed/simple;\n bh=7GQSEI+zcI19nT9TriMiamIkUlrle2bhwP/8PStHz8E=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=r1zgTsLwujEnhHwYsg0uWuffE3vYEHxyVtK7TlzDi/+33mCuRyT7WQCHJMVMhPfeGwwpMmTBrsT5RFSCSaTNu3KkWmFgiV0/lkv6t7mQEpurmjimheazt8h0E64AbRdTgQPNrBXvIVoNsjLOTyQFXKZCoumuzETp63Q1wsSYmT8=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=googlemail.com; s=20251104; t=1777834997; x=1778439797; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:user-agent:message-id:date\n :references:in-reply-to:subject:cc:mail-followup-to:to:from:from:to\n :cc:subject:date:message-id:reply-to;\n bh=cg7/hsY4JWUvphpG7LfdQx7HVOG+L+llhANNIYDR7uo=;\n b=AP0JEH8gMJocslkTEQ7YDJg2W7L1I5k93qL9p7m+vJhZ1AwdxqfIPc3T6l2QGihD4H\n 4RVL730fdLOQvXFGLFfJe56CGiFef0nCXJ4KqTg00BSs8K3haE3096h035aHABwDNqhd\n yilaPFuqrbr3l0yYRsi7UbByqb8PxPxUzvkv0TOSUWpaGXi+gs62DY9PXWRG6rmEegkM\n fcZaLN49QT6McqNjdPHiPUA1AvDB3GuaeUEc6HfW7QjbSor04gJ2kUTy8vfI1oHVnuu4\n VHU1v0IM48KLecihuXFkaCD8ujPKz2wNBO9gzTiE3GKqflQrTLBk+TJovmFpHQMZwngH\n 12tQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777834997; x=1778439797;\n h=content-transfer-encoding:mime-version:user-agent:message-id:date\n :references:in-reply-to:subject:cc:mail-followup-to:to:from:x-gm-gg\n :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n bh=cg7/hsY4JWUvphpG7LfdQx7HVOG+L+llhANNIYDR7uo=;\n b=R8i8s4h00tLaVrrGFX5v5tHnX1QhQGf4Txrh179dao0SXNoYG+woV3cpcoVDKzTsx3\n NhzpoHr5yebnFEj+/+gy+tgz8Bry86VJi+rDB2GjDBpZZzblrdWRGJTJpMTYHtPDYVng\n CGMTV0PndHgRvidNcA0IUwjFAlIIhjKwOAyWvIOwHiAq+Bt4A9lfGo2hrGHF0Zgn82NF\n t5ZYCLydHs6wI7GatCSpTx8wJRQYDOr9eY3y9W3HSR3mpu3zdNPs8JWQS0PeZbzJJk1T\n p418RgMqP7cFlocs+kFyxJT+gZxc8ov3Tr5ZhSvhaGr4G4jo1938B/bo0MJlqENnaBFD\n hsCg==","X-Gm-Message-State":"AOJu0YyQPPQ4Cq8RiEtqvh9+XagU06PaOECbVKE6PBDIZhNTsEqZHpIM\n rXOZuUUqd45SU7SFPFu/QLIrBalNZpxtF5/r/YgpZi3StkXqXivLB9tJfx0cSw==","X-Gm-Gg":"AeBDiev51n815QVuV0p8KY0H9UoK7DvWjspgqLaVIGLMtIQdFx7fMe+siaixWNruXAn\n rUda0vVpf5BqDNgcHl+d25M6GfB4uuaoVm5uMXtAORpoxSYp3cOsrOzCVdU2+4P1DEy5iTiKk/F\n jdWrZ3kkz4yikcGSF7m+b3s2joNPpIHlpGpXMhiZVUUypmXNNihWN9H1E7XxbVaIhtB9dA9h8JX\n OhCqGiHGhg3krAOdtgg90SAg6jkxdlCCGcVrlldk2OIhChAHb1edFkk7VKO91KyLY1t/Z6IIpdQ\n koqbB/Aw/4Y3sCiBMvm4+zA7ID0uOyzAchKhXixkx7fjEOMgaH1TYyg+JePOFRPKJiU3CR2TI4r\n xdMhku7Dh2hQtXwGsEJx/KX0SufzQbC4Uq0JTjDJm+JbShfCd7BEq3L5quKYH15dfAqAJn2YypP\n 2cqR/XGX+O+PLVcsJxNnoUOBo=","X-Received":"by 2002:a05:600c:3e0e:b0:48a:52ce:a4b1 with SMTP id\n 5b1f17b1804b1-48a98893048mr119492245e9.15.1777834997072;\n Sun, 03 May 2026 12:03:17 -0700 (PDT)","From":"Richard Sandiford <rdsandiford@googlemail.com>","To":"Jeffrey Law <jeffrey.law@oss.qualcomm.com>","Mail-Followup-To":"Jeffrey Law <jeffrey.law@oss.qualcomm.com>,'GCC Patches'\n <gcc-patches@gcc.gnu.org>, rdsandiford@googlemail.com","Cc":"'GCC Patches' <gcc-patches@gcc.gnu.org>","Subject":"Re: [to-be-committed][RISC-V][PR rtl-optimization/124766] Simplify\n x + y == y into x == 0","In-Reply-To":"<87zf2gtj7l.fsf@googlemail.com> (Richard Sandiford's message of\n \"Sun, 03 May 2026 19:57:02 +0100\")","References":"<57d65cb4-e71b-41c6-a038-41ac3d993cd3@oss.qualcomm.com>\n <87zf2gtj7l.fsf@googlemail.com>","Date":"Sun, 03 May 2026 20:03:15 +0100","Message-ID":"<87tssotix8.fsf@googlemail.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"}},{"id":3685461,"web_url":"http://patchwork.ozlabs.org/comment/3685461/","msgid":"<3a647579-7d49-4ebb-9411-572df1f2de8b@oss.qualcomm.com>","list_archive_url":null,"date":"2026-05-03T22:35:54","subject":"Re: [to-be-committed][RISC-V][PR rtl-optimization/124766] Simplify x\n + y == y into x == 0","submitter":{"id":92310,"url":"http://patchwork.ozlabs.org/api/people/92310/","name":"Jeffrey Law","email":"jeffrey.law@oss.qualcomm.com"},"content":"On 5/3/2026 1:03 PM, Richard Sandiford wrote:\n> Richard Sandiford <rdsandiford@googlemail.com> writes:\n>> Jeffrey Law <jeffrey.law@oss.qualcomm.com> writes:\n>>> So this is derived from S_regmatch in spec2017, so fairly hot.\n>>>\n>>>\n>>>\n>>> long\n>>> frob (unsigned short *y, long z)\n>>> {\n>>>     long ret = (*y << 2) + z;\n>>>     if (ret != z)\n>>>       return 0;\n>>>     return ret;\n>>> }\n>>>\n>>> It generates this code on riscv:\n>>>\n>>>\n>>>           lhu     a5,0(a0)\n>>>           sh2add  a5,a5,a1\n>>>           sub     a1,a1,a5\n>>>           czero.nez       a0,a5,a1\n>>>           ret\n>>>\n>>> That's not bad, but the sh2add and sub are not actually needed. This may\n>>> look familiar to a case Daniel was recently discussing, the major\n>>> difference are the types of the function args which I got wrong the\n>>> first time I reduced this case.\n>>>\n>>> czero instructions check their condition for zero/nonzero status. So we\n>>> just need to know if a1 has a zero/nonzero value at the czero\n>>> instruction.  So working backwards\n>>>\n>>> a1 = a1 - a5                // sub instruction\n>>> a1 = a1 - ((a5 << 2) + a1)  // substitute from sh2add\n>>> a1 = a5 << 2                // a1 terms cancel out\n>>>\n>>> So we just need the nonzero state of a5 << 2.  Now since a5 was set by\n>>> the lhu instruction, the upper 48 bits are already known zero, so\n>>> critically we know the upper 2 bits are zero. Meaning that we can just\n>>> test a5 as set by the lhu instruction for zero/nonzero.  The net is we\n>>> can generate this code instead:\n>>>\n>>>           lhu     a0,0(a0)\n>>>           czero.nez       a0,a1,a0\n>>>           ret\n>>>\n>>>\n>>> It's a small, but visible instruction count savings and likely a small\n>>> performance improvement on most designs.\n>>>\n>>> So the trick to get there is a small simplify-rtx improvement. We just\n>>> need to simplify\n>>> (eq/ne (plus (x) (y)) (y)) ->  (eq/ne (x) (0))\n>>>\n>>> And all the right things just happen.  Bootstrapped and regression\n>>> tested on a variety of native platforms including x86, aarch64, riscv\n>>> and tested across the various embedded targets in my tester.  I'll wait\n>>> for the RISC-V pre-commit CI tester to render a verdict before going\n>>> forward.\n>>>\n>>>\n>>> Jeff\n>>>\n>>>\n>>> diff --git a/gcc/testsuite/gcc.target/riscv/pr124766.c b/gcc/testsuite/gcc.target/riscv/pr124766.c\n>>> new file mode 100644\n>>> index 000000000000..b16c31e8a9bd\n>>> --- /dev/null\n>>> +++ b/gcc/testsuite/gcc.target/riscv/pr124766.c\n>>> @@ -0,0 +1,17 @@\n>>> +/* { dg-do compile } */\n>>> +/* { dg-options \"-march=rv64gcbv_zicond -mabi=lp64d\" { target rv64 } } */\n>>> +/* { dg-options \"-march=rv32gcbv_zicond -mabi=ilp32\" { target rv32 } } */\n>>> +/* { dg-skip-if \"\" { *-*-* } { \"-O0\" \"-Og\" } } */\n>>> +\n>>> +long\n>>> +frob (unsigned short *y, long z)\n>>> +{\n>>> +  long ret = (*y << 2) + z;\n>>> +  if (ret != z)\n>>> +    return 0;\n>>> +  return ret;\n>>> +}\n>>> +\n>>> +/* { dg-final { scan-assembler-not \"sh2add\" } } */\n>>> +/* { dg-final { scan-assembler-not \"sub\" } } */\n>>> +\n>>> diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc\n>>> index 50fc51152cab..23de16800065 100644\n>>> --- a/gcc/simplify-rtx.cc\n>>> +++ b/gcc/simplify-rtx.cc\n>>> @@ -6649,6 +6649,14 @@ simplify_context::simplify_relational_operation_1 (rtx_code code,\n>>>         return simplify_gen_relational (code, mode, cmp_mode, x, tem);\n>>>       }\n>>>   \n>>> +  /* (eq/ne (plus (x) (y)) y) simplifies to (eq/ne x 0).  */\n>>> +  if ((code == EQ || code == NE)\n>>> +      && op0code == PLUS\n>>> +      && XEXP (op0, 1) == op1\n>> Looks like this would be better as rtx_equal_p, since it applies even\n>> to y that aren't shared.\n> ...although I suppose that would also mean checking !side_effects_p (op1),\n> since we drop one instance.\nAgreed on all three issues you've raised.  Thanks for catching them.  \nI'll do a sanity test with those.\n\nIt's always interesting.  Sometimes the time away from a patch, then \nlooking at it again months later makes some bugs/improvements painfully \nobvious.  Other times it's easy to forget that there were things to \nclean up...  Can't say if it's generally good or bad, but I've seen both \nhappen in my on efforts.\n\n\njeff","headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256\n header.s=qcppdkim1 header.b=c1OPGXc3;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.a=rsa-sha256 header.s=google header.b=heaFQGy+;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256\n header.s=qcppdkim1 header.b=c1OPGXc3;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.a=rsa-sha256 header.s=google header.b=heaFQGy+","sourceware.org; dmarc=none (p=none dis=none)\n header.from=oss.qualcomm.com","sourceware.org;\n spf=pass smtp.mailfrom=oss.qualcomm.com","server2.sourceware.org;\n arc=none smtp.remote-ip=205.220.180.131"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g804Y567qz1yJ0\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 04 May 2026 08:36:29 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 9E36B4B99F56\n\tfor <incoming@patchwork.ozlabs.org>; Sun,  3 May 2026 22:36:27 +0000 (GMT)","from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com\n [205.220.180.131])\n by sourceware.org (Postfix) with ESMTPS id E8E784BAE7FD\n for <gcc-patches@gcc.gnu.org>; Sun,  3 May 2026 22:35:57 +0000 (GMT)","from pps.filterd (m0279873.ppops.net [127.0.0.1])\n by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 643M6XJV2549610\n for <gcc-patches@gcc.gnu.org>; Sun, 3 May 2026 22:35:57 GMT","from mail-dl1-f71.google.com (mail-dl1-f71.google.com\n [74.125.82.71])\n by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dw6mpbxsv-1\n (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT)\n for <gcc-patches@gcc.gnu.org>; Sun, 03 May 2026 22:35:57 +0000 (GMT)","by mail-dl1-f71.google.com with SMTP id\n a92af1059eb24-12dece274b1so4810675c88.1\n for <gcc-patches@gcc.gnu.org>; Sun, 03 May 2026 15:35:57 -0700 (PDT)","from [172.31.0.17] ([136.38.201.137])\n by smtp.gmail.com with ESMTPSA id\n a92af1059eb24-12df84252c0sm15430827c88.10.2026.05.03.15.35.54\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Sun, 03 May 2026 15:35:54 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 9E36B4B99F56","OpenDKIM Filter v2.11.0 sourceware.org E8E784BAE7FD"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org E8E784BAE7FD","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org E8E784BAE7FD","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777847758; cv=none;\n b=n3kZUAM0ibuat8BC4EgR7eJm3OU90hbBL9F9Ezy/Mp4hClf+6Dm3mwm/w95LS0TXm3IcHaLBHEszGavOYUxCHxPbgNCUCn87+UUZXP6ah/9TjwOiJKkNmhs3rG0pRvXWBZvme5qSvSPXQ4gQSmiRnACIh/5U29Q7ZVjhJ+0OS+Q=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777847758; c=relaxed/simple;\n bh=YE0idOIxSw4FUD4qFwUCiN1EwlePk8qzjSvkPKT3rlM=;\n h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version:\n Subject:To:From;\n b=LkG5usdWOHJmCmv51u9RshgfYlFREQ8TEUCjntvSOLYRVYNjuC2AxQJ1Wf1RDx1KVtOxQeM3EYXuSaGkg42jzrjZKyagfuJN3H+IDTAcHppzBre1QEq9OBIn/7HMNRjH8DkDxFuVFmvgfE2DbYsF2o8F69eNslLsn42rVaz+tqo=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=\n content-transfer-encoding:content-type:date:from:in-reply-to\n :message-id:mime-version:references:subject:to; s=qcppdkim1; bh=\n yxc+fZwkE/pB3psq7UPRCP4B69xGXLS8tT3ThDc576A=; b=c1OPGXc3NH/gsSFb\n JrIaTKNxY/DlHNXzP28VIecrTNW2QzaaA2qNwe/hTpr71QjwvbCEPQmUYByHQTVe\n BzYSl4rZACn4IAk1hhLhUkd9CiC2BSAiVdpffor/EZb9mMe1KYmwwbFY2lPZNajf\n Xl08RJNTArs6Uhtc7mYV68gatq6b629CWYEd4n0uUYXWTvEemg/RxUGcGLvU0rEE\n Kkmmm4X2U4ddlkzxZAegUNjP+seYZmCrQceDaVfKWUF1cm0cbNdNHc1i9OGw5p6a\n 6/8mPD04uMt8hrfMTe50s6o230WJ2PeSXjwV+jSzLeqsESpH5Rilco0O6cUwa0Li\n wnhHxA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=oss.qualcomm.com; s=google; t=1777847756; x=1778452556; darn=gcc.gnu.org;\n h=content-transfer-encoding:in-reply-to:from:content-language\n :references:to:subject:user-agent:mime-version:date:message-id:from\n :to:cc:subject:date:message-id:reply-to;\n bh=yxc+fZwkE/pB3psq7UPRCP4B69xGXLS8tT3ThDc576A=;\n b=heaFQGy+V67rjM6raed+8SQ4kcNWPg6fHoCvOWRQ7S0UE4tvqrTomGimWw1wmB8LYF\n dclFFW/wiHvQKFsgvEXMB02Yy5jJJEKPx65NGaQtKPg9WJnXG8OR9Au/A3HmweC/HDSf\n EbKKDL+yrrzrcIkaXWoZs3JmuUzcTzZTxG8b/3YwRHozLmrUc4keSWmlKO7WtDRZuZQ0\n tGQ7oMykHHyjoin8WQAzTuxInGfFrbRVzTMogXiYqE5qdeSMqKbfeDpCGfXyoUs6O2ML\n vsnpiAAUCmIotlxDIIueZFfg1C2FrgcgwekBUbYaRATgIQKcSPurbg6TISgrwKGMlS6Q\n avsw=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777847756; x=1778452556;\n h=content-transfer-encoding:in-reply-to:from:content-language\n :references:to:subject:user-agent:mime-version:date:message-id\n :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=yxc+fZwkE/pB3psq7UPRCP4B69xGXLS8tT3ThDc576A=;\n b=gs3+c0li0yrRpBJqT1J6SDAPYe2oJP4rBF80z3asp3Xe4frHMI3nY2h6GADgZSVi7y\n 0uzs0Ol13sxTLzXrUMCBVHohVq0bWMfVHJqIXC4h6vQrUMSd0MYSEZJzDr8L7NlSVVJi\n FGeBHpphsX5THD7TVTejJqKME7gNVksSFSMwVMyjBv4BV/JoZEWBzWog01MOT2sN0AV5\n IjE+OTN9GrEqkY4qxe0AtvTgq4dOLScrQxwYBLtSDHEq+olDH7UZ+sweFdDukNUyV11q\n FCV+US8AEbsDmAwGm+25gYDj+9lx8Fky8+3YWPDblsdLKOblRFPxZX2mFfNiJjnU+Phs\n 7kug==","X-Gm-Message-State":"AOJu0YzwZH8DjizcFE2pt1yUQHRdxHb+WrlExoxJJnaVRCrD6Ugkp3qN\n rB+lBNDTlJViCje28ZmgKXPjsnFnh2gyDgjIWoHiFffr66J9UUDtlqBBDRjueB8lltU/A8+5kWR\n mA13osXABBEhFjJHVezB3ZOLqwkpEBbm8qhpQ2WftZ9joVrRcM1HojgTMWEpAAUxdmPMD","X-Gm-Gg":"AeBDieuAB27uidariQPwsiwJStycjOCDw4lRRQO/7h8tc+aT1WEFMYFU9W8enqc5lmo\n lXSm2B0WEZmTkG2jvqbYHdkd9x/Zp63tQF/Z2PMYYzYx1kO0A78iBn3cFpFDhxKAdTgATzquTKV\n wAF4eu8Ekp8/e3v5TX8oIVCYdduMak4uqZxLo3BsVvXFjrD6pFlopEo6oKBtMIYkzmA/vkpIkBL\n fMTS8n6QEqE34Lz4jZLu6oh+zfElb2qkupO1cQQg26eweiP7hb/vujodxaoq3NFAAJh6wF4V3ej\n D1ruL923deL15GkES9/SFB0xCcrZ45JsN1C/M1suO6KoO416b4one4x/I+6vbNAoCUgKocjsTY0\n ZzXW6Co2iNGYAxhVP5LT3nyQaUOvswL3saA1DKGZ48PmFgxt7+mr0ABjixYvD","X-Received":["by 2002:a05:7022:e1e:b0:128:d20a:2f40 with SMTP id\n a92af1059eb24-12dfd79e773mr3798306c88.8.1777847756050;\n Sun, 03 May 2026 15:35:56 -0700 (PDT)","by 2002:a05:7022:e1e:b0:128:d20a:2f40 with SMTP id\n a92af1059eb24-12dfd79e773mr3798295c88.8.1777847755385;\n Sun, 03 May 2026 15:35:55 -0700 (PDT)"],"Message-ID":"<3a647579-7d49-4ebb-9411-572df1f2de8b@oss.qualcomm.com>","Date":"Sun, 3 May 2026 16:35:54 -0600","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [to-be-committed][RISC-V][PR rtl-optimization/124766] Simplify x\n + y == y into x == 0","To":"'GCC Patches' <gcc-patches@gcc.gnu.org>, rdsandiford@googlemail.com","References":"<57d65cb4-e71b-41c6-a038-41ac3d993cd3@oss.qualcomm.com>\n <87zf2gtj7l.fsf@googlemail.com> <87tssotix8.fsf@googlemail.com>","Content-Language":"en-US","From":"Jeffrey Law <jeffrey.law@oss.qualcomm.com>","In-Reply-To":"<87tssotix8.fsf@googlemail.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","X-Authority-Analysis":"v=2.4 cv=H6rrBeYi c=1 sm=1 tr=0 ts=69f7cdcd cx=c_pps\n a=JYo30EpNSr/tUYqK9jHPoA==:117 a=asGLMfRmzhnGNxaIYohjRg==:17\n a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10\n a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22\n a=mK_AVkanAAAA:8 a=EUspDBNiAAAA:8 a=E0lYQPLoNov4gPLI4w8A:9 a=3ZKOabzyN94A:10\n a=QEXdDO2ut3YA:10 a=Fk4IpSoW4aLDllm1B1p-:22 a=3gWm3jAn84ENXaBijsEo:22","X-Proofpoint-Spam-Details-Enc":"AW1haW4tMjYwNTAzMDI1NiBTYWx0ZWRfX2lpxwXCEXTiB\n kxjW8Z5jo1SzsUhnwNh6jJGcZGwQq1ewL3HqkdUWxrrsX1Q8O3gH1HYp9YuvllEfokUOTRAwJkm\n 6n67sDNP/aUIgY1r8LN9v2QVNlGLx0uVkrrP7cBYUypMnRzo8xNw06SpcP+qvJas1M96WsKkLXo\n +YR39VHF6qCoJN8r0bER7c8MHxyhKdPOR6IHD4OT2WbPMaII/r99oVqHoOU/1NIraOeLrY3qwy+\n DH/O+UjJgPuezTZSmj7FzzXUpIEjrJ2GWb1SQZecqkc0Uu4XRv+jcj2QZHP7Ac5Lj2JtWjVUEfv\n i2Ky/GqJmDLDh+GVZUPKhPUj/FkCRvLRACgrL/DVpU+KYeZkWXQhz/TroQ8yGR83N5i2hLQ8Xk3\n 8NxE73pgMHPQ2dWT/3PETLGC0kBAUfQITRjWb3upW4vf/PmQCzwKtbfp4FGw8vtY0YNascsDftM\n s4Plg/A9glX5n+04SgA==","X-Proofpoint-GUID":"jFcm7TzerWuFWStqqh8VEj7DwfXR_2H9","X-Proofpoint-ORIG-GUID":"jFcm7TzerWuFWStqqh8VEj7DwfXR_2H9","X-Proofpoint-Virus-Version":"vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-05-03_07,2026-04-30_02,2025-10-01_01","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n lowpriorityscore=0 clxscore=1015 phishscore=0 malwarescore=0\n priorityscore=1501 suspectscore=0 bulkscore=0 impostorscore=0 adultscore=0\n spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound\n adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000\n definitions=main-2605030256","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"}}]