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 0E2E83858C1F for ; Fri, 11 Aug 2023 15:04:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0E2E83858C1F 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-1bbff6b2679so15392865ad.1 for ; Fri, 11 Aug 2023 08:04:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691766271; x=1692371071; 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=+ZeYOJybamSeM0ra9WOkyK/Mywn5pVaILJ72h5ONVDI=; b=Yvprr9iiKqZ9p/uImjWLyDw3JHyGInckV8PdYZxvyo1cLEh8EDemN6tBtBlA0H6b6n jktpYYDecEn+2QOLcCnz1nzk/T8oiP/HGOGDXkNKkWQtvDRrHsoyYhO3RsCNj48fUDcN kZhlIX8VB26Az7s5KBc9JvpRCgD1VFXVA/fIuDkgUrPHglnbNxe7II2ZfyGAqs2OHS9K NQMFPHXLe/CmnIK/TbnKRPmNE3bJel9OM4PYVUn+jwdtEOBzbXfs/OHyxNqeGTpnkfGG ojsSwN2lb2prhUU+raxK7sNNiA82V7WH2G+EafMU0AnWaodSVdgfXydR8VMSJiHYmXM5 vO7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691766271; x=1692371071; 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=+ZeYOJybamSeM0ra9WOkyK/Mywn5pVaILJ72h5ONVDI=; b=WcDnmxG9rhB0+HosEOe7a54MzlfKRo/fs0KyQ4A+foMhaC0p5zsn4BkEgbYu8gwFvI l1NDcCo+XbnBrp2ZMQYbUcrfFMVNV0h9VOBmENH5ebvq/78iJwwUYiS2brTTLcavbYiI e+nvu3UKpaRi+QQ8zPzGbRb5IadDg5Y+h7Ti7qI2SVUXjV3gJ7XgwukkCstVGXirjQ8Q 9mljX4ANq8LO3Vg9XcOFnUBdVnNRc4kGgJGHYP0Xoy/FhRt5kdtcpV2Jzg0PQhb7wWEY DH3OQ6kAuxacSNzeOjDNRN9wmMCBBDiXJ1mFX2p4brBWIYCOSyA2AHat5edl7mk1x5a9 O/9A== X-Gm-Message-State: AOJu0Yzh4nl65CuhkViRyqF8zq2ZGC3RxNbijkaVtupHdlUzGQ8BGqYW nbYjY2MAzddl6AT+R/cTOdc= X-Google-Smtp-Source: AGHT+IHgFD8RK6EpnvoKoa25psgENhmb3BvjIbAQVnABDLu10BN1GIX/Gnh4qiCicxalzvcWoH3qkw== X-Received: by 2002:a17:903:481:b0:1b9:e937:9763 with SMTP id jj1-20020a170903048100b001b9e9379763mr1792107plb.12.1691766270854; Fri, 11 Aug 2023 08:04:30 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id a2-20020a170902ecc200b0019ee045a2b3sm4043254plh.308.2023.08.11.08.04.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Aug 2023 08:04:29 -0700 (PDT) Message-ID: Date: Fri, 11 Aug 2023 09:04:28 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] RISC-V: Revert the convert from vmv.s.x to vmv.v.i Content-Language: en-US To: Lehua Ding , gcc-patches@gcc.gnu.org Cc: juzhe.zhong@rivai.ai, kito.cheng@gmail.com, rdapp.gcc@gmail.com, palmer@rivosinc.com References: <20230811090121.1789446-1-lehua.ding@rivai.ai> From: Jeff Law In-Reply-To: <20230811090121.1789446-1-lehua.ding@rivai.ai> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,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 8/11/23 03:01, Lehua Ding wrote: > Hi, > > This patch revert the convert from vmv.s.x to vmv.v.i and add new pattern > optimize the special case when the scalar operand is zero. > > Currently, the broadcast pattern where the scalar operand is a imm > will be converted to vmv.v.i from vmv.s.x and the mask operand will be > converted from 00..01 to 11..11. There are some advantages and > disadvantages before and after the conversion after discussing > with Juzhe offline and we chose not to do this transform. > > Before: > > Advantages: The vsetvli info required by vmv.s.x has better compatibility since > vmv.s.x only required SEW and VLEN be zero or one. That mean there > is more opportunities to combine with other vsetlv infos in vsetvl pass. > > Disadvantages: For non-zero scalar imm, one more `li rd, imm` instruction > will be needed. > > After: > > Advantages: No need `li rd, imm` instruction since vmv.v.i support imm operand. > > Disadvantages: Like before's advantages. Worse compatibility leads to more > vsetvl instrunctions need. I can't speak for other uarches, but as a guiding principle for Ventana we're assuming vsetvl instructions are common and as a result need to be very cheap in hardware. It's likely a good tradeoff for us. I could see other uarches making different design choices though. So at a high level, do we want this to be driven by cost modeling in some way? Not a review yet. Wanted to get that feedback to you now since the rest of my day is going to be fairly busy. jeff