Files
clang-p2996/libclc/generic/lib/math/mad.cl
Fraser Cormack c8eb865747 [libclc] Move mad to the CLC library (#123607)
All targets build `__clc_mad` -- even SPIR-V targets -- since it
compiles to the optimal `llvm.fmuladd` intrinsic. There is no change to
the bytecode generated for non-SPIR-V targets.

The `mix` builtin, which is implemented as a wrapper around `mad`, is
left as an OpenCL-layer wrapper of `__clc_mad`. I don't know if it's
worth having a specific CLC version of `mix`.

The changes to the other CLC files/functions are moving uses of `mad` to
`__clc_mad`, and reformatting. There is an additional instance of
`trunc` becoming `__clc_trunc`, which was missed before.
2025-01-20 16:27:51 +00:00

20 lines
444 B
Common Lisp

#include <clc/clc.h>
#include <clc/clcmacro.h>
#include <clc/math/clc_mad.h>
_CLC_DEFINE_TERNARY_BUILTIN(float, mad, __clc_mad, float, float, float)
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
_CLC_DEFINE_TERNARY_BUILTIN(double, mad, __clc_mad, double, double, double)
#endif
#ifdef cl_khr_fp16
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
_CLC_DEFINE_TERNARY_BUILTIN(half, mad, __clc_mad, half, half, half)
#endif