From 9619457b1fab112e90142983d24ee1ce7726d9da Mon Sep 17 00:00:00 2001 From: Aaron Enye Shi Date: Tue, 28 Aug 2018 19:58:20 +0000 Subject: [PATCH] Add bitinsert64 to device functions [ROCm/hip commit: ba9fc6f3557a7f32b3e870f71608ff5ab9dbc04d] --- projects/hip/include/hip/hcc_detail/device_functions.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/hip/include/hip/hcc_detail/device_functions.h b/projects/hip/include/hip/hcc_detail/device_functions.h index 2514eec2d7..d774a3ba33 100644 --- a/projects/hip/include/hip/hcc_detail/device_functions.h +++ b/projects/hip/include/hip/hcc_detail/device_functions.h @@ -110,6 +110,13 @@ __device__ static inline unsigned int __bitinsert_u32(unsigned int src0, unsigne return ((src0 & ~(mask << offset)) | ((src1 & mask) << offset)); } +__device__ static inline uint64_t __bitinsert_u64(uint64_t src0, uint64_t src1, unsigned int src2, unsigned int src3) { + uint64_t offset = src2 & 63; + uint64_t width = src3 & 63; + uint64_t mask = (1 << width) - 1; + return ((src0 & ~(mask << offset)) | ((src1 & mask) << offset)); +} + __device__ static unsigned int __byte_perm(unsigned int x, unsigned int y, unsigned int s); __device__ static unsigned int __hadd(int x, int y); __device__ static int __mul24(int x, int y);