[clang] 2a702ec - Use unsigned types for __popc/__popcll to match their declarations in CUDA headers.

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 5 16:03:14 PDT 2023


Author: Artem Belevich
Date: 2023-09-05T16:02:42-07:00
New Revision: 2a702eca3efa066e3a470cd3b17082a05e118c91

URL: https://github.com/llvm/llvm-project/commit/2a702eca3efa066e3a470cd3b17082a05e118c91
DIFF: https://github.com/llvm/llvm-project/commit/2a702eca3efa066e3a470cd3b17082a05e118c91.diff

LOG: Use unsigned types for __popc/__popcll to match their declarations in CUDA headers.

https://github.com/llvm/llvm-project/issues/65250

Added: 
    

Modified: 
    clang/lib/Headers/__clang_cuda_device_functions.h
    clang/lib/Headers/__clang_cuda_libdevice_declares.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/__clang_cuda_device_functions.h b/clang/lib/Headers/__clang_cuda_device_functions.h
index cc4e1a4dd96ad8..f8a12cefdb81b4 100644
--- a/clang/lib/Headers/__clang_cuda_device_functions.h
+++ b/clang/lib/Headers/__clang_cuda_device_functions.h
@@ -502,8 +502,8 @@ __DEVICE__ unsigned int __pm0(void) { return __nvvm_read_ptx_sreg_pm0(); }
 __DEVICE__ unsigned int __pm1(void) { return __nvvm_read_ptx_sreg_pm1(); }
 __DEVICE__ unsigned int __pm2(void) { return __nvvm_read_ptx_sreg_pm2(); }
 __DEVICE__ unsigned int __pm3(void) { return __nvvm_read_ptx_sreg_pm3(); }
-__DEVICE__ int __popc(int __a) { return __nv_popc(__a); }
-__DEVICE__ int __popcll(long long __a) { return __nv_popcll(__a); }
+__DEVICE__ int __popc(unsigned int __a) { return __nv_popc(__a); }
+__DEVICE__ int __popcll(unsigned long long __a) { return __nv_popcll(__a); }
 __DEVICE__ float __powf(float __a, float __b) {
   return __nv_fast_powf(__a, __b);
 }

diff  --git a/clang/lib/Headers/__clang_cuda_libdevice_declares.h b/clang/lib/Headers/__clang_cuda_libdevice_declares.h
index 23f35964ea974b..ded0382a7ddceb 100644
--- a/clang/lib/Headers/__clang_cuda_libdevice_declares.h
+++ b/clang/lib/Headers/__clang_cuda_libdevice_declares.h
@@ -285,8 +285,8 @@ __DEVICE__ double __nv_normcdfinv(double __a);
 __DEVICE__ float __nv_normcdfinvf(float __a);
 __DEVICE__ float __nv_normf(int __a, const float *__b);
 __DEVICE__ double __nv_norm(int __a, const double *__b);
-__DEVICE__ int __nv_popc(int __a);
-__DEVICE__ int __nv_popcll(long long __a);
+__DEVICE__ int __nv_popc(unsigned int __a);
+__DEVICE__ int __nv_popcll(unsigned long long __a);
 __DEVICE__ double __nv_pow(double __a, double __b);
 __DEVICE__ float __nv_powf(float __a, float __b);
 __DEVICE__ double __nv_powi(double __a, int __b);


        


More information about the cfe-commits mailing list