From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 52B023858D35 for ; Wed, 26 Jul 2023 17:53:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 52B023858D35 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-pl1-x62f.google.com with SMTP id d9443c01a7336-1bb893e6365so229815ad.2 for ; Wed, 26 Jul 2023 10:53:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690394024; x=1690998824; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=WmigNq2crd050ifPFL8LmFQ8c+IClAfGIXPCqUM6Cgo=; b=XXxnftt0BkTEMC0IqReCOpTag07tsGY7THlr5eM+JVigi9ZTt62eMwpLm8mUiSbGAd GHejjv5rmBQnpjm3s7xO5h+HwEss0LYjG9RmMn17Ft67QcIwoe81cTbFW+o2wm4gnM3f n/w6RXFKo37+Akm4gkKYa9L440WgWnfenhOxAm4mabJO0KSR+fjuKLE3qwmGuP+XjJv9 Nt2IlMz27ueYo+Y7yCFTMmJKm3v6iSNrlSx/WcNFUgEpR/lwjQKXc6ZRpcxOcjZ/O0zm Aqe0GNHSrR8utFsjdnvhJ/Y6wu8WJgPlB6IB5/y1DC5njhq1SS5PZfIgf39+Pwz40Gcn ATxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690394024; x=1690998824; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WmigNq2crd050ifPFL8LmFQ8c+IClAfGIXPCqUM6Cgo=; b=bWxtBn17cgatZEltxugV9NoSe+83vHGgBB09jT5Nioo+0O0zKR/jyCYri2W/hW/HOp yx2Su+nwXFg57FMURCavL440jfbGjrwl8jU1kgGOQ22rFTPKErHByxD9ERfimNjvUrMP B1x1KbYVJEJt+Bq/Bf+F6TsKbtX2QeH3POviaq1YCD+4mAuM1hcMlzvrZp+pXUWbdIpI rUjeUh17thI52JbmHHHm6hI56zBtRE0dWKwer1G2pMnNlcOg4KYYf0p0ohq4pKn/VCwV d2QE0zrX4E0te6QNdAoiZc0f/j7fNaiOtPwqb8erpfNzj9RCd7HxxEmZ+9NtL+VU1mLJ gGow== X-Gm-Message-State: ABy/qLYgntLrTDs5C40nn0/VVmkNFnSTZ6au+a4i1vdSxYZptzU3w0L9 d2MQhCLKVPD6Gu4MEaXnrik= X-Google-Smtp-Source: APBJJlGZ4RdNVUhQ65G4AbAr/wUjTi0yPa63lhYwr3Rj+jQ3rsj5EzMmxRN63uif9NYZIhMucWWpNQ== X-Received: by 2002:a17:902:c1d4:b0:1bb:98e8:5db2 with SMTP id c20-20020a170902c1d400b001bb98e85db2mr2178211plc.26.1690394024101; Wed, 26 Jul 2023 10:53:44 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id 12-20020a170902c10c00b001bb7b0a0372sm9782476pli.290.2023.07.26.10.53.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Jul 2023 10:53:43 -0700 (PDT) Message-ID: Date: Wed, 26 Jul 2023 11:53:42 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH 2/5] [RISC-V] Generate Zicond instruction for basic semantics Content-Language: en-US To: Xiao Zeng , gcc-patches@gcc.gnu.org Cc: research_trasio@irq.a4lg.com, kito.cheng@gmail.com, zhengyu@eswincomputing.com, eri-sw-toolchain@eswincomputing.com References: <20230719101156.21771-1-zengxiao@eswincomputing.com> <20230719101156.21771-3-zengxiao@eswincomputing.com> From: Jeff Law In-Reply-To: <20230719101156.21771-3-zengxiao@eswincomputing.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,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 7/19/23 04:11, Xiao Zeng wrote: > This patch completes the recognition of the basic semantics > defined in the spec, namely: > > Conditional zero, if condition is equal to zero > rd = (rs2 == 0) ? 0 : rs1 > Conditional zero, if condition is non zero > rd = (rs2 != 0) ? 0 : rs1 > > gcc/ChangeLog: > > * config/riscv/riscv.md: Include zicond.md > * config/riscv/zicond.md: New file. > > gcc/testsuite/ChangeLog: > > * gcc.target/riscv/zicond-primitiveSemantics.c: New test. So I played with this a bit today. I originally thought that using match_dup was the right way to go for those 4 secondary patterns. But after further pondering it's not ideal. match_dup will require pointer equality within the RTL structure. That could inhibit detection in two cases. First, SUBREGs. SUBREGs are not shared. So we'd never match if we had a SUBREG expression. Second, post register allocation we can have the same looking RTX, but it may not be pointer equal. The SUBREG issue also means that we don't want to use a REGNO (x) == REGNO (y) style check because those macros are only valid on REG expressions. We could strip the SUBREG, but that's usually awkward to do in a pattern's condition. The net result is we probably should use rtx_equal_p which I was hoping to avoid. I'm testing with that change to the 4 secondary patterns right now. Assuming that passes (and I have no reason to think it won't) then I'll go ahead and commit #1 and #2 from this series which is all I have time for today. Jeff