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

Florian Hahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 26 06:53:32 PDT 2021


fhahn updated this revision to Diff 382300.
fhahn marked 3 inline comments as done.
fhahn added a comment.

Address latest comments, thanks

- Added a generic `err_builtin_invalid_arg_type` diagnostic kind, which can also be used for some of the matrix type mismatches (see D112532 <https://reviews.llvm.org/D112532>).
- Dropped `err_elementwise_math_arg_types_mismatch` in favor of the existing `err_typecheck_call_different_arg_types`.
- Use `Res` to set the call type
- Add tests with _Complex, which gets rejected.
- add C++ test that check constness of builtins.



In D111985#3087057 <https://reviews.llvm.org/D111985#3087057>, @aaron.ballman wrote:

> I thought of another test case -- should these new functions work on complex types? (Those are weird enough we may want to consider adding both Sema and CodeGen tests if we do support them, and Sema tests alone if we don't.)

At the moment they should not work with complex types (like C99's _Complex). The problem there is that there is no dedicated IR type and the LLVM intrinsics do not support complex types. So at the moment we cannot lower such operations effectively.

I think it would make sense to extend them to complex types once we can better model those operations in LLVM IR.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111985

Files:
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/builtins-elementwise-math.c
  clang/test/Sema/builtins-elementwise-math.c
  clang/test/SemaCXX/builtins-elementwise-math.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111985.382300.patch
Type: text/x-patch
Size: 19450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211026/187c054e/attachment-0001.bin>


More information about the cfe-commits mailing list