forked from OSchip/llvm-project
[InstCombine][X86] MULDQ/MULUDQ undef -> zero
Added early out for single undef input - we were already supporting (and testing) this in the constant folding code, we just do it quicker now Drop undef handling from demanded elts code now that we handle it fully in InstCombiner::visitCallInst llvm-svn: 292913
This commit is contained in:
parent
f726dfa65e
commit
78f8630ac0
|
@ -520,7 +520,7 @@ static Value *simplifyX86muldq(const IntrinsicInst &II,
|
||||||
ResTy->getScalarSizeInBits() == 64 && "Unexpected muldq/muludq types");
|
ResTy->getScalarSizeInBits() == 64 && "Unexpected muldq/muludq types");
|
||||||
|
|
||||||
// muldq/muludq(undef, undef) -> zero (matches generic mul behavior)
|
// muldq/muludq(undef, undef) -> zero (matches generic mul behavior)
|
||||||
if (isa<UndefValue>(Arg0) && isa<UndefValue>(Arg1))
|
if (isa<UndefValue>(Arg0) || isa<UndefValue>(Arg1))
|
||||||
return ConstantAggregateZero::get(ResTy);
|
return ConstantAggregateZero::get(ResTy);
|
||||||
|
|
||||||
// Constant folding.
|
// Constant folding.
|
||||||
|
|
|
@ -1469,12 +1469,6 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, APInt DemandedElts,
|
||||||
Depth + 1);
|
Depth + 1);
|
||||||
if (TmpV) { II->setArgOperand(1, TmpV); MadeChange = true; }
|
if (TmpV) { II->setArgOperand(1, TmpV); MadeChange = true; }
|
||||||
|
|
||||||
// Output elements are undefined if both are undefined. Consider things
|
|
||||||
// like undef*0. The result is known zero, not undef.
|
|
||||||
for (unsigned i = 0; i != VWidth; ++i)
|
|
||||||
if (UndefElts2[i * 2] && UndefElts3[i * 2])
|
|
||||||
UndefElts.setBit(i);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue