diff options
author | Jan Vesely <jan.vesely@rutgers.edu> | 2018-03-08 18:58:00 +0000 |
---|---|---|
committer | Jan Vesely <jan.vesely@rutgers.edu> | 2018-03-08 18:58:00 +0000 |
commit | 17e8679493734b07aa764a9ec7cf040da35388e0 (patch) | |
tree | 38dc4b62075b587b70ecc74b7e751b83dba5e23f | |
parent | 7b66ef10364d20acfa83934e04a04b2f799a0396 (diff) | |
download | bcm5719-llvm-17e8679493734b07aa764a9ec7cf040da35388e0.tar.gz bcm5719-llvm-17e8679493734b07aa764a9ec7cf040da35388e0.zip |
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
-rw-r--r-- | libclc/generic/include/clc/integer/popcount.h | 11 | ||||
-rw-r--r-- | libclc/generic/include/clc/integer/unary.inc | 1 | ||||
-rw-r--r-- | libclc/generic/include/integer/popcount.h | 3 | ||||
-rw-r--r-- | libclc/generic/include/integer/unary_intrin.inc (renamed from libclc/generic/include/clc/integer/unary_intrin.inc) | 0 | ||||
-rw-r--r-- | libclc/generic/lib/SOURCES | 1 | ||||
-rw-r--r-- | libclc/generic/lib/clc_unary.inc | 3 | ||||
-rw-r--r-- | libclc/generic/lib/integer/popcount.cl | 8 |
7 files changed, 21 insertions, 6 deletions
diff --git a/libclc/generic/include/clc/integer/popcount.h b/libclc/generic/include/clc/integer/popcount.h index 99e402171de..23335f45b6f 100644 --- a/libclc/generic/include/clc/integer/popcount.h +++ b/libclc/generic/include/clc/integer/popcount.h @@ -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 diff --git a/libclc/generic/include/clc/integer/unary.inc b/libclc/generic/include/clc/integer/unary.inc new file mode 100644 index 00000000000..9858d908da0 --- /dev/null +++ b/libclc/generic/include/clc/integer/unary.inc @@ -0,0 +1 @@ +_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x); diff --git a/libclc/generic/include/integer/popcount.h b/libclc/generic/include/integer/popcount.h new file mode 100644 index 00000000000..00c753753bb --- /dev/null +++ b/libclc/generic/include/integer/popcount.h @@ -0,0 +1,3 @@ +#define __CLC_FUNCTION __clc_native_popcount +#define __CLC_INTRINSIC "llvm.ctpop" +#include <integer/unary_intrin.inc> diff --git a/libclc/generic/include/clc/integer/unary_intrin.inc b/libclc/generic/include/integer/unary_intrin.inc index ee9862a4c5b..ee9862a4c5b 100644 --- a/libclc/generic/include/clc/integer/unary_intrin.inc +++ b/libclc/generic/include/integer/unary_intrin.inc diff --git a/libclc/generic/lib/SOURCES b/libclc/generic/lib/SOURCES index f9104a3f2a8..247708a6762 100644 --- a/libclc/generic/lib/SOURCES +++ b/libclc/generic/lib/SOURCES @@ -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 diff --git a/libclc/generic/lib/clc_unary.inc b/libclc/generic/lib/clc_unary.inc new file mode 100644 index 00000000000..6c2782d102a --- /dev/null +++ b/libclc/generic/lib/clc_unary.inc @@ -0,0 +1,3 @@ +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNC(__CLC_GENTYPE x) { + return __CLC_IMPL_FUNC(x); +} diff --git a/libclc/generic/lib/integer/popcount.cl b/libclc/generic/lib/integer/popcount.cl new file mode 100644 index 00000000000..ca83b1afaf9 --- /dev/null +++ b/libclc/generic/lib/integer/popcount.cl @@ -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> |