From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id C41473858D35 for ; Thu, 22 Jun 2023 16:06:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C41473858D35 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-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3129c55e1d1so916299f8f.0 for ; Thu, 22 Jun 2023 09:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687449967; x=1690041967; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=MtmN+yZOC6OtIF1H94zMQt9Jc9ULprjNiac+Kcmgb4M=; b=SyWv5yG1Un628AMtCaP9DTP3GbAANT8ugoMQnfAZSkd6OmFPT2zijwGJGWdH36Tg15 1NU3ftBrgtUnQXgr3w2G0BVCINxgAyYwAd+yMWTpBxOREWDSSoIT3lKvN/mB9x/xoo9c vfyTvwEUSS8YQEUP5NL4Qc01T3GsOaCFf3ZmnRisWSa4qNvUpn5a3h1AsGEVI5a/Z9Ns mvUqsJN2y0RjmxsA/u0L2dDYiRX7T8y7aP1dYS0Y602vQHEtPYondAp2kb6OIUS+OcrY ltjTlbFcXftLtrrq672FWum77LXVYcBIdkccBeH3plDfJadHT2w5gzyNLPug7HdOYxBL fncA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687449967; x=1690041967; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MtmN+yZOC6OtIF1H94zMQt9Jc9ULprjNiac+Kcmgb4M=; b=dRyCYyGSOilfv95RCKR6TrMUWnS+nyvGX/rbisI56bG6p3SnJSOxmamhRSQ1tC+o+r 0UrBim94CAZFF38dF7UblvItlOyDDJC9Yg6MZQyF940JyOu8tOHso9eucGoVIwJQfBPr 9uTDu/x0WVL+xNntvHSiozaXPktAPHwr5Tn1rARjcQIkjsqlL5layxC/XmHqzXkdAf++ br9TkvnDDfuJMuK6F5+ZDCE3SLneV5YJN8DNM2Hu/bxmWYApGy/7OJ3CanAwr7E5lrrx p+AAGwhr84uvF6jOafq1lDSIEWT4TDDrdH0p1LYdCJqUD9bEDSx6nQxbFVWdc482fV9U Av2Q== X-Gm-Message-State: AC+VfDwr/N4AFlXvTlcrYFeR9rls68e9oGn8qZ6fgD2X8frxI9oAXnG4 AJs+tBXoN1Qum1eQvbEN3AY= X-Google-Smtp-Source: ACHHUZ66bUwOLYDjA5mAPQQFRrfWrhP7SOkXsalPXfuLnTJean82sBtxKoUqKQcQOlP9aSCQz6bFMA== X-Received: by 2002:a5d:6084:0:b0:312:74a9:8263 with SMTP id w4-20020a5d6084000000b0031274a98263mr8510195wrt.44.1687449966675; Thu, 22 Jun 2023 09:06:06 -0700 (PDT) Received: from nbbrfq.loc (80-110-214-113.static.upcbusiness.at. [80.110.214.113]) by smtp.gmail.com with ESMTPSA id v11-20020a7bcb4b000000b003f8d6647661sm19090832wmj.15.2023.06.22.09.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 09:06:06 -0700 (PDT) Date: Thu, 22 Jun 2023 18:05:51 +0200 From: Bernhard Reutner-Fischer To: juzhe.zhong@rivai.ai Cc: rep.dot.nop@gmail.com, gcc-patches@gcc.gnu.org, rguenther@suse.de, richard.sandiford@arm.com Subject: Re: [PATCH V5] VECT: Apply LEN_MASK_{LOAD,STORE} into vectorizer Message-ID: <20230622180551.2bc62c61@nbbrfq.loc> In-Reply-To: <20230622135348.160496-1-juzhe.zhong@rivai.ai> References: <20230622135348.160496-1-juzhe.zhong@rivai.ai> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 Thu, 22 Jun 2023 21:53:48 +0800 juzhe.zhong@rivai.ai wrote: > +static bool > +target_supports_mask_load_store_p (machine_mode mode, machine_mode mask_mode, > + bool is_load, internal_fn *ifn) > +{ > + optab op = is_load ? maskload_optab : maskstore_optab; > + optab len_op = is_load ? len_maskload_optab : len_maskstore_optab; > + if (convert_optab_handler (op, mode, mask_mode) != CODE_FOR_nothing) > + { > + if (ifn) > + *ifn = is_load ? IFN_MASK_LOAD : IFN_MASK_STORE; > + return true; > + } > + else if (convert_optab_handler (len_op, mode, mask_mode) != CODE_FOR_nothing) > + { > + *ifn = is_load ? IFN_LEN_MASK_LOAD : IFN_LEN_MASK_STORE; It feels inconsistent that you do not check ifn here. > + return true; > + } > + return false; > +} > +/* Return true if the target has support for len load/store. > + We can support len load/store by either len_{load,store} > + or len_mask{load,store}. > + This helper function checks whether target supports len > + load/store and return corresponding IFN in the last argument > + (IFN_LEN_{LOAD,STORE} or IFN_LEN_MASK_{LOAD,STORE}). */ > + > +static bool > +target_supports_len_load_store_p (machine_mode mode, bool is_load, > + internal_fn *ifn) > +{ > + optab op = is_load ? len_load_optab : len_store_optab; > + optab masked_op = is_load ? len_maskload_optab : len_maskstore_optab; > + > + if (direct_optab_handler (op, mode)) > + { > + if (ifn) > + *ifn = is_load ? IFN_LEN_LOAD : IFN_LEN_STORE; > + return true; > + } > + machine_mode mask_mode; > + if (targetm.vectorize.get_mask_mode (mode).exists (&mask_mode) > + && convert_optab_handler (masked_op, mode, mask_mode) != CODE_FOR_nothing) > + { > + if (ifn) > + *ifn = is_load ? IFN_LEN_MASK_LOAD : IFN_LEN_MASK_STORE; > + return true; > + } > + return false; > +} > + > /* If target supports vector load/store with length for vector mode MODE, > return the corresponding vector mode, otherwise return opt_machine_mode (). > There are two flavors for vector load/store with length, one is to measure > length with bytes, the other is to measure length with lanes. > As len_{load,store} optabs point out, for the flavor with bytes, we use > - VnQI to wrap the other supportable same size vector modes. */ > + VnQI to wrap the other supportable same size vector modes. > + An additional output in the last argumennt which is the IFN pointer. > + We set IFN as LEN_{LOAD,STORE} or LEN_MASK_{LOAD,STORE} according > + which optab is supported in the targe. */ s/argumennt/argument/ s/targe\./target./ thanks,