[PATCH] D140489: Add builtin_elementwise_log

Joshua Batista via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 21 11:20:58 PST 2022


bob80905 created this revision.
bob80905 added reviewers: python3kgae, beanz.
Herald added a subscriber: Anastasia.
Herald added a project: All.
bob80905 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Add codegen for llvm log elementwise builtin
The log elementwise builtin is necessary for HLSL codegen.
Tests were added to make sure that the expected errors are encountered when these functions are given inputs of incompatible types.
The new builtin is restricted to floating point types only.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140489

Files:
  clang/docs/LanguageExtensions.rst
  clang/docs/ReleaseNotes.rst


Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -845,6 +845,7 @@
   unsafe floating-point optimizations use ``-funsafe-math-optimizations`` or
   ``-ffast-math`` instead.
 - Add ``__builtin_elementwise_sin`` and ``__builtin_elementwise_cos`` builtins for floating point types only.
+- Add ``__builtin_elementwise_log``builtin for floating point types only.
 
 Internal API Changes
 --------------------
Index: clang/docs/LanguageExtensions.rst
===================================================================
--- clang/docs/LanguageExtensions.rst
+++ clang/docs/LanguageExtensions.rst
@@ -635,6 +635,7 @@
  T __builtin_elementwise_sin(T x)            return the sine of x interpreted as an angle in radians          floating point types
  T __builtin_elementwise_cos(T x)            return the cosine of x interpreted as an angle in radians        floating point types
  T __builtin_elementwise_floor(T x)          return the largest integral value less than or equal to x        floating point types
+ T __builtin_elementwise_log(T x)            return the natural logarithm of x                                floating point types
  T __builtin_elementwise_roundeven(T x)      round x to the nearest integer value in floating point format,   floating point types
                                              rounding halfway cases to even (that is, to the nearest value
                                              that is an even integer), regardless of the current rounding


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140489.484632.patch
Type: text/x-patch
Size: 1605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221221/8c8625fc/attachment.bin>


More information about the cfe-commits mailing list