Stream: cranelift

Topic: ✔ `bitselect`on vector semantics


view this post on Zulip kmeakin (Apr 12 2023 at 17:34):

What are the semantics of bitselect on vectors?

view this post on Zulip kmeakin (Apr 12 2023 at 17:36):

Will an instruction like bitselect 0b10 x y result in a vector where the first lane is the first lane of x and the second lane is the second lane of y?

view this post on Zulip kmeakin (Apr 12 2023 at 17:38):

Or is the bitmask applied to each lane separately? ie the first lane would be bitselect(0b10 x[0] y[0]) and the second lane would be bitselect(0b10 x[1] y[1])?

view this post on Zulip kmeakin (Apr 12 2023 at 17:38):

What about when the bitmask is itself a vector?

view this post on Zulip Jamey Sharp (Apr 12 2023 at 17:44):

The documentation for bitselect says "For each bit in c, this instruction selects the corresponding bit from x if the bit in x is 1 and the corresponding bit from y if the bit in c is 0." I believe that applies the same to vectors as scalars, so this instruction doesn't care about lane boundaries: each bit in each lane is used to determine which input to use for the corresponding bit of the result.

view this post on Zulip Notification Bot (Apr 12 2023 at 19:07):

kmeakin has marked this topic as resolved.


Last updated: Dec 23 2024 at 12:05 UTC