Jan Vesely 85e2fa44c6 libclc/r600: Use target specific builtins to implement rsqrt and native_rsqrt
Fixes OCL CTS rsqrt and half_rsqrt (1 thread, scalaer) tests on AMD Turks.

Reviewer: awatry
Differential Revision: https://reviews.llvm.org/D74016
2020-02-09 14:42:15 -05:00

24 lines
469 B
Common Lisp

#include <clc/clc.h>
#include "../../../generic/lib/clcmacro.h"
_CLC_OVERLOAD _CLC_DEF float rsqrt(float x)
{
return __builtin_r600_recipsqrt_ieeef(x);
}
_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, rsqrt, float);
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
_CLC_OVERLOAD _CLC_DEF double rsqrt(double x)
{
return __builtin_r600_recipsqrt_ieee(x);
}
_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, rsqrt, double);
#endif