Add codegen for llvm exp/exp2 elementwise builtin
The exp/exp2 elementwise builtins are 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 builtins are restricted to floating point types only.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Patch itself seems fine enough, but I want to give others a chance to poke at it. The name makes me grumbly, but if there is sufficient 'prior art' here, I'm ok with it.
clang/docs/LanguageExtensions.rst | ||
---|---|---|
642 | 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". |
clang/docs/LanguageExtensions.rst | ||
---|---|---|
642 | 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/ It is probably best to be consistent with C here even if it is unintuitive at first glance. |
clang/docs/LanguageExtensions.rst | ||
---|---|---|
642 | Agreed, thanks for the data point! I'm ok with it. |
clang/docs/LanguageExtensions.rst | ||
---|---|---|
643 | the wording using or seems a bit confusing as it might be interpreted as either-or (but I am not a native speaker). It might be slightly better to perhaps just drop the or? |
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".