Fix i64x2 shift on big-endian#8748
Merged
Merged
Conversation
The i64x2 shift functions use i32 for the second argument. This makes the other.i64 not always match other.type. On big-endian systems this causes tests in test/spec/testsuite/simd_bit_shift.wast and a few other places to fail. Ref WebAssembly#2983
kripken
reviewed
May 21, 2026
| return Literal(uint64_t(i64) | ||
| << Bits::getEffectiveShifts(other.i64, Type::i64)); | ||
| return Literal(uint64_t(i64) << Bits::getEffectiveShifts( | ||
| other.getInteger(), Type::i64)); |
Member
There was a problem hiding this comment.
Hmm, by the wasm validation rules, the type of other must be identical. Are you seeing a situation where it is not?
Contributor
Author
There was a problem hiding this comment.
Not with the indirect usage of Literal::shl through Literal::shlI64x2:
Lines 2264 to 2266 in 2f63efb
binaryen/src/wasm/wasm-validator.cpp
Lines 1616 to 1628 in 2f63efb
Member
There was a problem hiding this comment.
I see, thanks. I guess this makes sense - wasm semantics are more strict than our Literal APIs should allow. I was confused before.
kripken
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since the i64x2.sh* functions use i32 as shift argument the access to
other.i64may not use the correct union member. On big-endian systems this causes tests intest/spec/testsuite/simd_bit_shift.wastand a few other places to fail.Ref #2983