This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Codegen for v128.loadX_lane instructions
ClosedPublic

Authored by tlively on Jul 13 2021, 5:32 PM.

Details

Summary

Replace the experimental clang builtin and LLVM intrinsics for these
instructions with normal codegen patterns. Resolves PR50433.

Diff Detail

Event Timeline

tlively created this revision.Jul 13 2021, 5:32 PM
tlively requested review of this revision.Jul 13 2021, 5:32 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 13 2021, 5:32 PM
aheejin added inline comments.Jul 14 2021, 1:39 AM
clang/lib/Headers/wasm_simd128.h
174

Nit: Other similar functions in this file seem to be using __mem instead of __ptr? (Currently only builtins are using __ptr)

llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
324

Why are i8 and i16 are extended-loaded?

llvm/test/CodeGen/WebAssembly/simd-build-vector.ll
6–7

This seems already contained in D105842? The same for the other files.

214

Why the change?

tlively updated this revision to Diff 358668.Jul 14 2021, 11:08 AM
tlively marked 2 inline comments as done.
  • Address comments
llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
324

For i8x16 and i16x8 vectors, loading a lane from memory means loading just the i8 or i16. But after selection DAG legalization, the result of those loads are legalized to be i32, making these extending loads. If this were a DAG combine rather than an ISel pattern, I would use the pre-legalization i8 and i16 with non-extending loads.

llvm/test/CodeGen/WebAssembly/simd-build-vector.ll
214

The lane for the swizzle comes from a load from the stack, so that now gets selected to v128.load8_lane rather than a load followed by a replace_lane.

aheejin accepted this revision.Jul 14 2021, 11:22 AM
This revision is now accepted and ready to land.Jul 14 2021, 11:22 AM
This revision was landed with ongoing or failed builds.Jul 14 2021, 11:32 AM
This revision was automatically updated to reflect the committed changes.