[PATCH] D60669: [APInt] Use __builtin_[su]mulll_overflow for [su]mul_ov if available

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 14 08:36:39 PDT 2019


nikic added inline comments.


================
Comment at: lib/Support/APInt.cpp:1912
+    return APInt(BitWidth, (uint64_t)V);
+  }
+#endif
----------------
In this form, this will only be correct if the bit-width is *exactly* 64-bit. For smaller bit-widths you'll have to consider a combination of the intrinsic overflow flag, and whether any bits beyond the bit-width are set. (It might make sense to also special-case <= 32 bits, in which case checking bits in the result of a normal multiply would be sufficient.)


Repository:
  rL LLVM

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

https://reviews.llvm.org/D60669





More information about the llvm-commits mailing list