Hi Kito, Update the PATCH v6 with refactored framework as below, thanks for comments.
https://gcc.gnu.org/pipermail/gcc-patches/2023-May/619536.html Pan -----Original Message----- From: Gcc-patches <gcc-patches-bounces+pan2.li=intel....@gcc.gnu.org> On Behalf Of Kito Cheng via Gcc-patches Sent: Wednesday, May 17, 2023 11:52 AM To: juzhe.zh...@rivai.ai Cc: gcc-patches <gcc-patches@gcc.gnu.org>; palmer <pal...@dabbelt.com>; jeffreyalaw <jeffreya...@gmail.com> Subject: Re: Re: [PATCH V5] RISC-V: Using merge approach to optimize repeating sequence in vec_init On Wed, May 17, 2023 at 11:36 AM juzhe.zh...@rivai.ai <juzhe.zh...@rivai.ai> wrote: > > >> Does it means we assume inner_int_mode is DImode? (because sizeof > >> (uint64_t)) or it should be something like `for (unsigned int i = > >> 0; i < (GET_MODE_SIZE(inner_int_mode ()) * 8 / npatterns ()); i++)` ? > No, sizeof (uint64_t) means uint64_t mask = 0; + return gen_int_mode (mask, inner_int_mode ()); And we expect the uint64_t mask can always be put into inner_int_mode ()? If not, why do we fill up all 64 bits? > > >> Do you mind give more comment about this? what it checked and what it did? > The reason we use known_gt (GET_MODE_SIZE (dup_mode), > BYTES_PER_RISCV_VECTOR) since we want are using vector integer mode to > generate the mask for example we generate 0b01010101010101.... mask, we > should use a scalar register holding value = 0b010101010... > Then vmv.v.x into a vector,then this vector will be used as a mask. > > >> Why this only hide in else? I guess I have this question is because > >> I don't fully understand the logic of the if condition? > > Since we can't vector floting-point instruction to generate a mask. I don't get why it's not something like below? if (known_gt (GET_MODE_SIZE (dup_mode), BYTES_PER_RISCV_VECTOR)) { ... } if (FLOAT_MODE_P (dup_mode)) { ... } > > >> nit: builder.inner_mode () rather than GET_MODE_INNER (dup_mode)? > > They are the same. I can change it using GET_MODE_INNER > > >> And I would like have more commnet to explain why we need force_reg here. > Since it will creat ICE. But why? And why can it be resolved by force_reg? you need few more comment in the code