[X86] Add cheapX86FSETCC_SSE helper. NFC.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 8 Mar 2022 18:01:58 +0000 (18:01 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 8 Mar 2022 18:06:27 +0000 (18:06 +0000)
Identify FP CondCode that can be performed by a non-AVX SSE CMP op

Pulled out of D121210

llvm/lib/Target/X86/X86ISelLowering.cpp

index 405ec5d..d58c572 100644 (file)
@@ -23591,6 +23591,11 @@ static SDValue LowerAndToBT(SDValue And, ISD::CondCode CC,
   return DAG.getNode(X86ISD::BT, dl, MVT::i32, Src, BitNo);
 }
 
+// Check if pre-AVX condcode can be performed by a single FCMP op.
+static bool cheapX86FSETCC_SSE(ISD::CondCode SetCCOpcode) {
+  return (SetCCOpcode != ISD::SETONE) && (SetCCOpcode != ISD::SETUEQ);
+}
+
 /// Turns an ISD::CondCode into a value suitable for SSE floating-point mask
 /// CMPs.
 static unsigned translateX86FSETCC(ISD::CondCode SetCCOpcode, SDValue &Op0,
@@ -23858,7 +23863,7 @@ static SDValue LowerVSETCC(SDValue Op, const X86Subtarget &Subtarget,
 
       // In the two cases not handled by SSE compare predicates (SETUEQ/SETONE),
       // emit two comparisons and a logic op to tie them together.
-      if (SSECC >= 8) {
+      if (!cheapX86FSETCC_SSE(Cond)) {
         // LLVM predicate is SETUEQ or SETONE.
         unsigned CC0, CC1;
         unsigned CombineOpc;