summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Sanders <daniel_l_sanders@apple.com>2020-01-13 11:58:05 -0800
committerDaniel Sanders <daniel_l_sanders@apple.com>2020-01-13 12:19:37 -0800
commita0f4600f4f0ece1d4779544513f5a70c6f0d78bf (patch)
tree6f6f8bb447568d540bd4971ca77cb8513c8b557e
parent231875e111facf6d15553dff9d7c04d3e9e4a404 (diff)
downloadbcm5719-llvm-a0f4600f4f0ece1d4779544513f5a70c6f0d78bf.tar.gz
bcm5719-llvm-a0f4600f4f0ece1d4779544513f5a70c6f0d78bf.zip
Rework be15dfa88fb1 such that it works with GlobalISel which doesn't use EVT
Summary: be15dfa88fb1 broke GlobalISel's usage of getSetCCInverse() which currently appears to be limited to our out-of-tree backend. GlobalISel doesn't use EVT's and isn't able to derive them from the information it has as it doesn't distinguish between integer and floating point types (that distinction is made by operations rather than values). Bring back the bool version of getSetCCInverse() in a way that doesn't break the intent of be15dfa88fb1 but also allows GlobalISel to continue using it. Reviewers: spatel, bogner, arichardson Reviewed By: arichardson Subscribers: rovka, hiraditya, Petar.Avramovic, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72309
-rw-r--r--llvm/include/llvm/CodeGen/ISDOpcodes.h10
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp14
2 files changed, 21 insertions, 3 deletions
diff --git a/llvm/include/llvm/CodeGen/ISDOpcodes.h b/llvm/include/llvm/CodeGen/ISDOpcodes.h
index 9812e2b4f7e..06140fae879 100644
--- a/llvm/include/llvm/CodeGen/ISDOpcodes.h
+++ b/llvm/include/llvm/CodeGen/ISDOpcodes.h
@@ -1105,6 +1105,16 @@ namespace ISD {
/// SetCC operation.
CondCode getSetCCInverse(CondCode Operation, EVT Type);
+ namespace GlobalISel {
+ /// Return the operation corresponding to !(X op Y), where 'op' is a valid
+ /// SetCC operation. The U bit of the condition code has different meanings
+ /// between floating point and integer comparisons and LLT's don't provide
+ /// this distinction. As such we need to be told whether the comparison is
+ /// floating point or integer-like. Pointers should use integer-like
+ /// comparisons.
+ CondCode getSetCCInverse(CondCode Operation, bool isIntegerLike);
+ } // end namespace GlobalISel
+
/// Return the operation corresponding to (Y op X) when given the operation
/// for (X op Y).
CondCode getSetCCSwappedOperands(CondCode Operation);
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 1b81e7de8a4..a0f621ab50a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -356,10 +356,9 @@ ISD::CondCode ISD::getSetCCSwappedOperands(ISD::CondCode Operation) {
(OldG << 2)); // New L bit.
}
-ISD::CondCode ISD::getSetCCInverse(ISD::CondCode Op, EVT Type) {
- bool IsInteger = Type.isInteger();
+static ISD::CondCode getSetCCInverseImpl(ISD::CondCode Op, bool isIntegerLike) {
unsigned Operation = Op;
- if (IsInteger)
+ if (isIntegerLike)
Operation ^= 7; // Flip L, G, E bits, but not U.
else
Operation ^= 15; // Flip all of the condition bits.
@@ -370,6 +369,15 @@ ISD::CondCode ISD::getSetCCInverse(ISD::CondCode Op, EVT Type) {
return ISD::CondCode(Operation);
}
+ISD::CondCode ISD::getSetCCInverse(ISD::CondCode Op, EVT Type) {
+ return getSetCCInverseImpl(Op, Type.isInteger());
+}
+
+ISD::CondCode ISD::GlobalISel::getSetCCInverse(ISD::CondCode Op,
+ bool isIntegerLike) {
+ return getSetCCInverseImpl(Op, isIntegerLike);
+}
+
/// For an integer comparison, return 1 if the comparison is a signed operation
/// and 2 if the result is an unsigned comparison. Return zero if the operation
/// does not depend on the sign of the input (setne and seteq).
OpenPOWER on IntegriCloud