[all-commits] [llvm/llvm-project] bfa4de: [SPIRV]Implementing PopCount for 16 and 64 bits (#...

joaosaffran via All-commits all-commits at lists.llvm.org
Tue Apr 14 19:11:33 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bfa4de2fb858f493471aba68b8e2b9bb030f10e4
      https://github.com/llvm/llvm-project/commit/bfa4de2fb858f493471aba68b8e2b9bb030f10e4
  Author: joaosaffran <joaosaffranllvm at gmail.com>
  Date:   2026-04-14 (Tue, 14 Apr 2026)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
    A llvm/test/CodeGen/SPIRV/llvm-intrinsics/ctpop-vk.ll
    M llvm/test/CodeGen/SPIRV/llvm-intrinsics/ctpop.ll

  Log Message:
  -----------
  [SPIRV]Implementing PopCount for 16 and 64 bits (#191283)

`OpBitCount` only supports 32bit types. So this patch modifies the
codegen to follow a similar pattern as `firstbithigh` and `firstbitlow`.
On 8 and 16 bits, the parameters are zero-extended to 32 bits. With 64
bits it is bitcasting into 2xi32 types. The logic is adapted to larger
component counts as well.

Fix: https://github.com/llvm/llvm-project/issues/142677

---------

Co-authored-by: Joao Saffran <jderezende at microsoft.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list