Files
clang-p2996/libclc/clc/include/clc/geometric/unary_def.inc
Fraser Cormack 655151a7e0 [libclc] Move (fast) length & distance to CLC library (#139701)
This commit also refactors how geometric builtins are defined and
declared, by sharing more helpers. It also removes an unnecessary
gentype-like helper in favour of the more complete math/gentype.inc.

There are no changes to the IR for any of these four builtins.

The 'normalize' builtin will follow in a subsequent commit because it
would involve the addition of missing halfn-type overloads for
completeness.
2025-05-13 11:45:55 +01:00

30 lines
880 B
PHP

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <clc/utils.h>
#ifndef __CLC_FUNCTION
#define __CLC_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif
// Geometric functions are only defined for scalar, vec2, vec3 and vec4
#if (__CLC_VECSIZE_OR_1 == 1 || __CLC_VECSIZE_OR_1 == 2 || \
__CLC_VECSIZE_OR_1 == 3 || __CLC_VECSIZE_OR_1 == 4)
_CLC_OVERLOAD _CLC_DEF
#ifdef __CLC_GEOMETRIC_RET_GENTYPE
__CLC_GENTYPE
#else
__CLC_SCALAR_GENTYPE
#endif
FUNCTION(__CLC_GENTYPE a) {
return __CLC_FUNCTION(FUNCTION)(a);
}
#endif