From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by sourceware.org (Postfix) with ESMTPS id 742053858298 for ; Sun, 25 Jun 2023 12:52:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 742053858298 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-qk1-x729.google.com with SMTP id af79cd13be357-7659924cd9bso40361985a.1 for ; Sun, 25 Jun 2023 05:52:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687697558; x=1690289558; 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=ucVmjAwCbYBQwd6y1Rd+BzEHVNCPO2Ratam/tmfJWgo=; b=VrqLrNKd2qaaclGY372SAdYdYwwVFK/YnfTD5FKmgrob8/Il2D8Mk0KlTOlxU+OW4c LcqF8Yr+sAyNK6lsEu3Mdt6ECM15dsgXmuPetM78faQubtjqNIUYQAlWkmxIulsT8Ikg h4bBAeO6SpR1svsKxo+DwTff/wOc0dPmvAmGuV2wT3b9yjUO/ck6hCfCAwq3qGro70Ni HtfJGyBodOuFdFOCFeVJW+PgI2f3b0lylWMNKXD3P4TwOlVZ5NCHEEiiouv6VsK+XI9C 8kqXdeHIzxl/9I38CEWiziSVyxw/glyZFHhr80sBGjQlCjmrZ2g4NIfppYS5OkzexhOP rHCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687697558; x=1690289558; 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=ucVmjAwCbYBQwd6y1Rd+BzEHVNCPO2Ratam/tmfJWgo=; b=KEd+E2QLtEGRNVgJrSJ+1OT4V7dtanKjmkIeqSuf1NYenRi7Z4mfkM6m83GZp2iFAg XkR5WLiq69TIzg6jg4klHViR2Ow+TCKUG34rRbG5i5Av8M9qkITGlG3VH66knBzYEHGx Dd0Ogl6LWdXwQUx32QtL3DVugXeZY+XnSGHbq6InOwRLl6JqM4M+Wj7uuOaFZZO/Ofnh uldukrtTNKKQWDcfD1qySEml48Wc8VAFHwwtC9WlTDxLGNVzWLPitrBj8fN2rBzUOVP+ IEa6DD/paqQ8WT9Jdmy+UUep8B1fnTyocKdKAej/ZGO8NvdHUTdUuyafCDRmNnopIuds vgug== X-Gm-Message-State: AC+VfDyDDAh8fh2fCAHJlJt31SU6iqlMijUSLSiO865NwhOi2JtFqwEn yUPienRJklbDtqJs26X/au4= X-Google-Smtp-Source: ACHHUZ6LXwUNdL5pOK0NRROfObENsywKMunFk4ZBYygcsjxKaEQzs669WY4rsHj+Rknn9nxMzBL+xA== X-Received: by 2002:a05:620a:2405:b0:765:3eb9:fd43 with SMTP id d5-20020a05620a240500b007653eb9fd43mr11274503qkn.76.1687697558563; Sun, 25 Jun 2023 05:52:38 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id n7-20020a6543c7000000b0053fb37fb626sm2168969pgp.43.2023.06.25.05.52.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 25 Jun 2023 05:52:38 -0700 (PDT) Message-ID: Date: Sun, 25 Jun 2023 06:52:35 -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 V2] RISC-V: Enable len_mask{load, store} and remove len_{load, store} Content-Language: en-US To: Juzhe-Zhong , gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, kito.cheng@sifive.com, palmer@dabbelt.com, palmer@rivosinc.com, rdapp.gcc@gmail.com References: <20230625083952.9771-1-juzhe.zhong@rivai.ai> From: Jeff Law In-Reply-To: <20230625083952.9771-1-juzhe.zhong@rivai.ai> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.4 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,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 6/25/23 02:39, Juzhe-Zhong wrote: > This patch enable len_mask_{load,store} to support flow-control in RVV auto-vectorization. > > Consider this following case: > void > f (int32_t *__restrict a, > int32_t *__restrict b, > int32_t *__restrict cond, > int n) > { > for (int i = 0; i < n; i++) > if (cond[i]) > a[i] = b[i]; > } > > Before this patch: > :9:21: missed: couldn't vectorize loop > :9:21: missed: not vectorized: control flow in loop. > > After this patch: > f: > ble a3,zero,.L5 > .L3: > vsetvli a5,a3,e32,m1,ta,ma > vle32.v v0,0(a2) > vsetvli a6,zero,e32,m1,ta,ma > slli a4,a5,2 > vmsne.vi v0,v0,0 > sub a3,a3,a5 > vsetvli zero,a5,e32,m1,ta,ma > vle32.v v1,0(a1),v0.t > vse32.v v1,0(a0),v0.t > add a2,a2,a4 > add a1,a1,a4 > add a0,a0,a4 > bne a3,zero,.L3 > .L5: > ret > > > gcc/ChangeLog: > > * config/riscv/autovec.md (len_load_): Remove. > (len_maskload): Remove. > (len_store_): New pattern. > (len_maskstore): New pattern. > * config/riscv/predicates.md (autovec_length_operand): New predicate. > * config/riscv/riscv-protos.h (enum insn_type): New enum. > (expand_load_store): New function. > * config/riscv/riscv-v.cc (emit_vlmax_masked_insn): Ditto. > (emit_nonvlmax_masked_insn): Ditto. > (expand_load_store): Ditto. > * config/riscv/riscv-vector-builtins.cc (function_expander::use_contiguous_store_insn): Add avl_type operand into pred_store. > * config/riscv/vector.md: Ditto. OK jeff