[PATCH] D42948: [SelectionDAG] Support some SimplifySetCC cases for comparing against vector splats of constants.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 08:59:09 PST 2018


spatel added a comment.

Please check in the AArch64 (and MIPS?) test changes ahead of this.

I'd prefer to add some dedicated minimal tests, so we know exactly what the improvements are without digging through the more complicated diffs. That would be stuff like this I think:

  define <4 x i32> @lt_min(<4 x i32> %x) {
    %cmp = icmp slt <4 x i32> %x, <i32 2147483648, i32 2147483648, i32 2147483648, i32 2147483648>
    %r = sext <4 x i1> %cmp to <4 x i32>
    ret <4 x i32> %r
  }



================
Comment at: lib/CodeGen/SelectionDAG/TargetLowering.cpp:1891
       if (C1 == MinVal)
-        return DAG.getConstant(1, dl, VT);
-
-      // X >= C0 --> X > (C0 - 1)
-      APInt C = C1 - 1;
-      ISD::CondCode NewCC = (Cond == ISD::SETGE) ? ISD::SETGT : ISD::SETUGT;
-      if ((DCI.isBeforeLegalizeOps() ||
-           isCondCodeLegal(NewCC, VT.getSimpleVT())) &&
-          (!N1C->isOpaque() || (N1C->isOpaque() && C.getBitWidth() <= 64 &&
-                                isLegalICmpImmediate(C.getSExtValue())))) {
-        return DAG.getSetCC(dl, VT, N0,
-                            DAG.getConstant(C, dl, N1.getValueType()),
-                            NewCC);
+        return DAG.getBooleanTrueConstant(dl, VT);
+
----------------
Is this (and similar diffs below) currently wrong for ZeroOrNegativeOneBooleanContent targets?
I'm having a hard time seeing all the pre-conditions in this 900 line monster of a function...


Repository:
  rL LLVM

https://reviews.llvm.org/D42948





More information about the llvm-commits mailing list