brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 74ee1ed Raw
44 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#include <clc/float/definitions.h>10#include <clc/internal/clc.h>11#include <clc/math/clc_log2.h>12 13/*14 *log(x) = log2(x) * (1/log2(e))15 */16 17_CLC_OVERLOAD _CLC_DEF float __clc_log(float x) {18  return __clc_log2(x) * (1.0f / M_LOG2E_F);19}20 21#ifdef cl_khr_fp6422 23#pragma OPENCL EXTENSION cl_khr_fp64 : enable24 25_CLC_OVERLOAD _CLC_DEF double __clc_log(double x) {26  return __clc_log2(x) * (1.0 / M_LOG2E);27}28 29#endif // cl_khr_fp6430 31#ifdef cl_khr_fp1632 33#pragma OPENCL EXTENSION cl_khr_fp16 : enable34 35_CLC_OVERLOAD _CLC_DEF half __clc_log(half x) {36  return (half)__clc_log2((float)x) * (1.0h / M_LOG2E_H);37}38 39#endif // cl_khr_fp1640 41#define __CLC_FUNCTION __clc_log42#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>43#include <clc/math/gentype.inc>44