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
This commit is contained in:
Jan Vesely 2020-02-04 20:14:04 -05:00 committed by Jan Vesely
parent 4b23a2e8e9
commit 85e2fa44c6
3 changed files with 35 additions and 0 deletions

View File

@ -1,5 +1,7 @@
math/fmax.cl
math/fmin.cl
math/native_rsqrt.cl
math/rsqrt.cl
synchronization/barrier.cl
workitem/get_global_offset.cl
workitem/get_group_id.cl

View File

@ -0,0 +1,10 @@
#include <clc/clc.h>
#include "../../../generic/lib/clcmacro.h"
_CLC_OVERLOAD _CLC_DEF float native_rsqrt(float x)
{
return __builtin_r600_recipsqrt_ieeef(x);
}
_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, native_rsqrt, float);

View File

@ -0,0 +1,23 @@
#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