From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x933.google.com (mail-ua1-x933.google.com [IPv6:2607:f8b0:4864:20::933]) by sourceware.org (Postfix) with ESMTPS id 722C4385558B for ; Fri, 12 May 2023 15:20:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 722C4385558B 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-ua1-x933.google.com with SMTP id a1e0cc1a2514c-77d53b41485so2723025241.3 for ; Fri, 12 May 2023 08:20:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683904810; x=1686496810; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=A/RWSQiFIKwapqWFxGhwt++Jg2XUJ8uZnxCt0w1d72Y=; b=kFhUPr6gluLdkLha+WJhA+zt+Z13WLNgXFR1+k83dcp4725SwIJ9D9relPDZYQc4Kp aisC2Fn87Zg4dlvq99E+88NM6Tcr5wqXsroGAM7ua8crLIAPZ0oNLXPfJJlBJExyWRjz PiMitSYZXi2w22NJA2XRq04DcZKIt9VzjAnu0hnuIiwYNqHM9sR5S4m1S6YZsHC++YWD wehduefrGvpIPnB1s06OxS/NXTBYYs+LNFB6m8imA3dMj8bSJ+qxkgNyXmQpjz1S6H85 BZAHXLdwmbYbV9Vanc692edGgg54cqz7MGBghdYjmjxlTjHFayS9tKnSL3RkIjFCNasw tGqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683904810; x=1686496810; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=A/RWSQiFIKwapqWFxGhwt++Jg2XUJ8uZnxCt0w1d72Y=; b=DEnnD/5l7xxtzicHPeyZTxF5W6duMMzhJ9hKZ2GcfA0z9xXnz2WHgQE8iGd1Kn9clW 9b/NUuMRNJVyZjjWUzqMQEwprAfhapP6WTW+/B/2qAMBvKwtZQw5BgcSAZJzzdnLo1Nm 5/fi7B/NvBWwOPWNoYgEtxbLDyB4iQM1fWaaSZ+z9/BrQhGbfiGOiKPIdSDkYTs8I0Py +V8K3eZMQ4Eg0P+JhG2PMwRKN1IPC8O3lfNb4CD78wHIwizoeYG2RddzesZTyRkOUrYL V34H+744A9gG7UR3lkgcslh7QkBwBVfkqf5Q5th+k2HSGvukHs+NLT9t7kh/aGPkDGcI EzBA== X-Gm-Message-State: AC+VfDx6r+saWzGA9KvoCsUfGndUpEThRMcCWGbmAy7ZvLTH/gO2imdR 56cQxH2H4+FTYOqEzmIiZWkeTWlCkpL0dTBsR0A= X-Google-Smtp-Source: ACHHUZ6BO2+PTG/SWiApFOobeSKeU7v1cQs9yNEzACQpybA/heUYDnQnFhd2EUvyT5mBiP04umLJGXVVpQOToUVxpfg= X-Received: by 2002:a05:6102:384:b0:430:61bd:283 with SMTP id m4-20020a056102038400b0043061bd0283mr8704150vsq.11.1683904809513; Fri, 12 May 2023 08:20:09 -0700 (PDT) MIME-Version: 1.0 References: <20230512145940.587528-1-juzhe.zhong@rivai.ai> In-Reply-To: <20230512145940.587528-1-juzhe.zhong@rivai.ai> From: Kito Cheng Date: Fri, 12 May 2023 23:19:58 +0800 Message-ID: Subject: Re: [PATCH V2] RISC-V: Using merge approach to optimize repeating sequence in vec_init To: juzhe.zhong@rivai.ai Cc: gcc-patches@gcc.gnu.org, palmer@dabbelt.com, rdapp.gcc@gmail.com, jeffreyalaw@gmail.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.9 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: two minor comments: > + void add_ta_policy_operand (enum tail_policy vta) > + void add_ma_policy_operand (enum mask_policy vma) You could just named as add_policy_operand since the arugment type is already sufficient to distinguish. > @@ -84,40 +92,52 @@ public: > add_input_operand (gen_int_mode (type, Pmode), Pmode); > } > > - void set_dest_and_mask (rtx mask, rtx dest, machine_mode mask_mode) > + void set_dest_and_mask (rtx mask, rtx dest, machine_mode mask_mode, > + bool scalar_move = false, bool merge_op = false) > { > dest_mode = GET_MODE (dest); > has_dest = true; > > add_output_operand (dest, dest_mode); > > - if (mask) > - add_input_operand (mask, GET_MODE (mask)); > - else > - add_all_one_mask_operand (mask_mode); > + if (!merge_op) > + { > + if (mask) > + add_input_operand (mask, GET_MODE (mask)); > + else > + { > + if (scalar_move) > + add_scalar_move_mask_operand (mask_mode); > + else > + add_all_one_mask_operand (mask_mode); > + } > + } I would like to have set_dest_and_mask_merge_op to reduce the complexity of set_dest_and_mask. Accroding the code I got is: - mask and merge_op are mutual exclusion. - scalar_move will become meanless if merge_op is true. So I think they mixed those togeter is not good idea.