[PATCH] D49242: [Intrinsics] define funnel shift IR intrinsics + DAG builder support

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 12 08:27:11 PDT 2018


spatel created this revision.
spatel added reviewers: craig.topper, RKSimon, kparzysz, davezarzycki, regehr, scanon, mjacob, lebedev.ri, efriedma, hfinkel.
Herald added subscribers: kristof.beyls, nemanjai, mcrosier.
Herald added a reviewer: javed.absar.

As discussed here:
http://lists.llvm.org/pipermail/llvm-dev/2018-May/123292.html
http://lists.llvm.org/pipermail/llvm-dev/2018-July/124400.html

We want to add rotate intrinsics because the IR expansion of that pattern is 4+ instructions, and we can lose pieces of the pattern before it gets to the backend. Generalizing the operation by allowing 2 different input values (plus the 3rd shift/rotate amount) gives us a "funnel shift" operation which may also be a single hardware instruction.

Initially, I thought we needed to define new DAG nodes for these ops, and I spent time working on that (much larger patch), but then I concluded that we don't need that. At least as a first step, we have all of the backend support necessary to match these ops...because it was required. And shepherding these through the IR optimizer is the primary concern, so the IR intrinsics are likely all that we'll ever need.

There was also a question about converting the intrinsics to the existing ROTL/ROTR DAG nodes (along with improving the oversized shift documentation). Again, I don't think that's strictly necessary (as the test results here prove). That can be an efficiency improvement as a small follow-up patch.

So all we're left with is documentation, definition of the IR intrinsics, and DAG builder support. I've included tests for AArch64, PowerPC, and x86 because those are the targets I'm most familiar with.


https://reviews.llvm.org/D49242

Files:
  docs/LangRef.rst
  include/llvm/IR/Intrinsics.td
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  test/CodeGen/AArch64/funnel-shift.ll
  test/CodeGen/PowerPC/funnel-shift.ll
  test/CodeGen/X86/funnel-shift.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49242.155179.patch
Type: text/x-patch
Size: 39413 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180712/c2a7a2df/attachment.bin>


More information about the llvm-commits mailing list