The difference between v1 and v2 is the compact mask generation: v1 : +rtx +rvv_builder::compact_mask () const +{ + /* Use the container mode with SEW = 8 and LMUL = 1. */ + unsigned container_size + = MAX (CEIL (npatterns (), 8), BYTES_PER_RISCV_VECTOR.to_constant () / 8); + machine_mode container_mode + = get_vector_mode (QImode, container_size).require ();... v2: +rtx +rvv_builder::get_compact_mask () const +{ + /* If TARGET_MIN_VLEN == 32, the minimum LMUL = 1/4. + Otherwise, the minimum LMUL = 1/8. */ + unsigned min_lmul = TARGET_MIN_VLEN == 32 ? 4 : 8; + unsigned min_container_size + = BYTES_PER_RISCV_VECTOR.to_constant () / min_lmul; + unsigned container_size = MAX (CEIL (npatterns (), 8), min_container_size); + machine_mode container_mode + = get_vector_mode (QImode, container_size).require ();... The difference is that v1: unsigned container_size = MAX (CEIL (npatterns (), 8), BYTES_PER_RISCV_VECTOR.to_constant () / 8); v2: + /* If TARGET_MIN_VLEN == 32, the minimum LMUL = 1/4. + Otherwise, the minimum LMUL = 1/8. */ + unsigned min_lmul = TARGET_MIN_VLEN == 32 ? 4 : 8; + unsigned min_container_size + = BYTES_PER_RISCV_VECTOR.to_constant () / min_lmul; + unsigned container_size = MAX (CEIL (npatterns (), 8), min_container_size); juzhe.zhong@rivai.ai From: Kito Cheng Date: 2023-06-28 14:01 To: Jeff Law CC: juzhe.zhong@rivai.ai; gcc-patches; kito.cheng; palmer; palmer; Robin Dapp Subject: Re: [PATCH V2] RISC-V: Fix bug of pre-calculated const vector mask I mean the difference between v1 and v2 patch On Wed, Jun 28, 2023 at 12:09 PM Jeff Law wrote: > > > > On 6/27/23 21:16, Kito Cheng wrote: > > Do you mind giving some comments about what the difference between the > > two versions? > And I'd like a before/after assembly code with the example in the commit > message. I didn't see the same behavior when I tried it earlier today > and ran out of time to dig into it further. > > Juzhe -- most folks wait ~1wk to ping patches, even codegen bugfixes. > Pinging this fast runs the risk of irritating others. Please be patient. > > Jeff