[PATCH] D111985: [Clang] Add elementwise min/max builtins.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 26 04:56:28 PDT 2021


aaron.ballman added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:16695
+  TheCall->setArg(1, B.get());
+  TheCall->setType(TyB);
+  return false;
----------------
I think you want to set this to `Res`, because that's the common type between `TyB` and `TyA`, right? That will also ensure that qualifiers are stripped, I believe. e.g.,
```
const int a = 2;
int b = 1;
static_assert(!std::is_const_v<decltype(__builtin_elementwise_max(a, b))>);
static_assert(!std::is_const_v<decltype(__builtin_elementwise_max(b, a))>);
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111985



More information about the cfe-commits mailing list