jameysharp commented on issue #6200:
Oooh, right. I think these rules might still be correct on vector types; I believe
icmp
returns 0 or -1 in each lane, and I thinkbitselect
is defined on vectors.On scalar types I think we could have a rule rewriting
(bitselect ty (bmask ty c) x y)
to(select ty c x y)
. That would give us a correct version of thesebitselect
rules in terms of the rules forselect
, and also be useful in its own right.
Kmeakin commented on issue #6200:
Is
bitselect
only intended for vector types? If so, we might want to constrain it to only be used on vector types
jameysharp commented on issue #6200:
Ah, I see what happened. These rules were sort of correct before we removed
vselect
in #5918. That instruction only applied to vectors, so replacing it withbitselect
was correct except that the "only vectors" constraint was lost at that point.Our current way to express that a type is any vector type is to match it against
(multi_lane _ _)
. Adding that constraint to all these rules should fix this.The
bitselect
instruction is useful on scalar values too. It's just that this particular transformation was wrong for scalars.
jameysharp commented on issue #6200:
Once this is fixed we should backport it to the
release-8.0.0
branch too. #5918 merged after 7.0.0 forked off main so we don't have to backport this fix further than that. It's nice that 8.0.0 hasn't been released yet. Thanks for spotting this bug, @Kmeakin!
Kmeakin commented on issue #6200:
Abandoned in favour of https://github.com/bytecodealliance/wasmtime/pull/6200
Kmeakin edited a comment on issue #6200:
Abandoned in favour of https://github.com/bytecodealliance/wasmtime/pull/6201
Last updated: Dec 23 2024 at 12:05 UTC