summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2015-08-11 09:12:57 +0000
committerJames Molloy <james.molloy@arm.com>2015-08-11 09:12:57 +0000
commit134bec27226ab1d37cff44b04cef73b67321601b (patch)
tree694344ed69bba87532061b2dcfcdae634aee2dd6 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
parent1c78ca6a09cec862d6aad04e820dae98b71be9fc (diff)
downloadbcm5719-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/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index e31ba326d09..805e68ff11e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -2298,7 +2298,8 @@ void SelectionDAGBuilder::visitSelect(const User &I) {
// Min/max matching is only viable if all output VTs are the same.
if (std::equal(ValueVTs.begin(), ValueVTs.end(), ValueVTs.begin())) {
Value *LHS, *RHS;
- SelectPatternFlavor SPF = matchSelectPattern(const_cast<User*>(&I), LHS, RHS);
+ SelectPatternFlavor SPF =
+ matchSelectPattern(const_cast<User*>(&I), LHS, RHS).Flavor;
ISD::NodeType Opc = ISD::DELETED_NODE;
switch (SPF) {
case SPF_UMAX: Opc = ISD::UMAX; break;
OpenPOWER on IntegriCloud