[cfe-commits] r51137 - /cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Nate Begeman natebegeman at mac.com
Thu May 15 00:38:04 PDT 2008


Author: sampo
Date: Thu May 15 02:38:03 2008
New Revision: 51137

URL: http://llvm.org/viewvc/llvm-project?rev=51137&view=rev
Log:
Handle a couple missing builtins that will go away eventually when the various
intrin.h files are finished

Modified:
    cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=51137&r1=51136&r2=51137&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu May 15 02:38:03 2008
@@ -280,7 +280,8 @@
     return RValue::get(Builder.CreateCall(AtomF, &Args[0], &Args[1]+2));
   }
   case Builtin::BI__sync_lock_test_and_set:
-    return EmitBinaryAtomic(*this, Intrinsic::atomic_swap, E);  }
+    return EmitBinaryAtomic(*this, Intrinsic::atomic_swap, E);
+  }
   return RValue::get(0);
 }
 
@@ -504,6 +505,20 @@
     llvm::Function *F = CGM.getIntrinsic(ID);
     return Builder.CreateCall(F, &Ops[0], &Ops[0] + Ops.size(), name);  
   }
+  case X86::BI__builtin_ia32_pshuflw: {
+    unsigned i = cast<ConstantInt>(Ops[1])->getZExtValue();
+    return EmitShuffleVector(Ops[0], Ops[0], 
+                             i & 0x3, (i & 0xc) >> 2,
+                             (i & 0x30) >> 4, (i & 0xc0) >> 6, 4, 5, 6, 7,
+                             "pshuflw");
+  }
+  case X86::BI__builtin_ia32_pshufhw: {
+    unsigned i = cast<ConstantInt>(Ops[1])->getZExtValue();
+    return EmitShuffleVector(Ops[0], Ops[0], 0, 1, 2, 3,
+                             4 + (i & 0x3), 4 + ((i & 0xc) >> 2),
+                             4 + ((i & 0x30) >> 4), 4 + ((i & 0xc0) >> 6),
+                             "pshufhw");
+  }
   case X86::BI__builtin_ia32_pshufd: {
     unsigned i = cast<ConstantInt>(Ops[1])->getZExtValue();
     return EmitShuffleVector(Ops[0], Ops[0], 





More information about the cfe-commits mailing list