[llvm-commits] [125255] Add support for initializing the vector.

bwendlin at apple.com bwendlin at apple.com
Fri Mar 23 01:09:18 PDT 2007


Revision: 125255
Author:   bwendlin
Date:     2007-03-23 01:09:17 -0700 (Fri, 23 Mar 2007)

Log Message:
-----------
Add support for initializing the vector. One thing which can be done
is to convert a vector of constants into an constant value and then move
that into the destination. This is what GCC does.

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp

Modified: apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp
===================================================================
--- apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp	2007-03-23 00:13:51 UTC (rev 125254)
+++ apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp	2007-03-23 08:09:17 UTC (rev 125255)
@@ -447,6 +447,29 @@
   case IX86_BUILTIN_MOVSLDUP:
     Result = BuildVectorShuffle(Ops[0], Ops[0], 0, 0, 2, 2);
     return true;
+  case IX86_BUILTIN_VEC_INIT_V2SI:
+    for (unsigned i = 0; i < 2; ++i)
+      Ops[i] = CastInst::createIntegerCast(Ops[i], Type::Int32Ty, false, "tmp",
+                                           CurBB);
+
+    Result = BuildVector(Ops[1], Ops[0], NULL);
+    return true;
+  case IX86_BUILTIN_VEC_INIT_V4HI:
+    for (unsigned i = 0; i < 4; ++i)
+      Ops[i] = CastInst::createIntegerCast(Ops[i], Type::Int16Ty, false, "tmp",
+                                           CurBB);
+
+    Result = BuildVector(Ops[3], Ops[2], Ops[1], Ops[0], NULL);
+    return true;
+  case IX86_BUILTIN_VEC_INIT_V8QI: {
+    for (unsigned i = 0; i < 8; ++i)
+      Ops[i] = CastInst::createIntegerCast(Ops[i], Type::Int8Ty, false, "tmp",
+                                           CurBB);
+
+    Result = BuildVector(Ops[7], Ops[6], Ops[5], Ops[4],
+                         Ops[3], Ops[2], Ops[1], Ops[0], NULL);
+    return true;
+  }
   case IX86_BUILTIN_VEC_EXT_V2DF:
   case IX86_BUILTIN_VEC_EXT_V4SI:
   case IX86_BUILTIN_VEC_EXT_V4SF:





More information about the llvm-commits mailing list