<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/65250>65250</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
CUDA __popc __popcll parameter has wrong signedness
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DDoSolitary
</td>
</tr>
</table>
<pre>
According to [CUDA doc](https://docs.nvidia.com/cuda/cuda-math-api/group__CUDA__MATH__INTRINSIC__INT.html#group__CUDA__MATH__INTRINSIC__INT_1g43c9c7d2b9ebf202ff1ef5769989be46), `__popc` and `__popcll` accept unsigned arguments
```cuda
__device__ int __popc ( unsigned int x );
__device__ int __popcll ( unsigned long long int x );
```
but Clang's version is signed
https://github.com/llvm/llvm-project/blob/6098d7d5f6533edb1b873107ddc1acde23b9235b/clang/lib/Headers/__clang_cuda_device_functions.h#L505-L506
While this is mostly harmless, it causes a lot of "narrowing conversion from unsigned to signed is implementation defined" warnings when I was trying to check existing CUDA code with clang-tidy.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE2vozYU_TXO5iqRMZiPBYu8l0bzpOksOlN1ifxxAbfGRrZ5mfz7CpK8j1U7ErLhcjk695xjRIxmcIgt4U-En3ZiSaMP7enkv3trkgjXnfT62h6V8kEbN0DyQPjT85-nI2ivCD8RVo8pzZHkR8LOhJ21V_HgXo024qD8RNhZLVrct_0k0rgXsyHsPAS_zF23YnXd78cfX7ru5duPP16-fX953m4PY5osYfl_NnbZUOSqUZVmskHZM8r6PsOeV2XT1I3EoiSsIewZSEm7bvazIiUF4fR7wdqtpBTOCRa36aJBhGGZ0KVI6InQ430t6e3aBttK0HUaX43CrgPyGyM1JfUTGJfghg6E1e-oax1-wsopf_p_ANZ-hrDeDbdl7fmM9cbvI2m5JHi2wg2EVRFeMUTjHZgIN8CPrZ_9HEwaF3m30trXx7afg_8bVSLsLK2XhJ1L2tS60rwveZ6jlpmsqzyjldYqE0ojy2XDcr62qhuTszXr0xcUGkMk7Nx125tuVfYhSL84lYx38TASln_llO-_clp-ZPzXaCxCGk1cJ5p8TPYKowiTxRhX300CJZaIEQRYn8D3QBhzIgR_WWOtvHtI0gc_veucPDxMi2Cm2eIaB7HyAY29WaVjDC4iOOOGCJcRHbzARURI4Xo_MWpE9Q_gTxPTWtlOj_Ia4WLSCNvE-2T09bDTba6bvBE7bLOyyeusqopyN7Z1rRliUfeS95pnshK1FE1RMtY0Qgq1My2jLKcNLWjNeVEeaFZWUmdNWVQ6K2tOCoqTMPawenfwYdiZGBdsS8443Vkh0cbHbyC0m8FyGSIpqDUxxffPkkkW222Ge7bfEjqLICZMGGAUES5hjedNPYcx7pZg21_O1sZyjcZG9N8AAAD__0jMf84">