[PATCH] [PPC64LE] Remove unnecessary swaps from lane-insensitive vector computations

Eric Christopher echristo at gmail.com
Mon Mar 30 13:52:36 PDT 2015


As far as the option you can have a backend option to turn the pass on and off, see the aarch64 port for more information there.


REPOSITORY
  rL LLVM

================
Comment at: lib/Target/PowerPC/PPCVSXSwapRemoval.cpp:204
@@ +203,3 @@
+
+  const int InitialVectorSize(256);
+  SwapVector.clear();
----------------
wschmidt wrote:
> echristo wrote:
> > 256?
> Hey, a magic constant.  That's why I gave it a name. :)  Picking an initial vector size to avoid too many reallocations while keeping the size reasonable.  Yes, it's a wet thumb to the breeze...
Did you use science to figure it out (i.e. see what numbers would generally work etc) or just WAG?

================
Comment at: lib/Target/PowerPC/PPCVSXSwapRemoval.cpp:251
@@ +250,3 @@
+      switch(MI->getOpcode()) {
+      default:
+        // Unless noted otherwise, an instruction is considered
----------------
wschmidt wrote:
> echristo wrote:
> > What instructions not listed are you thinking here?
> A vast number of lane-insensitive instructions.  All of the vector math, logical, select, etc.  Everything that's true SIMD.
Comment then? Just because there's another long list below so...

================
Comment at: lib/Target/PowerPC/PPCVSXSwapRemoval.cpp:614
@@ +613,3 @@
+
+        for (MachineInstr &UseMI : MRI->use_nodbg_instructions(DefReg)) {
+          int UseIdx = SwapMap[&UseMI];
----------------
wschmidt wrote:
> echristo wrote:
> > Good point, what _does_ this do for debug info? :)
> It doesn't do anything, but it doesn't need to.  When the load or store is initially expanded, its location information goes on the LXVD2X and XXPERMDI instructions, or on the XXPERMDI and STXVD2X instructions.  This pass removes the XXPERMDI instructions, but the location information remains with the LXVD2X or STXVD2X.
That's what I thought, just making sure.

================
Comment at: lib/Target/PowerPC/PPCVSXSwapRemoval.cpp:646
@@ +645,3 @@
+// here.
+void PPCVSXSwapRemoval::handleSpecialSwappables(int EntryIdx) {
+}
----------------
wschmidt wrote:
> echristo wrote:
> > ?
> As noted in the overall patch commentary, there are non-pure-SIMD instructions for which we can still perform this optimization, provided we change code generation for those instructions.  My plan is to fill in this function with the details in future patches.  The initial patch is for the "simple" part (which covers a great many cases).
Sounds good.

http://reviews.llvm.org/D8565

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list