Author: jvesely Date: Thu Mar 8 10:58:00 2018 New Revision: 327042 URL: http://llvm.org/viewvc/llvm-project?rev=327042&view=rev Log: popcount: Provide function implementation rather than intrinsic redirect
amdgcn will need to override this Reviewer: Aaron Watry <awa...@gmail.com> Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu> Added: libclc/trunk/generic/include/clc/integer/unary.inc libclc/trunk/generic/include/integer/ libclc/trunk/generic/include/integer/popcount.h libclc/trunk/generic/include/integer/unary_intrin.inc - copied, changed from r326821, libclc/trunk/generic/include/clc/integer/unary_intrin.inc libclc/trunk/generic/lib/clc_unary.inc libclc/trunk/generic/lib/integer/popcount.cl Removed: libclc/trunk/generic/include/clc/integer/unary_intrin.inc Modified: libclc/trunk/generic/include/clc/integer/popcount.h libclc/trunk/generic/lib/SOURCES Modified: libclc/trunk/generic/include/clc/integer/popcount.h URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/integer/popcount.h?rev=327042&r1=327041&r2=327042&view=diff ============================================================================== --- libclc/trunk/generic/include/clc/integer/popcount.h (original) +++ libclc/trunk/generic/include/clc/integer/popcount.h Thu Mar 8 10:58:00 2018 @@ -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 Added: libclc/trunk/generic/include/clc/integer/unary.inc URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/integer/unary.inc?rev=327042&view=auto ============================================================================== --- libclc/trunk/generic/include/clc/integer/unary.inc (added) +++ libclc/trunk/generic/include/clc/integer/unary.inc Thu Mar 8 10:58:00 2018 @@ -0,0 +1 @@ +_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x); Removed: libclc/trunk/generic/include/clc/integer/unary_intrin.inc URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/integer/unary_intrin.inc?rev=327041&view=auto ============================================================================== --- libclc/trunk/generic/include/clc/integer/unary_intrin.inc (original) +++ libclc/trunk/generic/include/clc/integer/unary_intrin.inc (removed) @@ -1,20 +0,0 @@ -#define __CLC_INTRINSIC_DEF(SCALAR_TYPE, BIT_SIZE) \ -_CLC_OVERLOAD SCALAR_TYPE __CLC_FUNCTION(SCALAR_TYPE x) __asm(__CLC_INTRINSIC ".i" BIT_SIZE); \ -_CLC_OVERLOAD SCALAR_TYPE##2 __CLC_FUNCTION(SCALAR_TYPE##2 x) __asm(__CLC_INTRINSIC ".v2i" BIT_SIZE); \ -_CLC_OVERLOAD SCALAR_TYPE##3 __CLC_FUNCTION(SCALAR_TYPE##3 x) __asm(__CLC_INTRINSIC ".v3i" BIT_SIZE); \ -_CLC_OVERLOAD SCALAR_TYPE##4 __CLC_FUNCTION(SCALAR_TYPE##4 x) __asm(__CLC_INTRINSIC ".v4i" BIT_SIZE); \ -_CLC_OVERLOAD SCALAR_TYPE##8 __CLC_FUNCTION(SCALAR_TYPE##8 x) __asm(__CLC_INTRINSIC ".v8i" BIT_SIZE); \ -_CLC_OVERLOAD SCALAR_TYPE##16 __CLC_FUNCTION(SCALAR_TYPE##16 x) __asm(__CLC_INTRINSIC ".v16i" BIT_SIZE); - -__CLC_INTRINSIC_DEF(char, "8") -__CLC_INTRINSIC_DEF(uchar, "8") -__CLC_INTRINSIC_DEF(short, "16") -__CLC_INTRINSIC_DEF(ushort, "16") -__CLC_INTRINSIC_DEF(int, "32") -__CLC_INTRINSIC_DEF(uint, "32") -__CLC_INTRINSIC_DEF(long, "64") -__CLC_INTRINSIC_DEF(ulong, "64") - -#undef __CLC_FUNCTION -#undef __CLC_INTRINSIC -#undef __CLC_INTRINSIC_DEF Added: libclc/trunk/generic/include/integer/popcount.h URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/integer/popcount.h?rev=327042&view=auto ============================================================================== --- libclc/trunk/generic/include/integer/popcount.h (added) +++ libclc/trunk/generic/include/integer/popcount.h Thu Mar 8 10:58:00 2018 @@ -0,0 +1,3 @@ +#define __CLC_FUNCTION __clc_native_popcount +#define __CLC_INTRINSIC "llvm.ctpop" +#include <integer/unary_intrin.inc> Copied: libclc/trunk/generic/include/integer/unary_intrin.inc (from r326821, libclc/trunk/generic/include/clc/integer/unary_intrin.inc) URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/integer/unary_intrin.inc?p2=libclc/trunk/generic/include/integer/unary_intrin.inc&p1=libclc/trunk/generic/include/clc/integer/unary_intrin.inc&r1=326821&r2=327042&rev=327042&view=diff ============================================================================== (empty) Modified: libclc/trunk/generic/lib/SOURCES URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=327042&r1=327041&r2=327042&view=diff ============================================================================== --- libclc/trunk/generic/lib/SOURCES (original) +++ libclc/trunk/generic/lib/SOURCES Thu Mar 8 10:58:00 2018 @@ -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 Added: libclc/trunk/generic/lib/clc_unary.inc URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/clc_unary.inc?rev=327042&view=auto ============================================================================== --- libclc/trunk/generic/lib/clc_unary.inc (added) +++ libclc/trunk/generic/lib/clc_unary.inc Thu Mar 8 10:58:00 2018 @@ -0,0 +1,3 @@ +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNC(__CLC_GENTYPE x) { + return __CLC_IMPL_FUNC(x); +} Added: libclc/trunk/generic/lib/integer/popcount.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/integer/popcount.cl?rev=327042&view=auto ============================================================================== --- libclc/trunk/generic/lib/integer/popcount.cl (added) +++ libclc/trunk/generic/lib/integer/popcount.cl Thu Mar 8 10:58:00 2018 @@ -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> _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits