And also I have investigate LLVM cost model. They don't cost vsevli in vectorization cost model. But their cost model does a good job...
juzhe.zh...@rivai.ai From: Robin Dapp Date: 2024-01-11 18:09 To: Richard Biener CC: rdapp.gcc; juzhe.zh...@rivai.ai; gcc-patches; kito.cheng; Kito.cheng; jeffreyalaw Subject: Re: [PATCH] RISC-V: Increase scalar_to_vec_cost from 1 to 3 >> The slidedown/vmv.x.s part is of course vec_extract but we indeed >> don't seem to cost it as vec_to_scalar here. > > It looks like a vectorized live operation as it's not in the loop body > (and thus really irrelevant for costing in practice). This has > > /* ??? Enable for loop costing as well. */ > if (!loop_vinfo) > record_stmt_cost (cost_vec, 1, vec_to_scalar, stmt_info, NULL_TREE, > 0, vect_epilogue); > > so live ops are not costed at all. I would suggest to try unconditionally > enabling this? > IMHO this example is not really ideal to start with anyway so we should maybe try another one first. I'd still argue that one or two iterations vs. potentially 16+ scalar ones is not necessarily bad. That said, we also don't really cost all our vsetvls yet (difficult...). Regards Robin