diff options
author | Fraser Cormack <fraser@codeplay.com> | 2025-07-29 13:21:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-29 13:21:42 +0100 |
commit | 586cacdbdd995d2a2f010f7152843745f4978b4b (patch) | |
tree | e9790f25dbce24d24c41133cb91b51b4e1583408 /clang/test/Modules/ModuleModuleDebugInfo.cpp | |
parent | 315e2e28b13285a352d409b739ba31fb453d661b (diff) | |
download | llvm-586cacdbdd995d2a2f010f7152843745f4978b4b.zip llvm-586cacdbdd995d2a2f010f7152843745f4978b4b.tar.gz llvm-586cacdbdd995d2a2f010f7152843745f4978b4b.tar.bz2 |
[libclc] Optimize generic CLC fmin/fmax (#128506)
With this commit, the CLC fmin/fmax builtins use clang's
__builtin_elementwise_(min|max)imumnum which helps us generate LLVM
minimumnum/maximumnum intrinsics directly. These intrinsics uniformly
select the non-NaN input over the (quiet or signalling) NaN input, which
corresponds to what the OpenCL CTS tests.
These intrinsics maintain the vector types, as opposed to scalarizing,
which was previously happening. This commit therefore helps to optimize
codegen for those targets.
Note that there is ongoing discussion regarding how these builtins
should handle signalling NaNs in the OpenCL specification and whether
they should be able to return a quiet NaN as per the IEEE behaviour. If
the specification and/or CTS is ever updated to allow or mandate
returning a qNAN, these builtins could/should be updated to use
__builtin_elementwise_(min|max)num instead which would lower to LLVM
minnum/maxnum intrinsics.
The SPIR-V targets maintain the old implementations, as the LLVM ->
SPIR-V translator can't currently handle the LLVM intrinsics. The
implementation has been simplifies to consistently use clang builtins,
as opposed to before where the half version was explicitly defined.
[1] https://github.com/KhronosGroup/OpenCL-CTS/pull/2285
Diffstat (limited to 'clang/test/Modules/ModuleModuleDebugInfo.cpp')
0 files changed, 0 insertions, 0 deletions