[PATCH] D148249: [AArch64] Peep SELECT_CC patterns that match smin(a,0) and smax(a,0).

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 09:42:49 PDT 2023


cameron.mcinally created this revision.
cameron.mcinally added reviewers: paulwalker-arm, dmgreen.
Herald added subscribers: armkevincheng, sjarus, eric-k256, hiraditya, kristof.beyls.
Herald added a project: All.
cameron.mcinally requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

GitHub Issue #61767

With a previous patch to canonicalize SPF to min/max intrinsics (a266af721153 <https://reviews.llvm.org/rGa266af721153fab6452094207b09ed265ab0be7b>), we saw a 6% performance regression from our out-of-tree compiler on 372.smithwa.

This patch attempts to recover from the SPF canonicalization by peeping smin(a,0) and smax(a,0) SELECT_CC patterns during AArch64ISelLowering. We'll match the following patterns:

(SELECT_CC setgt, lhs, 0, lhs, 0) -> (BIC lhs, (SRA lhs, typesize-1))
(SELECT_CC setlt, lhs, 0, lhs, 0) -> (AND lhs, (SRA lhs, typesize-1))

Notice that there's some noise in the existing test cases. They haven't been run through update_llc_test_checks.py since the assembly comments for constants have been added. I will update those tests pre-commit if that will help.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148249

Files:
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/test/CodeGen/AArch64/fpclamptosat.ll
  llvm/test/CodeGen/AArch64/fptosi-sat-scalar.ll
  llvm/test/CodeGen/AArch64/fptosi-sat-vector.ll
  llvm/test/CodeGen/AArch64/min-max-peep.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148249.513275.patch
Type: text/x-patch
Size: 53393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230413/29aec1bf/attachment-0001.bin>


More information about the llvm-commits mailing list