Stream: cranelift

Topic: Fat pointers using i64x2


view this post on Zulip Setzer22 (May 09 2023 at 18:29):

I'm wondering what do vector types like i64x2 lower to, and whether they'd be useful to represent fat pointer types. The way I've been thinking about vector types is that they're meant to be used for SIMD operations? So I'm not sure if that'd be a good idea.

view this post on Zulip bjorn3 (May 09 2023 at 18:48):

I wouldn't recommend using them for fat pointers. Extracting and inserting lanes of a vector type requires moving between integer and vector registers, which is relatively slowly. Also doing operations on only a single part requires extracting a lane, doing the operation and inserting it into the vector again.

view this post on Zulip Setzer22 (May 09 2023 at 19:06):

Right, that's what I was thinking. If they are always lowered to use vector registers (when they're available) then they're not a good fit :sweat_smile:

view this post on Zulip bjorn3 (May 09 2023 at 19:50):

They are always lowered to vector registers. If no vector registers are available, backends will crash when you try to use them. (should probably return an error instead. we already have the Unsupported variant in CodegenError for this purpose anyway)


Last updated: Oct 23 2024 at 20:03 UTC