[PATCH] D145270: Add codegen for llvm exp/exp2 elementwise builtins
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 7 09:21:37 PST 2023
erichkeane added inline comments.
================
Comment at: clang/docs/LanguageExtensions.rst:642
T __builtin_elementwise_log10(T x) return the base 10 logarithm of x floating point types
+ T __builtin_elementwise_exp(T x) returns the base-e exponential, or e^x, of the specified value floating point types
+ T __builtin_elementwise_exp2(T x) returns the base-2 exponential, or 2^x, of the specified value floating point types
----------------
beanz wrote:
> erichkeane wrote:
> > The naming difference between these is a little clunky, but I dont use these enough to know if this is a common pattern. Its weird to me that _exp means "e^x", but _exp2 means "2^x".
> Agreed that it seems odd, but in C and C++ math libraries `exp` is base-e, and `exp2` is base-2:
>
> https://cplusplus.com/reference/cmath/exp/
> https://cplusplus.com/reference/cmath/exp2/
>
> It is probably best to be consistent with C here even if it is unintuitive at first glance.
Agreed, thanks for the data point! I'm ok with it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145270/new/
https://reviews.llvm.org/D145270
More information about the cfe-commits
mailing list