This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] vNxM.load_splat instructions
ClosedPublic

Authored by tlively on Sep 19 2019, 6:44 PM.

Details

Summary

Adds the new load_splat instructions as specified at
https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#load-and-splat.

DAGISel does not allow matching multiple copies of the same load in a
single pattern, so we use a new node in WebAssemblyISD to wrap loads
that should be splatted.

Depends on D67783.

Diff Detail

Repository
rL LLVM

Event Timeline

tlively created this revision.Sep 19 2019, 6:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2019, 6:44 PM
tlively updated this revision to Diff 221072.Sep 20 2019, 10:59 AM
  • Add encoding tests
aheejin accepted this revision.Sep 23 2019, 8:31 AM

Mostly LGTM. By the way this contains diff of D67783 as well.

llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
62 ↗(On Diff #221072)

I asked the same question in D67783, but why do we not need SIMD128? Other parts below too

75 ↗(On Diff #221072)

Don't we need SDTCisPtrTy<0>?

78 ↗(On Diff #221072)

Do we only do zero extension for splats?

83 ↗(On Diff #221072)

Didn't know we can use foreach like this :D

This revision is now accepted and ready to land.Sep 23 2019, 8:31 AM
tlively marked 3 inline comments as done.Sep 23 2019, 1:33 PM
tlively added inline comments.
llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
62 ↗(On Diff #221072)

HasUnimplementedSIMD128 implies HasSIMD128, so having both is redundant.

75 ↗(On Diff #221072)

No, the argument to wasm_load_splat is actually the result of the original load, so it is not necessarily an i32. It could also be an i64, f32, or f64. The type checking of the pointer is handled by the extloadi8, extloadi16, and load nodes.

78 ↗(On Diff #221072)

We do undefined extension for splats, since the high bits are never observed. Only the original bits end up in the splatted vector.

This revision was automatically updated to reflect the committed changes.