[PATCH] D117898: [Clang] Add elementwise saturated add/sub builtins

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 21 23:12:34 PST 2022


craig.topper added inline comments.


================
Comment at: clang/docs/LanguageExtensions.rst:549
+ T __builtin_elementwise_add_sat(T x, T y) return the sum of x and y, clamped to the range of signed or     integer types
+                                           values representable by the bit width of the arguments.
+ T __builtin_elementwise_sub_sat(T x, T y) return the difference of x and y, clamped to the range of        integer types
----------------
Not sure if I'm reading this right due to the columns, but is "unsigned" missing after the "signed or"


================
Comment at: clang/include/clang/Basic/Builtins.def:656
 BUILTIN(__builtin_elementwise_roundeven, "v.", "nct")
+BUILTIN(__builtin_elementwise_sub_sat, "v.", "nct")
 BUILTIN(__builtin_elementwise_trunc, "v.", "nct")
----------------
I don't think these are in alphabetical order. ceil is after min. Looks more like they were grouped by similar operations.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:2254
+
+   if (!EltTy->isIntegerType()) {
+      Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
----------------
clang-format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117898



More information about the cfe-commits mailing list