[PATCH] D111986: [Clang] Add elementwise abs builtin.

Florian Hahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 19 02:33:30 PDT 2021


fhahn marked 2 inline comments as done.
fhahn added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:3109
+      Result = Builder.CreateBinaryIntrinsic(
+          llvm::Intrinsic::abs, Op0, Builder.getFalse(), nullptr, "elt.abs");
+    else
----------------
craig.topper wrote:
> craig.topper wrote:
> > Did we discuss that this is different than __builtin_abs which is undefined for INT_MIN?
> I don't think we add nsw to vector signed integer subtract, so I guess using false here is consistent.
> Did we discuss that this is different than __builtin_abs which is undefined for INT_MIN?

So far it was not explicitly called out in the definition. I think we should explicitly make it undefined, so I updated the spec in D111529 and passed `true` here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111986



More information about the cfe-commits mailing list