24 lines · plain
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#if __CLC_VECSIZE_OR_1 == 110 11_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_fast_normalize(__CLC_GENTYPE p) {12 return __clc_normalize(p);13}14 15#elif (__CLC_VECSIZE_OR_1 == 2 || __CLC_VECSIZE_OR_1 == 3 || \16 __CLC_VECSIZE_OR_1 == 4)17 18_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_fast_normalize(__CLC_GENTYPE p) {19 __CLC_SCALAR_GENTYPE l2 = __clc_dot(p, p);20 return l2 == 0.0f ? p : p * __clc_half_rsqrt(l2);21}22 23#endif24