[PATCH] D66687: [x86] try to form more bt/test + set out of shift+mask patterns

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 14:56:41 PDT 2019


spatel created this revision.
spatel added reviewers: craig.topper, xbolva00, lebedev.ri, RKSimon.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.

The motivating bugs are:
https://bugs.llvm.org/show_bug.cgi?id=41340
https://bugs.llvm.org/show_bug.cgi?id=42697

As discussed there, we could view this as a failure of IR canonicalization, but then we would need to implement a backend fixup with target overrides to get this right in all cases. Instead, we can just view this as a target-specific opportunity. It's not even clear for x86 exactly when we should favor test+set; some CPUs have better theoretical throughput for the ALU ops than bt/test.

This patch is made more complicated than I expected because there's an early DAGCombine for 'and' that can change types of the intermediate ops via trunc+anyext.


https://reviews.llvm.org/D66687

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/test-vs-bittest.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66687.216957.patch
Type: text/x-patch
Size: 5211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190823/d5f0d6f0/attachment.bin>


More information about the llvm-commits mailing list