[llvm] [X86] Compute `CTLZ` using fp math for `v4i32` on SSE2 targets (PR #190930)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 8 13:40:19 PDT 2026


================
@@ -426,44 +426,34 @@ define <4 x i32> @combine_vec_lshr_lzcnt_bit1(<4 x i32> %x) {
 ; SSE2-LABEL: combine_vec_lshr_lzcnt_bit1:
 ; SSE2:       # %bb.0:
 ; SSE2-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
+; SSE2-NEXT:    pshufd {{.*#+}} xmm1 = xmm0[3,3,3,3]
+; SSE2-NEXT:    movd %xmm1, %eax
+; SSE2-NEXT:    xorps %xmm1, %xmm1
+; SSE2-NEXT:    cvtsi2sd %eax, %xmm1
----------------
def3r wrote:

Using @topperc's [suggestion](https://github.com/llvm/llvm-project/pull/190930#issuecomment-4207715463) to do two v2f64 conversions actually drops this xmm<->gpr traffic

https://github.com/llvm/llvm-project/pull/190930


More information about the llvm-commits mailing list