[llvm] [LegalizeTypes] Use vector CTPOP for wide integer popcount on targets with VPOPCNTDQ (PR #182547)
Timothy Herchen via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 20 14:21:25 PST 2026
================
@@ -18,13 +19,43 @@ define i32 @test_ctpop_i128(i128 %a0) nounwind {
; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
; CHECK-NEXT: retq
;
-; AVX512-LABEL: test_ctpop_i128:
-; AVX512: # %bb.0:
-; AVX512-NEXT: popcntq %rsi, %rcx
-; AVX512-NEXT: popcntq %rdi, %rax
-; AVX512-NEXT: addl %ecx, %eax
-; AVX512-NEXT: # kill: def $eax killed $eax killed $rax
-; AVX512-NEXT: retq
+; AVX512F-LABEL: test_ctpop_i128:
+; AVX512F: # %bb.0:
+; AVX512F-NEXT: popcntq %rsi, %rcx
+; AVX512F-NEXT: popcntq %rdi, %rax
+; AVX512F-NEXT: addl %ecx, %eax
+; AVX512F-NEXT: # kill: def $eax killed $eax killed $rax
+; AVX512F-NEXT: retq
+;
+; AVX512VL-LABEL: test_ctpop_i128:
+; AVX512VL: # %bb.0:
+; AVX512VL-NEXT: popcntq %rsi, %rcx
+; AVX512VL-NEXT: popcntq %rdi, %rax
+; AVX512VL-NEXT: addl %ecx, %eax
+; AVX512VL-NEXT: # kill: def $eax killed $eax killed $rax
+; AVX512VL-NEXT: retq
+;
+; AVX512VPOPCNTDQ-LABEL: test_ctpop_i128:
+; AVX512VPOPCNTDQ: # %bb.0:
+; AVX512VPOPCNTDQ-NEXT: vmovq %rsi, %xmm0
----------------
anematode wrote:
This seems pretty terrible compared to the standard impl?
https://github.com/llvm/llvm-project/pull/182547
More information about the llvm-commits
mailing list