[llvm] 0be0ab9 - [X86] SimplifyDemandedVectorEltsForTargetNode - add X86ISD::VPMADDUBSW handling
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 21 06:40:15 PDT 2024
Author: Simon Pilgrim
Date: 2024-06-21T14:39:50+01:00
New Revision: 0be0ab90684102d1bed40362b895579f346e0fc0
URL: https://github.com/llvm/llvm-project/commit/0be0ab90684102d1bed40362b895579f346e0fc0
DIFF: https://github.com/llvm/llvm-project/commit/0be0ab90684102d1bed40362b895579f346e0fc0.diff
LOG: [X86] SimplifyDemandedVectorEltsForTargetNode - add X86ISD::VPMADDUBSW handling
In general terms, this can reuse the X86ISD::VPMADDWD code (num src elts = 2 * num dst elts) and same zero behaviour.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/combine-pmadd.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index f51a5e6c45184..82d2b301d854e 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -41764,6 +41764,7 @@ bool X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(
KnownZero = LHSZero | RHSZero;
break;
}
+ case X86ISD::VPMADDUBSW:
case X86ISD::VPMADDWD: {
APInt LHSUndef, LHSZero;
APInt RHSUndef, RHSZero;
diff --git a/llvm/test/CodeGen/X86/combine-pmadd.ll b/llvm/test/CodeGen/X86/combine-pmadd.ll
index d423ca33a5d4e..a375ac1db9a1b 100644
--- a/llvm/test/CodeGen/X86/combine-pmadd.ll
+++ b/llvm/test/CodeGen/X86/combine-pmadd.ll
@@ -155,28 +155,21 @@ define <16 x i16> @combine_pmaddubsw_concat(<16 x i8> %a0, <16 x i8> %a1, <16 x
ret <16 x i16> %3
}
-; TODO: Missing SimplifyDemandedVectorElts support
define <8 x i16> @combine_pmaddubsw_demandedelts(<16 x i8> %a0, <16 x i8> %a1) {
; SSE-LABEL: combine_pmaddubsw_demandedelts:
; SSE: # %bb.0:
-; SSE-NEXT: pshufb {{.*#+}} xmm0 = xmm0[0,1,2,3,4,5,6,7,8,8,8,8,8,8,8,8]
-; SSE-NEXT: pshufb {{.*#+}} xmm1 = xmm1[0,1,2,3,4,5,6,7,15,15,15,15,15,15,15,15]
; SSE-NEXT: pmaddubsw %xmm1, %xmm0
; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
; SSE-NEXT: retq
;
; AVX1-LABEL: combine_pmaddubsw_demandedelts:
; AVX1: # %bb.0:
-; AVX1-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0,1,2,3,4,5,6,7,8,8,8,8,8,8,8,8]
-; AVX1-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0,1,2,3,4,5,6,7,15,15,15,15,15,15,15,15]
; AVX1-NEXT: vpmaddubsw %xmm1, %xmm0, %xmm0
; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
; AVX1-NEXT: retq
;
; AVX2-LABEL: combine_pmaddubsw_demandedelts:
; AVX2: # %bb.0:
-; AVX2-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0,1,2,3,4,5,6,7,8,8,8,8,8,8,8,8]
-; AVX2-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0,1,2,3,4,5,6,7,15,15,15,15,15,15,15,15]
; AVX2-NEXT: vpmaddubsw %xmm1, %xmm0, %xmm0
; AVX2-NEXT: vpbroadcastd %xmm0, %xmm0
; AVX2-NEXT: retq
More information about the llvm-commits
mailing list