[PATCH] D115429: [Clang] Implement the rest of __builtin_elementwise_* functions.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 15 04:35:35 PST 2021


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Basic/Builtins.def:651
+BUILTIN(__builtin_elementwise_floor, "v.", "nct")
+BUILTIN(__builtin_elementwise_roundeven, "v.", "nct")
+BUILTIN(__builtin_elementwise_trunc, "v.", "nct")
----------------
The RFC does not mention this builtin. It specifies `__builtin_elementwise_rint` and `__builtin_elementwise_round`. Is there a reason why this uses `roundeven` instead and should there be other rounding options provided at the same time?


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:3137-3160
   case Builtin::BI__builtin_elementwise_ceil: {
     Value *Op0 = EmitScalarExpr(E->getArg(0));
     Value *Result = Builder.CreateUnaryIntrinsic(llvm::Intrinsic::ceil, Op0,
                                                  nullptr, "elt.ceil");
     return RValue::get(Result);
   }
+  case Builtin::BI__builtin_elementwise_floor: {
----------------
It's starting to seem like we should have a helper function that takes the intrinsic to create and the name to give the operation; WDYT?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115429



More information about the cfe-commits mailing list