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

Sanjay Patel spatel at rotateright.com
Fri Mar 6 09:15:57 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));
+
----------------
chandlerc wrote:
> 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.
I had no idea about std::iota. This would apparently be the first use of it anywhere in LLVM!

But if using it is an NFC, do you mind if I do that in a follow-on patch?

Although this raises another question that I had: what is the life expectancy of the AutoUpgrade code? Once we turn off the tap to create these intrinsics in clang, I assume this will be an even colder code path than it already is. 

Do we make any guarantees on backward support for deprecated intrinsics? Could we delete this after the next release?

http://reviews.llvm.org/D8086

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






More information about the llvm-commits mailing list