popcount: Provide function implementation rather than intrinsic redirect

amdgcn will need to override this

Reviewer: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327042
This commit is contained in:
Jan Vesely 2018-03-08 18:58:00 +00:00
parent 7b66ef1036
commit 17e8679493
7 changed files with 21 additions and 6 deletions

View File

@ -1,6 +1,5 @@
#undef popcount
#define popcount __clc_popcount
#define __CLC_FUNCTION __clc_popcount
#define __CLC_INTRINSIC "llvm.ctpop"
#include <clc/integer/unary_intrin.inc>
#define __CLC_FUNCTION popcount
#define __CLC_BODY <clc/integer/unary.inc>
#include <clc/integer/gentype.inc>
#undef __CLC_FUNCTION
#undef __CLC_BODY

View File

@ -0,0 +1 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x);

View File

@ -0,0 +1,3 @@
#define __CLC_FUNCTION __clc_native_popcount
#define __CLC_INTRINSIC "llvm.ctpop"
#include <integer/unary_intrin.inc>

View File

@ -70,6 +70,7 @@ integer/mad24.cl
integer/mad_sat.cl
integer/mul24.cl
integer/mul_hi.cl
integer/popcount.cl
integer/rhadd.cl
integer/rotate.cl
integer/sub_sat.cl

View File

@ -0,0 +1,3 @@
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNC(__CLC_GENTYPE x) {
return __CLC_IMPL_FUNC(x);
}

View File

@ -0,0 +1,8 @@
#include <clc/clc.h>
#include <integer/popcount.h>
#define __CLC_FUNC popcount
#define __CLC_IMPL_FUNC __clc_native_popcount
#define __CLC_BODY "../clc_unary.inc"
#include <clc/integer/gentype.inc>