[PATCH] D108832: [Builtins] Support ext_vector_type args for __builtin_fminf.

Florian Hahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 27 10:12:41 PDT 2021


fhahn created this revision.
fhahn added reviewers: erichkeane, rjmccall, thegameg, anemet.
fhahn requested review of this revision.
Herald added a project: clang.

At the moment, the various math builtins only accept the scalar types
defined by libm.

This patch extends __builtin_fminf to also accept ext_vector_type
arguments that can be converted to an ext_vector_type with float as
element type.

This brings Clang more in line with GCC, which already supports math
builtins with ext_vector_type arguments.

If this direction makes sense, I am planning to also convert a few other
builtins that can be extended to vectors directly, like fmax.

In addition to vector types, it would be also good to support matrix
types as follow up I think.

I tried to make sure the same error messages are emitted for the scalar
variant of __builtin_fminf, but there's a difference for the (vector,
float) variant. I still need to dig into where this is coming from.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108832

Files:
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/overloaded-math-builtins.c
  clang/test/Sema/overloaded-math-builtins.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108832.369132.patch
Type: text/x-patch
Size: 5374 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210827/2327845e/attachment-0001.bin>


More information about the cfe-commits mailing list