[libclc] 69/79: popcount: Provide function implementation rather than intrinsic redirect

Andreas Boll aboll-guest at moszumanska.debian.org
Mon Mar 19 16:51:02 UTC 2018


This is an automated email from the git hooks/post-receive script.

aboll-guest pushed a commit to branch master
in repository libclc.

commit 284d8a68cc5cd0b20c62f691097ec292fe994a8f
Author: Jan Vesely <jan.vesely at rutgers.edu>
Date:   Thu Mar 8 18:58:00 2018 +0000

    popcount: Provide function implementation rather than intrinsic redirect
    
    amdgcn will need to override this
    
    Reviewer: Aaron Watry <awatry at gmail.com>
    Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@327042 91177308-0d34-0410-b5e6-96231b3b80d8
---
 generic/include/clc/integer/popcount.h             | 11 +++++------
 generic/include/clc/integer/unary.inc              |  1 +
 generic/include/integer/popcount.h                 |  3 +++
 generic/include/{clc => }/integer/unary_intrin.inc |  0
 generic/lib/SOURCES                                |  1 +
 generic/lib/clc_unary.inc                          |  3 +++
 generic/lib/integer/popcount.cl                    |  8 ++++++++
 7 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/generic/include/clc/integer/popcount.h b/generic/include/clc/integer/popcount.h
index 99e4021..23335f4 100644
--- a/generic/include/clc/integer/popcount.h
+++ b/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/generic/include/clc/integer/unary.inc b/generic/include/clc/integer/unary.inc
new file mode 100644
index 0000000..9858d90
--- /dev/null
+++ b/generic/include/clc/integer/unary.inc
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x);
diff --git a/generic/include/integer/popcount.h b/generic/include/integer/popcount.h
new file mode 100644
index 0000000..00c7537
--- /dev/null
+++ b/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/generic/include/clc/integer/unary_intrin.inc b/generic/include/integer/unary_intrin.inc
similarity index 100%
rename from generic/include/clc/integer/unary_intrin.inc
rename to generic/include/integer/unary_intrin.inc
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
index f9104a3..247708a 100644
--- a/generic/lib/SOURCES
+++ b/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/generic/lib/clc_unary.inc b/generic/lib/clc_unary.inc
new file mode 100644
index 0000000..6c2782d
--- /dev/null
+++ b/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/generic/lib/integer/popcount.cl b/generic/lib/integer/popcount.cl
new file mode 100644
index 0000000..ca83b1a
--- /dev/null
+++ b/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>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/libclc.git



More information about the Pkg-opencl-commits mailing list