[PATCH] D141179: [X86]] Search through commutable operators for BMI patterns (BLSI, BLSR, BLSMSK)

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 19:40:38 PST 2023


goldstein.w.n created this revision.
Herald added subscribers: pengfei, hiraditya.
Herald added a project: All.
goldstein.w.n requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

(a & (-b)) & b is often lowered as:

  %sub  = sub i32     0, %b
  %and0 = and i32  %sub, %a
  %and1 = and i32 %and0, %b

Which won't get detected by the BLSI pattern as b & -b are never in
the same SDNode.

This patch will do a small search through commutable operators and try
and place BMI patterns in the same node so they will hit the pattern.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141179

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/bmi-out-of-order.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141179.487036.patch
Type: text/x-patch
Size: 7055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230107/be16c72a/attachment.bin>


More information about the llvm-commits mailing list