[PATCH] [X86] replace vinsertf128 intrinsics with generic shuffles

Chandler Carruth chandlerc at gmail.com
Thu Mar 5 12:52:00 PST 2015


================
Comment at: lib/IR/AutoUpgrade.cpp:644-649
@@ +643,8 @@
+      // Extend the second operand into a vector that is twice as big.
+      Value *UndefV = UndefValue::get(Op1->getType());
+      SmallVector<Constant*, 8> Idxs;
+      for (unsigned i = 0; i != NumElts; ++i) {
+        Idxs.push_back(Builder.getInt32(i));
+      }
+      Rep = Builder.CreateShuffleVector(Op1, UndefV, ConstantVector::get(Idxs));
+
----------------
I think you should teach the CreateShuffleVector method to also accept a array ref of ints and to use the -1 -> undef, mapping to produce the constants for you. Then you can use std::iota to remove all the loops in this code.

http://reviews.llvm.org/D8086

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






More information about the llvm-commits mailing list