[PATCH] D145065: [DAG] expandIntMINMAX - attempt to match existing SETCC node

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 1 06:12:39 PST 2023


RKSimon created this revision.
RKSimon added reviewers: spatel, pengfei, goldstein.w.n, dmgreen.
Herald added subscribers: eric-k256, StephenFan, sunfish, hiraditya, dschuff.
Herald added a project: All.
RKSimon requested review of this revision.
Herald added a subscriber: aheejin.
Herald added a project: LLVM.

As noticed on D144789 <https://reviews.llvm.org/D144789>, when we have pairs of min/max nodes we often end up with multiple comparisons which we could reuse with commuted select ops, so check to see if a suitable SETCC already exists. This also allowed us to remove a similar X86 peephole.

There are other getSETCC cases where we could safely use other CondCodes as well - I've been trying to think of how we could reuse this logic from SelectionDAG but haven't found anything that always works well.

An alternative would be to have a TLI callback that returns a preferred CondCode from a list of options, I've noticed this helped fpclamptosat tests on some other targets (MVE + WebAssembly), but other tests suffered.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145065

Files:
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/abds-vector-128.ll
  llvm/test/CodeGen/X86/abdu-vector-128.ll
  llvm/test/CodeGen/X86/midpoint-int-vec-128.ll
  llvm/test/CodeGen/X86/vselect-minmax.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145065.501487.patch
Type: text/x-patch
Size: 38142 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230301/0cdfa3d8/attachment.bin>


More information about the llvm-commits mailing list