[PATCH] D147243: [X86] MatchVectorAllZeroTest - add support for icmp(bitcast(icmp_ne(X,Y)),0) vector reduction patterns

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 11:19:38 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:24429
+                                  SelectionDAG &DAG, X86::CondCode &X86CC) {
+  SDValue Z = DAG.getConstant(0, DL, V.getValueType());
+  return LowerVectorAllEqual(DL, V, Z, CC, Mask, Subtarget, DAG, X86CC);
----------------
Is there an issue creating a node that may potentially unused?


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:24503
+  // TODO: Expand to icmp(bitcast(icmp_eq(X,Y)),-1) patterns.
+  if (Op.getOpcode() == ISD::BITCAST && Mask.isAllOnes()) {
+    SDValue Src = Op.getOperand(0);
----------------
Maybe just `PeekThroughBitCast(Op).getOpcode() == ISD::SETCC`?


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:24509
+      ISD::CondCode SrcCC = cast<CondCodeSDNode>(Src.getOperand(2))->get();
+      if (SrcCC == ISD::SETNE) {
+        SDValue LHS = Src.getOperand(0);
----------------
Shouldnt there be a `Src.getOperand(1).isZeroConstant()`?


================
Comment at: llvm/test/CodeGen/X86/vector-reduce-or-cmp.ll:1031
+; AVX2-NEXT:    vpbroadcastd {{.*#+}} xmm1 = [15,15,15,15]
+; AVX2-NEXT:    vptest %xmm1, %xmm0
 ; AVX2-NEXT:    sete %al
----------------
why doesn't this micro-fuse anymore? Likewise below.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147243/new/

https://reviews.llvm.org/D147243



More information about the llvm-commits mailing list