alexcrichton transferred Issue #971:
As of today, there's a concept of constant pools in Cranelift, that works for SIMD 128-bits values. I'd like to extend it to work also for float32 and float64 values, to avoid the need for the bitcast, which I'm sure is pretty terrible performance-wise (and doesn't help register allocation either, since it requires one GPR register with a very short lifetime).
My current plan is the following:
- the
uimm128
immediate could be reused to store any kind of constants, since it contains anir::Constant
(handle to a vector of bytes of any size); it would be renamed toconstant
.- a new instruction
load_from_constant_pool
would be introduced, taking an inputconstant
value.- vconst right now can be inserted in the constant pool only from the parser. It'd be nice if this were done during codegen itself. We could recycle "expand_fconst" to do this and legalize vconst / f32const / f64const into a
load_from_constant_pool
with the right Constant.- we switch the encodings of vconst to work for load_from_constant_pool on the same types; and we add encodings for f32/f64.
Aligning the constant pool values would be nice to have but not required at this point; it would just be a performance fault on x86.
@abrown Does it sound reasonable to you?
Last updated: Nov 22 2024 at 17:03 UTC