[libclc] r312838 - vstore: Cleanup and add vstore(half)
Jan Vesely via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 8 16:58:57 PDT 2017
Author: jvesely
Date: Fri Sep 8 16:58:57 2017
New Revision: 312838
URL: http://llvm.org/viewvc/llvm-project?rev=312838&view=rev
Log:
vstore: Cleanup and add vstore(half)
Add missing undefs
Make helpers amdgpu specific (NVPTX uses different numbering for private AS)
Use clang builtins on clang >= 6
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
Reviewed-by: Tom Stellard <tstellar at redhat.com>
Added:
libclc/trunk/amdgpu/lib/SOURCES_4.0
libclc/trunk/amdgpu/lib/SOURCES_5.0
libclc/trunk/amdgpu/lib/shared/
libclc/trunk/amdgpu/lib/shared/vstore_half_helpers.ll
- copied, changed from r312837, libclc/trunk/generic/lib/shared/vstore_half_helpers.ll
Removed:
libclc/trunk/generic/lib/shared/vstore_half_helpers.ll
Modified:
libclc/trunk/generic/include/clc/shared/vstore.h
libclc/trunk/generic/lib/SOURCES
libclc/trunk/generic/lib/shared/vstore.cl
Added: libclc/trunk/amdgpu/lib/SOURCES_4.0
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/SOURCES_4.0?rev=312838&view=auto
==============================================================================
--- libclc/trunk/amdgpu/lib/SOURCES_4.0 (added)
+++ libclc/trunk/amdgpu/lib/SOURCES_4.0 Fri Sep 8 16:58:57 2017
@@ -0,0 +1 @@
+shared/vstore_half_helpers.ll
Added: libclc/trunk/amdgpu/lib/SOURCES_5.0
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/SOURCES_5.0?rev=312838&view=auto
==============================================================================
--- libclc/trunk/amdgpu/lib/SOURCES_5.0 (added)
+++ libclc/trunk/amdgpu/lib/SOURCES_5.0 Fri Sep 8 16:58:57 2017
@@ -0,0 +1 @@
+shared/vstore_half_helpers.ll
Copied: libclc/trunk/amdgpu/lib/shared/vstore_half_helpers.ll (from r312837, libclc/trunk/generic/lib/shared/vstore_half_helpers.ll)
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/shared/vstore_half_helpers.ll?p2=libclc/trunk/amdgpu/lib/shared/vstore_half_helpers.ll&p1=libclc/trunk/generic/lib/shared/vstore_half_helpers.ll&r1=312837&r2=312838&rev=312838&view=diff
==============================================================================
(empty)
Modified: libclc/trunk/generic/include/clc/shared/vstore.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/shared/vstore.h?rev=312838&r1=312837&r2=312838&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/shared/vstore.h (original)
+++ libclc/trunk/generic/include/clc/shared/vstore.h Fri Sep 8 16:58:57 2017
@@ -29,7 +29,6 @@
_CLC_VECTOR_VSTORE_PRIM3(_half, half, float)
#ifdef cl_khr_fp64
-#pragma OPENCL EXTENSION cl_khr_fp64: enable
_CLC_VECTOR_VSTORE_PRIM1(double)
_CLC_VECTOR_VSTORE_PRIM3(_half, half, double)
_CLC_VSTORE_DECL(_half, half, double, , __private)
@@ -37,7 +36,17 @@
_CLC_VSTORE_DECL(_half, half, double, , __global)
#endif
+#ifdef cl_khr_fp16
+ _CLC_VECTOR_VSTORE_PRIM1(half)
+#endif
+
_CLC_VECTOR_VSTORE_PRIM()
_CLC_VSTORE_DECL(_half, half, float, , __private)
_CLC_VSTORE_DECL(_half, half, float, , __local)
_CLC_VSTORE_DECL(_half, half, float, , __global)
+
+#undef _CLC_VSTORE_DECL
+#undef _CLC_VECTOR_VSTORE_DECL
+#undef _CLC_VECTOR_VSTORE_PRIM3
+#undef _CLC_VECTOR_VSTORE_PRIM1
+#undef _CLC_VECTOR_VSTORE_PRIM
Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=312838&r1=312837&r2=312838&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Sep 8 16:58:57 2017
@@ -147,7 +147,6 @@ shared/max.cl
shared/min.cl
shared/vload.cl
shared/vstore.cl
-shared/vstore_half_helpers.ll
workitem/get_global_id.cl
workitem/get_global_size.cl
image/get_image_dim.cl
Modified: libclc/trunk/generic/lib/shared/vstore.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/shared/vstore.cl?rev=312838&r1=312837&r2=312838&view=diff
==============================================================================
--- libclc/trunk/generic/lib/shared/vstore.cl (original)
+++ libclc/trunk/generic/lib/shared/vstore.cl Fri Sep 8 16:58:57 2017
@@ -50,23 +50,34 @@ VSTORE_TYPES()
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
VSTORE_ADDR_SPACES(double)
#endif
+#ifdef cl_khr_fp16
+#pragma OPENCL EXTENSION cl_khr_fp16 : enable
+ VSTORE_ADDR_SPACES(half)
+#endif
/* vstore_half are legal even without cl_khr_fp16 */
-#define DECLARE_HELPER(STYPE, AS) void __clc_vstore_half_##STYPE##_helper##AS(STYPE, AS half *);
+#if __clang_major__ < 6
+#define DECLARE_HELPER(STYPE, AS, builtin) void __clc_vstore_half_##STYPE##_helper##AS(STYPE, AS half *);
+#else
+#define DECLARE_HELPER(STYPE, AS, __builtin) \
+inline void __clc_vstore_half_##STYPE##_helper##AS(STYPE s, AS half *d) \
+{ \
+ __builtin(s, d); \
+}
+#endif
-DECLARE_HELPER(float, __private);
-DECLARE_HELPER(float, __global);
-DECLARE_HELPER(float, __local);
+DECLARE_HELPER(float, __private, __builtin_store_halff);
+DECLARE_HELPER(float, __global, __builtin_store_halff);
+DECLARE_HELPER(float, __local, __builtin_store_halff);
#ifdef cl_khr_fp64
-#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-DECLARE_HELPER(double, __private);
-DECLARE_HELPER(double, __global);
-DECLARE_HELPER(double, __local);
+DECLARE_HELPER(double, __private, __builtin_store_half);
+DECLARE_HELPER(double, __global, __builtin_store_half);
+DECLARE_HELPER(double, __local, __builtin_store_half);
#endif
-
#define VEC_STORE1(STYPE, AS, val) __clc_vstore_half_##STYPE##_helper##AS (val, &mem[offset++]);
+
#define VEC_STORE2(STYPE, AS, val) \
VEC_STORE1(STYPE, AS, val.lo) \
VEC_STORE1(STYPE, AS, val.hi)
@@ -94,4 +105,16 @@ DECLARE_HELPER(double, __local);
#define __CLC_BODY "vstore_half.inc"
#include <clc/math/gentype.inc>
-
+#undef __CLC_BODY
+#undef FUNC
+#undef __FUNC
+#undef VEC_LOAD16
+#undef VEC_LOAD8
+#undef VEC_LOAD4
+#undef VEC_LOAD3
+#undef VEC_LOAD2
+#undef VEC_LOAD1
+#undef DECLARE_HELPER
+#undef VSTORE_TYPES
+#undef VSTORE_ADDR_SPACES
+#undef VSTORE_VECTORIZE
Removed: libclc/trunk/generic/lib/shared/vstore_half_helpers.ll
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/shared/vstore_half_helpers.ll?rev=312837&view=auto
==============================================================================
--- libclc/trunk/generic/lib/shared/vstore_half_helpers.ll (original)
+++ libclc/trunk/generic/lib/shared/vstore_half_helpers.ll (removed)
@@ -1,35 +0,0 @@
-define void @__clc_vstore_half_float_helper__private(float %data, half addrspace(0)* nocapture %ptr) nounwind alwaysinline {
- %res = fptrunc float %data to half
- store half %res, half addrspace(0)* %ptr
- ret void
-}
-
-define void @__clc_vstore_half_float_helper__global(float %data, half addrspace(1)* nocapture %ptr) nounwind alwaysinline {
- %res = fptrunc float %data to half
- store half %res, half addrspace(1)* %ptr
- ret void
-}
-
-define void @__clc_vstore_half_float_helper__local(float %data, half addrspace(3)* nocapture %ptr) nounwind alwaysinline {
- %res = fptrunc float %data to half
- store half %res, half addrspace(3)* %ptr
- ret void
-}
-
-define void @__clc_vstore_half_double_helper__private(double %data, half addrspace(0)* nocapture %ptr) nounwind alwaysinline {
- %res = fptrunc double %data to half
- store half %res, half addrspace(0)* %ptr
- ret void
-}
-
-define void @__clc_vstore_half_double_helper__global(double %data, half addrspace(1)* nocapture %ptr) nounwind alwaysinline {
- %res = fptrunc double %data to half
- store half %res, half addrspace(1)* %ptr
- ret void
-}
-
-define void @__clc_vstore_half_double_helper__local(double %data, half addrspace(3)* nocapture %ptr) nounwind alwaysinline {
- %res = fptrunc double %data to half
- store half %res, half addrspace(3)* %ptr
- ret void
-}
More information about the cfe-commits
mailing list