[llvm] [RISCV] Construct constants via instructions if materialization is costly (PR #86926)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 28 21:03:06 PDT 2024


topperc wrote:

> > For the vector case, I think it ends up cheaper if you always start by bitcasting the operand to an i8 vector, and doing an i8 popcount. That makes the constants involved significantly cheaper. (The width you use to do the arithmetic doesn't matter for correctness, but doing it in i8 means you need fewer vsetvli, I think). Then you can bitcast back to the wider type to do the multiply/shift.
> 
> I don't know if this is benefical. Using smaller EEW means that we can simplify the materialization but we may execute more uops I think, which may result in worse performance.

Hopefully simple bitwise operations like shifts, ands, and adds don't get split based on element width.

https://github.com/llvm/llvm-project/pull/86926


More information about the llvm-commits mailing list