[PATCH] D93660: [WebAssembly][NFC] Refactor SIMD load/store tablegen defs

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 22 02:55:20 PST 2020


aheejin added a comment.

Thanks for the info!



================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td:57-58
+  let lane_idx = LaneIdx16;
+  let prefix = "i8x16";
+  let vprefix = "v8x16";
+}
----------------
tlively wrote:
> aheejin wrote:
> > Do we need to separately maintain 4 different fields with the same info:
> > `I8x16` (in def), `vt` (`v16i8`), `prefix` (`i8x16`), and `vprefix` (`v8x16`)
> > Maybe it can be hard to unify all of these, but can we merge some?
> Unfortunately we need all of these as far as I can see:
> 
>  - The record name (`I8x16`) needs to be distinct from the name of anything else we might need to reference.
>  - We need the `vt`; it is probably the most commonly used member.
>  - `prefix` and `vprefix` appear in instruction names, so we need them, too.
> 
> In principle we could possibly construct some of these members from other members using string manipulations and `!cast`. But unless we want to write the code for that at every use site, we would need to store the results somewhere so they can be reused. It's simplest to just store them as fields on the `Vec` in the first place.
> 
> 
Yeah I think using things like `!cast`s are cumbersome and not really worth it. But I couldn't find any uses of strings in the form of `v8x16` (`vprefix` here) in either of these:
- https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md
- https://webassembly.github.io/simd/core/syntax/instructions.html

All of them seem to use `i8x16` form. But looking at our LLVM tests we seem to be using both. For example, our tests contain `v8x16.shuffle`, but the SIMD docs have `i8x16.shuffle`. I'm not sure why we use different forms, but maybe we can merge `prefix` and `vprefix`??


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93660/new/

https://reviews.llvm.org/D93660



More information about the llvm-commits mailing list