[llvm] Reapply "[X86] EltsFromConsecutiveLoads - handle trunc(wideload()) patterns" (#199371) (PR #208999)
Adam Scott via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 15 21:11:25 PDT 2026
================
@@ -107,12 +107,36 @@ define <16 x i8> @buildvec_v16i8_stride4(ptr %p) {
; AVX2-NEXT: vpinsrb $15, 60(%rdi), %xmm0, %xmm0
; AVX2-NEXT: retq
;
-; AVX512-LABEL: buildvec_v16i8_stride4:
-; AVX512: # %bb.0:
-; AVX512-NEXT: vmovdqu64 (%rdi), %zmm0
-; AVX512-NEXT: vpmovdb %zmm0, %xmm0
-; AVX512-NEXT: vzeroupper
-; AVX512-NEXT: retq
+; AVX512F-LABEL: buildvec_v16i8_stride4:
+; AVX512F: # %bb.0:
+; AVX512F-NEXT: movzbl (%rdi), %eax
+; AVX512F-NEXT: vmovd %eax, %xmm0
+; AVX512F-NEXT: vpinsrb $1, 4(%rdi), %xmm0, %xmm0
----------------
as4230 wrote:
Before the revert this folded as one oversized load where it might read [0,64) when elements only cover [0,61) which was the unsafe part. The safe form needs two shifted loads but I was using VTRUNC (need VLX for 256/128) for intermediate lowering. The follow up was meant as a nice generalization on top but after the revert its a necessity now that I brought in to fold this.
https://github.com/llvm/llvm-project/pull/208999
More information about the llvm-commits
mailing list