[PATCH] D155386: [WebAssembly] Select BUILD_VECTOR with large unsigned lane values
Thomas Lively via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 18 07:26:03 PDT 2023
tlively added inline comments.
================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td:53
def ImmI#SIZE : ImmLeaf<i32,
- "return -(1 << ("#SIZE#" - 1)) <= Imm && Imm < (1 << ("#SIZE#" - 1));"
+ "return -(1 << ("#SIZE#" - 1)) <= Imm && Imm < (1 << "#SIZE#");"
>;
----------------
aheejin wrote:
> Why are the negative range and the positive range different?
The signed values range from -2^(n-1) to 2^(n-1)-1 and the unsigned values range from 0 to 2^n, so the union of the ranges is -2^(n-1) to 2^n.
I realized this code will be UB and broken when SIZE is 64 because the 1 << 64 is nonsense, so I will have to fix and test that before I land this.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155386/new/
https://reviews.llvm.org/D155386
More information about the llvm-commits
mailing list