diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-02-24 20:59:14 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-02-24 20:59:14 +0000 |
commit | 295e8b4e1223569b7760a38a6a482cc0b63f389e (patch) | |
tree | cceb11d8d38dad3c48ae5a2362163adeeeb7e6ef | |
parent | c0dbdb86c35f2d7d57e88090799759a9ec7a2157 (diff) | |
download | bcm5719-llvm-295e8b4e1223569b7760a38a6a482cc0b63f389e.tar.gz bcm5719-llvm-295e8b4e1223569b7760a38a6a482cc0b63f389e.zip |
[TargetLowering] SimplifyDemandedVectorElts - pass demanded elts through ADD/SUB ops
llvm-svn: 326044
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 13 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/widen_conv-1.ll | 3 |
2 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 36cb2cd963a..cb737dcd787 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -1536,6 +1536,19 @@ bool TargetLowering::SimplifyDemandedVectorElts( } break; } + case ISD::ADD: + case ISD::SUB: { + APInt SrcUndef, SrcZero; + if (SimplifyDemandedVectorElts(Op.getOperand(1), DemandedElts, SrcUndef, + SrcZero, TLO, Depth + 1)) + return true; + if (SimplifyDemandedVectorElts(Op.getOperand(0), DemandedElts, KnownUndef, + KnownZero, TLO, Depth + 1)) + return true; + KnownZero &= SrcZero; + KnownUndef &= SrcUndef; + break; + } case ISD::TRUNCATE: if (SimplifyDemandedVectorElts(Op.getOperand(0), DemandedElts, KnownUndef, KnownZero, TLO, Depth + 1)) diff --git a/llvm/test/CodeGen/X86/widen_conv-1.ll b/llvm/test/CodeGen/X86/widen_conv-1.ll index 7e0f999bc10..123e4438b22 100644 --- a/llvm/test/CodeGen/X86/widen_conv-1.ll +++ b/llvm/test/CodeGen/X86/widen_conv-1.ll @@ -8,7 +8,8 @@ define void @convert_v2i64_to_v2i32(<2 x i32>* %dst.addr, <2 x i64> %src) nounwi ; X86-LABEL: convert_v2i64_to_v2i32: ; X86: # %bb.0: # %entry ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NEXT: paddd {{\.LCPI.*}}, %xmm0 +; X86-NEXT: pcmpeqd %xmm1, %xmm1 +; X86-NEXT: psubd %xmm1, %xmm0 ; X86-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3] ; X86-NEXT: movq %xmm0, (%eax) ; X86-NEXT: retl |