[PATCH] D59391: [X86] Add post-isel pseudos for rotate by immediate using SHLD/SHRD

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 14 15:11:47 PDT 2019


craig.topper created this revision.
craig.topper added reviewers: RKSimon, spatel, efriedma.
Herald added a subscriber: jdoerfert.

Haswell CPUs have special support for SHLD/SHRD with the same register for both sources. Such an instruction will go to the rotate/shift unit on port 0 or 6. This gives it 1 cycle latency and 0.5 cycle reciprocal throughput. When the register is not the same, it becomes a 3 cycle operation on port 1. Sandybridge and Ivybridge always have 1 cyc latency and 0.5 cycle reciprocal throughput for any SHLD.

When FastSHLDRotate feature flag is set, we try to use SHLD for rotate by immediate unless BMI2 is enabled. But MachineCopyPropagation can look through a copy and change one of the sources to be different. This will break the hardware optimization.

This patch adds psuedo instruction to hide the second source input until after register allocation and MachineCopyPropagation. I'm not sure if this is the best way to do this or if there's some other way we can make this work.

Fixes PR41055


https://reviews.llvm.org/D59391

Files:
  lib/Target/X86/X86InstrInfo.cpp
  lib/Target/X86/X86InstrShiftRotate.td
  test/CodeGen/X86/rot32.ll
  test/CodeGen/X86/rot64.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59391.190734.patch
Type: text/x-patch
Size: 7318 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190314/9d2e99b9/attachment.bin>


More information about the llvm-commits mailing list