diff options
author | James Molloy <james.molloy@arm.com> | 2015-08-11 09:12:57 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2015-08-11 09:12:57 +0000 |
commit | 134bec27226ab1d37cff44b04cef73b67321601b (patch) | |
tree | 694344ed69bba87532061b2dcfcdae634aee2dd6 /llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp | |
parent | 1c78ca6a09cec862d6aad04e820dae98b71be9fc (diff) | |
download | bcm5719-llvm-134bec27226ab1d37cff44b04cef73b67321601b.tar.gz bcm5719-llvm-134bec27226ab1d37cff44b04cef73b67321601b.zip |
Add support for floating-point minnum and maxnum
The select pattern recognition in ValueTracking (as used by InstCombine
and SelectionDAGBuilder) only knew about integer patterns. This teaches
it about minimum and maximum operations.
matchSelectPattern() has been extended to return a struct containing the
existing Flavor and a new enum defining the pattern's behavior when
given one NaN operand.
C minnum() is defined to return the non-NaN operand in this case, but
the idiomatic C "a < b ? a : b" would return the NaN operand.
ARM and AArch64 at least have different instructions for these different cases.
llvm-svn: 244580
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp index 80628b23f11..142e071fa21 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp @@ -410,7 +410,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask, // If this is a select as part of a min/max pattern, don't simplify any // further in case we break the structure. Value *LHS, *RHS; - if (matchSelectPattern(I, LHS, RHS) != SPF_UNKNOWN) + if (matchSelectPattern(I, LHS, RHS).Flavor != SPF_UNKNOWN) return nullptr; if (SimplifyDemandedBits(I->getOperandUse(2), DemandedMask, RHSKnownZero, |