[llvm] [X86] Add tests showing failure to reduce the vector width of vpmaddwd/vpmaddubsw nodes (PR #180728)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 10 04:06:35 PST 2026
https://github.com/RKSimon created https://github.com/llvm/llvm-project/pull/180728
Missing demanded elts handling
>From 06df90b0378a4fc21b0bf954e205b1790810a4cc Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: Tue, 10 Feb 2026 12:04:49 +0000
Subject: [PATCH] [X86] Add tests showing failure to reduce the vector width of
vpmaddwd/vpmaddubsw nodes
Missing demanded elts handling
---
.../X86/vector-target-demanded-elts.ll | 49 +++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 llvm/test/CodeGen/X86/vector-target-demanded-elts.ll
diff --git a/llvm/test/CodeGen/X86/vector-target-demanded-elts.ll b/llvm/test/CodeGen/X86/vector-target-demanded-elts.ll
new file mode 100644
index 0000000000000..256799f6052d9
--- /dev/null
+++ b/llvm/test/CodeGen/X86/vector-target-demanded-elts.ll
@@ -0,0 +1,49 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-- -mcpu=x86-64-v4 | FileCheck %s
+
+define <4 x i32> @demanded_low_pmaddwd256_128(<16 x i16> %a0, <16 x i16> %a1) {
+; CHECK-LABEL: demanded_low_pmaddwd256_128:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vpmaddwd %ymm1, %ymm0, %ymm0
+; CHECK-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
+; CHECK-NEXT: vzeroupper
+; CHECK-NEXT: retq
+ %res = call <8 x i32> @llvm.x86.avx2.pmadd.wd(<16 x i16> %a0, <16 x i16> %a1)
+ %ext = shufflevector <8 x i32> %res, <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+ ret <4 x i32> %ext
+}
+
+define <8 x i32> @demanded_low_pmaddwd512_256(<32 x i16> %x0, <32 x i16> %x1) {
+; CHECK-LABEL: demanded_low_pmaddwd512_256:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vpmaddwd %zmm1, %zmm0, %zmm0
+; CHECK-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0
+; CHECK-NEXT: retq
+ %res = call <16 x i32> @llvm.x86.avx512.pmaddw.d.512(<32 x i16> %x0, <32 x i16> %x1)
+ %ext = shufflevector <16 x i32> %res, <16 x i32> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+ ret <8 x i32> %ext
+}
+
+define <8 x i16> @demanded_low_pmaddubs256_128(<32 x i8> %a0, <32 x i8> %a1) {
+; CHECK-LABEL: demanded_low_pmaddubs256_128:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vpmaddubsw %ymm1, %ymm0, %ymm0
+; CHECK-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
+; CHECK-NEXT: vzeroupper
+; CHECK-NEXT: retq
+ %res = call <16 x i16> @llvm.x86.avx2.pmadd.ub.sw(<32 x i8> %a0, <32 x i8> %a1)
+ %ext = shufflevector <16 x i16> %res, <16 x i16> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+ ret <8 x i16> %ext
+}
+
+define <16 x i16> @demanded_low_pmaddubs512_256(<64 x i8> %x0, <64 x i8> %x1) {
+; CHECK-LABEL: demanded_low_pmaddubs512_256:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vpmaddubsw %zmm1, %zmm0, %zmm0
+; CHECK-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0
+; CHECK-NEXT: retq
+ %res = call <32 x i16> @llvm.x86.avx512.pmaddubs.w.512(<64 x i8> %x0, <64 x i8> %x1)
+ %ext = shufflevector <32 x i16> %res, <32 x i16> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
+ ret <16 x i16> %ext
+}
+
More information about the llvm-commits
mailing list