The result of a POPCOUNT operation in RTL should have the same mode as its operand. This corrects the specification of popcount in the nvptx backend, splitting the current generic define_insn into two, one for popcountsi2 and the other for popcountdi2 (the latter with an explicit truncate). This patch has been tested on nvptx-none (hosted on x86_64-pc-linux-gnu) with make and make -k check with no new failures. This functionality is already tested by gcc.target/nvptx/popc-[123].c. Ok for mainline? 2023-01-09 Roger Sayle gcc/ChangeLog * config/nvptx/nvptx.md (popcount2): Split into... (popcountsi2): define_insn handling SImode popcount. (popcountdi2): define_insn handling DImode popcount, with an explicit truncate:SI to produce an SImode result. Thanks in advance, Roger --