[llvm] [X86][AVX512] Use comx for compare (PR #113098)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 02:38:25 PDT 2024


================
@@ -49520,6 +49520,15 @@ static SDValue combineCompareEqual(SDNode *N, SelectionDAG &DAG,
           // FIXME: need symbolic constants for these magic numbers.
           // See X86ATTInstPrinter.cpp:printSSECC().
           unsigned x86cc = (cc0 == X86::COND_E) ? 0 : 4;
+
+          // VCOMXSS simplifies conditional code sequence into single setcc node.
+          // Earlier until COMI, it required upto 2 SETCC's to test CC.
----------------
mahesh-attarde wrote:

On First line, I mark intent to do this legalization. COMX tests more flags and we need Single SETCC Node to infer.
Earlier Attempts used chain of SETCC like in X86ISelLowering.cpp snippet 
```
  case COMI: { // Comparison intrinsics
....
....
      SDValue SetCC;
      switch (CC) {
      case ISD::SETEQ: {
        SetCC = getSETCC(X86::COND_E, Comi, dl, DAG);   // FIRST SETCC 
        if (HasAVX10_2_COMX & HasAVX10_2_COMX_Ty) // ZF == 1
          break;
        // (ZF = 1 and PF = 0)
        SDValue SetNP = getSETCC(X86::COND_NP, Comi, dl, DAG);  // SECOND SETCC 
        SetCC = DAG.getNode(ISD::AND, dl, MVT::i8, SetCC, SetNP);
        break;
      }
```
May be instead of 2 CC, I need to write 2 Flags. Is it?

If we return `SDValue()`, We select `vucomiss` so to get desired selection `vucomxss` we need to change this.



https://github.com/llvm/llvm-project/pull/113098


More information about the llvm-commits mailing list