summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-05-13 04:46:13 +0000
committerChris Lattner <sabre@nondot.org>2009-05-13 04:46:13 +0000
commitafde259240593aaa60e334a4933604863edda543 (patch)
tree37fc1d04559c90e9ce156b6b619a40f2e64d051d /clang/lib
parent94578cba76882c7b20dd035e83235f6ae7d1e5b4 (diff)
downloadbcm5719-llvm-afde259240593aaa60e334a4933604863edda543.tar.gz
bcm5719-llvm-afde259240593aaa60e334a4933604863edda543.zip
implement __sync_synchronize and __sync_lock_release,
rdar://6880573 llvm-svn: 71637
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGBuiltin.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index bddbf4ca428..93901fd5359 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -470,11 +470,23 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
case Builtin::BI__sync_lock_release_2:
case Builtin::BI__sync_lock_release_4:
case Builtin::BI__sync_lock_release_8:
- case Builtin::BI__sync_lock_release_16:
- assert(0 && "FIXME: Implement");
+ case Builtin::BI__sync_lock_release_16: {
+ Value *Ptr = EmitScalarExpr(E->getArg(0));
+ const llvm::Type *ElTy =
+ cast<llvm::PointerType>(Ptr->getType())->getElementType();
+ Builder.CreateStore(llvm::Constant::getNullValue(ElTy), Ptr, true);
+ return RValue();
+ }
+ case Builtin::BI__sync_synchronize: {
+ Value *C[5];
+ C[0] = C[1] = C[2] = C[3] = llvm::ConstantInt::get(llvm::Type::Int1Ty, 1);
+ C[4] = ConstantInt::get(llvm::Type::Int1Ty, 0);
+ Builder.CreateCall(CGM.getIntrinsic(Intrinsic::memory_barrier), C, C + 5);
+ return RValue();
+ }
+
// Library functions with special handling.
-
case Builtin::BIsqrt:
case Builtin::BIsqrtf:
case Builtin::BIsqrtl: {
OpenPOWER on IntegriCloud