Undefined indices in shuffles can be used when not all lanes of the output vector will be used. This happens for example in the expansion of vector reduce operations. Regardless, undefs are legal as lane indices in IR and should be supported.
Details
Diff Detail
- Repository
- rL LLVM
- Build Status
Buildable 23631 Build 23630: arc lint + arc unit
Event Timeline
Could you give an example of what kind of programs would generate undefs in the IR and why we need this? And also I guess it's good to include that in the CL and the commit description.
lib/Target/WebAssembly/WebAssemblyISelLowering.cpp | ||
---|---|---|
1032 | Why -1? Is it how undef is represented? | |
lib/Target/WebAssembly/WebAssemblyInstrSIMD.td | ||
196 | Are these unnecessary sequence of masking by and also removed in non-undef cases? | |
204 | Here the same. Are these sext_inreg also removed in non-undef cases? | |
234 | Move this pattern to extract_lane category above | |
test/CodeGen/WebAssembly/simd.ll | ||
133 | i32 undef? For all other replace_undef_ functions too. |
lib/Target/WebAssembly/WebAssemblyISelLowering.cpp | ||
---|---|---|
1032 | I think MaskVal sounds confusing. It sounds like it is a mask value (such as 0xff). Can we change it to something else, like, just Val or something? |
lib/Target/WebAssembly/WebAssemblyISelLowering.cpp | ||
---|---|---|
1032 | ByteIndex seemed like a nice descriptive name. | |
1032 | Yes, that seems to be how undef is represented. | |
lib/Target/WebAssembly/WebAssemblyInstrSIMD.td | ||
196 | Yes, see multiclass ExtractLaneExtended, which uses the corresponding patterns in multiclass ExtractPat. | |
204 | Yes, same as above. |
LGTM with a nit.
lib/Target/WebAssembly/WebAssemblyISelLowering.cpp | ||
---|---|---|
1032 | Then one-line comment stating that here -1 means undef would be helpful I think. |
Why -1? Is it how undef is represented?