[PATCH] [SLPVectorizer] Reorder operands of shufflevector if it can result in a vectorized code.

Karthik Bhat kv.bhat at samsung.com
Thu Jan 8 21:39:35 PST 2015


Hi Arnold,
Please find my comments inline. I will add more documentation to the function if this looks good with you.
Thanks and Regards
Karthik Bhat


REPOSITORY
  rL LLVM

================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:441
@@ -440,2 +440,3 @@
   bool isConsecutiveAccess(Value *A, Value *B);
 
+  void reorderAltShuffleOperands(ArrayRef<Value *> VL,
----------------
aschwaighofer wrote:
> Why does that only apply to altShuffle operands shouldn't this work on any commutative binary vector operation?
Hi Arnold,
The reason why we applied reorderAltShuffleOperands to altShuffle operands is that in case of code such as-
    fc[0] = fa[0]+ fb[0]; 
    fc[1] = fb[1]+fa[1];  // operands have been swapped in code.
    fc[2] = fa[2]+fb[2];
    fc[3] = fa[3]+fb[3];

It already gets vectorized and reordring happens in reorderInputsAccordingToOpcode function.

But reorderInputsAccordingToOpcode cannot be called in case of AltShuffleOperands as all operations used in AltShuffleOperands are not commuitative (i.e. add is commutiative but sub is not). Hence we added reorderAltShuffleOperands to handle ordering in case of shuffle vector with alt opcode.

http://reviews.llvm.org/D6677

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






More information about the llvm-commits mailing list