diff options
author | Jan Vesely <jan.vesely@rutgers.edu> | 2020-02-04 20:14:04 -0500 |
---|---|---|
committer | Jan Vesely <jano.vesely@gmail.com> | 2020-02-09 14:42:15 -0500 |
commit | 85e2fa44c64e1edd2f675c990ecc60f5fadb4686 (patch) | |
tree | 316a95b1192310809868e7f68f47f6a009de34aa | |
parent | 4b23a2e8e971876d075d3ae322754dbc0495413d (diff) | |
download | llvm-85e2fa44c64e1edd2f675c990ecc60f5fadb4686.tar.gz |
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
-rw-r--r-- | libclc/r600/lib/SOURCES | 2 | ||||
-rw-r--r-- | libclc/r600/lib/math/native_rsqrt.cl | 10 | ||||
-rw-r--r-- | libclc/r600/lib/math/rsqrt.cl | 23 |
3 files changed, 35 insertions, 0 deletions
diff --git a/libclc/r600/lib/SOURCES b/libclc/r600/lib/SOURCES index 4342ac38201c..6e01bbb2b8b9 100644 --- a/libclc/r600/lib/SOURCES +++ b/libclc/r600/lib/SOURCES @@ -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 diff --git a/libclc/r600/lib/math/native_rsqrt.cl b/libclc/r600/lib/math/native_rsqrt.cl new file mode 100644 index 000000000000..edf473e8409c --- /dev/null +++ b/libclc/r600/lib/math/native_rsqrt.cl @@ -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); diff --git a/libclc/r600/lib/math/rsqrt.cl b/libclc/r600/lib/math/rsqrt.cl new file mode 100644 index 000000000000..37a8037902c2 --- /dev/null +++ b/libclc/r600/lib/math/rsqrt.cl @@ -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 |