[PATCH] D88591: [WebAssembly] Emulate v128.const efficiently

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 2 00:20:20 PDT 2020


tlively added inline comments.


================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:1601
+        auto *Const = cast<ConstantSDNode>(Lane.getNode());
+        uint64_t Val = byte_swap(Const->getLimitedValue(), little);
+        uint8_t *ValPtr = reinterpret_cast<uint8_t *>(&Val);
----------------
aheejin wrote:
> tlively wrote:
> > aheejin wrote:
> > > What does `getLimitedValue` do and why is it necessary?
> > It gets the constant value, capping it so that it fits in a `uint64_t`. It's similar to `getZExtValue`, but doesn't assert if the value happens to be too large to fit in a uint64_t for some reason.
> Given that our biggest lane is 64 bits, do we need this then? (I'm not against using this as a safe measure or anything; I'm just trying to understand what this function does)
No, I think we could have just as well used getZExtVal, but I don't think that's any clearer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88591



More information about the llvm-commits mailing list