This commit moves the implementation of the copysign builtin to the CLC library. It simultaneously optimizes it for vector types by avoiding scalarization. It does so by using the __builtin_elementwise_copysign clang builtins, which can handle vector types. It also fixes a bug in the half/fp16 implementation of the builtin. This version was using an incorrect mask (0x7FFFF instead of 0x7FFF) and was thus preserving the original sign bit, rather than masking it out.
8 lines
163 B
Common Lisp
8 lines
163 B
Common Lisp
#include <clc/clc.h>
|
|
#include <clc/math/clc_copysign.h>
|
|
|
|
#define FUNCTION copysign
|
|
#define __CLC_BODY <clc/shared/binary_def.inc>
|
|
|
|
#include <clc/math/gentype.inc>
|