[PATCH] D131358: [X86] (0 - SetCC) | C -> (zext (not SetCC)) * (C + 1) - 1 if we can get a LEA out of it.

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 05:27:22 PDT 2022


RKSimon added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:48439
+  if (N0.getOpcode() == ISD::SUB && N0.hasOneUse() &&
+        isNullConstant(N0.getOperand(0))) {
+    SDValue Cond = N0.getOperand(1);
----------------
Limit this to legal i32/i64 cases? Add test coverage for other types as well.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:48455
+          SDValue R = DAG.getZExtOrTrunc(NotCond, dl, VT);
+          R = DAG.getNode(ISD::MUL, dl, VT, R, DAG.getConstant(Scale, dl, VT));
+          R = DAG.getNode(ISD::SUB, dl, VT, R, DAG.getConstant(1, dl, VT));
----------------
Not sure if we should use X86ISD::MUL_IMM here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131358



More information about the llvm-commits mailing list