[llvm-branch-commits] [cfe-branch] r71670 - in /cfe/branches/Apple/Dib/lib: CodeGen/CGBuiltin.cpp Sema/SemaChecking.cpp

Mike Stump mrs at apple.com
Wed May 13 08:38:45 PDT 2009


Author: mrs
Date: Wed May 13 10:38:40 2009
New Revision: 71670

URL: http://llvm.org/viewvc/llvm-project?rev=71670&view=rev
Log:
Merge in 71636:

add support for __sync_nand_and_fetch and __sync_fetch_and_nand,
rdar://6880573

Modified:
    cfe/branches/Apple/Dib/lib/CodeGen/CGBuiltin.cpp
    cfe/branches/Apple/Dib/lib/Sema/SemaChecking.cpp

Modified: cfe/branches/Apple/Dib/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/CodeGen/CGBuiltin.cpp?rev=71670&r1=71669&r2=71670&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/branches/Apple/Dib/lib/CodeGen/CGBuiltin.cpp Wed May 13 10:38:40 2009
@@ -49,6 +49,11 @@
   Value *Ptr = CGF.EmitScalarExpr(E->getArg(0));
   Value *Operand = CGF.EmitScalarExpr(E->getArg(1));
   Value *Result = CGF.Builder.CreateCall2(AtomF, Ptr, Operand);
+  
+  if (Id == Intrinsic::atomic_load_nand)
+    Result = CGF.Builder.CreateNot(Result);
+  
+  
   return RValue::get(CGF.Builder.CreateBinOp(Op, Result, Operand));
 }
 
@@ -359,7 +364,13 @@
   case Builtin::BI__sync_fetch_and_xor_8:
   case Builtin::BI__sync_fetch_and_xor_16:
     return EmitBinaryAtomic(*this, Intrinsic::atomic_load_xor, E);
-  
+  case Builtin::BI__sync_fetch_and_nand_1:
+  case Builtin::BI__sync_fetch_and_nand_2:
+  case Builtin::BI__sync_fetch_and_nand_4:
+  case Builtin::BI__sync_fetch_and_nand_8:
+  case Builtin::BI__sync_fetch_and_nand_16:
+    return EmitBinaryAtomic(*this, Intrinsic::atomic_load_nand, E);
+      
   // Clang extensions: not overloaded yet.
   case Builtin::BI__sync_fetch_and_min:
     return EmitBinaryAtomic(*this, Intrinsic::atomic_load_min, E);
@@ -405,7 +416,14 @@
   case Builtin::BI__sync_xor_and_fetch_16:
     return EmitBinaryAtomicPost(*this, Intrinsic::atomic_load_xor, E,
                                 llvm::Instruction::Xor);
-
+  case Builtin::BI__sync_nand_and_fetch_1:
+  case Builtin::BI__sync_nand_and_fetch_2:
+  case Builtin::BI__sync_nand_and_fetch_4:
+  case Builtin::BI__sync_nand_and_fetch_8:
+  case Builtin::BI__sync_nand_and_fetch_16:
+    return EmitBinaryAtomicPost(*this, Intrinsic::atomic_load_nand, E,
+                                llvm::Instruction::And);
+      
   case Builtin::BI__sync_val_compare_and_swap_1:
   case Builtin::BI__sync_val_compare_and_swap_2:
   case Builtin::BI__sync_val_compare_and_swap_4:

Modified: cfe/branches/Apple/Dib/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Sema/SemaChecking.cpp?rev=71670&r1=71669&r2=71670&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Sema/SemaChecking.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Sema/SemaChecking.cpp Wed May 13 10:38:40 2009
@@ -144,11 +144,13 @@
   case Builtin::BI__sync_fetch_and_or:
   case Builtin::BI__sync_fetch_and_and:
   case Builtin::BI__sync_fetch_and_xor:
+  case Builtin::BI__sync_fetch_and_nand:
   case Builtin::BI__sync_add_and_fetch:
   case Builtin::BI__sync_sub_and_fetch:
   case Builtin::BI__sync_and_and_fetch:
   case Builtin::BI__sync_or_and_fetch:
   case Builtin::BI__sync_xor_and_fetch:
+  case Builtin::BI__sync_nand_and_fetch:
   case Builtin::BI__sync_val_compare_and_swap:
   case Builtin::BI__sync_bool_compare_and_swap:
   case Builtin::BI__sync_lock_test_and_set:
@@ -225,12 +227,14 @@
     BUILTIN_ROW(__sync_fetch_and_or),
     BUILTIN_ROW(__sync_fetch_and_and),
     BUILTIN_ROW(__sync_fetch_and_xor),
+    BUILTIN_ROW(__sync_fetch_and_nand),
     
     BUILTIN_ROW(__sync_add_and_fetch),
     BUILTIN_ROW(__sync_sub_and_fetch),
     BUILTIN_ROW(__sync_and_and_fetch),
     BUILTIN_ROW(__sync_or_and_fetch),
     BUILTIN_ROW(__sync_xor_and_fetch),
+    BUILTIN_ROW(__sync_nand_and_fetch),
     
     BUILTIN_ROW(__sync_val_compare_and_swap),
     BUILTIN_ROW(__sync_bool_compare_and_swap),
@@ -265,24 +269,26 @@
   case Builtin::BI__sync_fetch_and_or:  BuiltinIndex = 2; break;
   case Builtin::BI__sync_fetch_and_and: BuiltinIndex = 3; break;
   case Builtin::BI__sync_fetch_and_xor: BuiltinIndex = 4; break;
+  case Builtin::BI__sync_fetch_and_nand:BuiltinIndex = 5; break;
       
-  case Builtin::BI__sync_add_and_fetch: BuiltinIndex = 5; break;
-  case Builtin::BI__sync_sub_and_fetch: BuiltinIndex = 6; break;
-  case Builtin::BI__sync_and_and_fetch: BuiltinIndex = 7; break;
-  case Builtin::BI__sync_or_and_fetch:  BuiltinIndex = 8; break;
-  case Builtin::BI__sync_xor_and_fetch: BuiltinIndex = 9; break;
+  case Builtin::BI__sync_add_and_fetch: BuiltinIndex = 6; break;
+  case Builtin::BI__sync_sub_and_fetch: BuiltinIndex = 7; break;
+  case Builtin::BI__sync_and_and_fetch: BuiltinIndex = 8; break;
+  case Builtin::BI__sync_or_and_fetch:  BuiltinIndex = 9; break;
+  case Builtin::BI__sync_xor_and_fetch: BuiltinIndex =10; break;
+  case Builtin::BI__sync_nand_and_fetch:BuiltinIndex =11; break;
       
   case Builtin::BI__sync_val_compare_and_swap:
-    BuiltinIndex = 10;
+    BuiltinIndex = 12;
     NumFixed = 2;
     break;
   case Builtin::BI__sync_bool_compare_and_swap:
-    BuiltinIndex = 11;
+    BuiltinIndex = 13;
     NumFixed = 2;
     break;
-  case Builtin::BI__sync_lock_test_and_set: BuiltinIndex = 12; break;
+  case Builtin::BI__sync_lock_test_and_set: BuiltinIndex = 14; break;
   case Builtin::BI__sync_lock_release:
-    BuiltinIndex = 13;
+    BuiltinIndex = 15;
     NumFixed = 0;
     break;
   }





More information about the llvm-branch-commits mailing list