[cfe-commits] r99522 - in /cfe/trunk: include/clang/Basic/Builtins.def lib/CodeGen/CGBuiltin.cpp lib/Sema/SemaChecking.cpp test/CodeGen/atomic.c
Daniel Dunbar
daniel at zuster.org
Thu Mar 25 10:13:09 PDT 2010
Author: ddunbar
Date: Thu Mar 25 12:13:09 2010
New Revision: 99522
URL: http://llvm.org/viewvc/llvm-project?rev=99522&view=rev
Log:
Remove support for nand atomic builtins. They are inconsistently implemented in
gcc, and the common expectation seems to be that they are unused. If and when
someone cares we can add them back with well documented demantics.
Modified:
cfe/trunk/include/clang/Basic/Builtins.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/CodeGen/atomic.c
Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=99522&r1=99521&r2=99522&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Thu Mar 25 12:13:09 2010
@@ -397,13 +397,6 @@
BUILTIN(__sync_fetch_and_xor_8, "LLiLLi*LLi.", "n")
BUILTIN(__sync_fetch_and_xor_16, "LLLiLLLi*LLLi.", "n")
-BUILTIN(__sync_fetch_and_nand, "v.", "")
-BUILTIN(__sync_fetch_and_nand_1, "cc*c.", "n")
-BUILTIN(__sync_fetch_and_nand_2, "ss*s.", "n")
-BUILTIN(__sync_fetch_and_nand_4, "ii*i.", "n")
-BUILTIN(__sync_fetch_and_nand_8, "LLiLLi*LLi.", "n")
-BUILTIN(__sync_fetch_and_nand_16, "LLLiLLLi*LLLi.", "n")
-
BUILTIN(__sync_add_and_fetch, "v.", "")
BUILTIN(__sync_add_and_fetch_1, "cc*c.", "n")
@@ -440,14 +433,6 @@
BUILTIN(__sync_xor_and_fetch_8, "LLiLLi*LLi.", "n")
BUILTIN(__sync_xor_and_fetch_16, "LLLiLLLi*LLLi.", "n")
-BUILTIN(__sync_nand_and_fetch, "v.", "")
-BUILTIN(__sync_nand_and_fetch_1, "cc*c.", "n")
-BUILTIN(__sync_nand_and_fetch_2, "ss*s.", "n")
-BUILTIN(__sync_nand_and_fetch_4, "ii*i.", "n")
-BUILTIN(__sync_nand_and_fetch_8, "LLiLLi*LLi.", "n")
-BUILTIN(__sync_nand_and_fetch_16, "LLLiLLLi*LLLi.", "n")
-
-
BUILTIN(__sync_bool_compare_and_swap, "v.", "")
BUILTIN(__sync_bool_compare_and_swap_1, "bcD*cc.", "n")
BUILTIN(__sync_bool_compare_and_swap_2, "bsD*ss.", "n")
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=99522&r1=99521&r2=99522&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Mar 25 12:13:09 2010
@@ -81,10 +81,6 @@
Value *Args[2] = { CGF.EmitScalarExpr(E->getArg(0)),
CGF.EmitScalarExpr(E->getArg(1)) };
Value *Result = EmitCallWithBarrier(CGF, AtomF, Args, Args + 2);
-
- if (Id == Intrinsic::atomic_load_nand)
- Result = CGF.Builder.CreateNot(Result);
-
return RValue::get(CGF.Builder.CreateBinOp(Op, Result, Args[1]));
}
@@ -550,12 +546,6 @@
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:
@@ -602,13 +592,6 @@
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:
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=99522&r1=99521&r2=99522&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Mar 25 12:13:09 2010
@@ -184,13 +184,11 @@
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:
@@ -304,14 +302,12 @@
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),
@@ -346,26 +342,24 @@
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 = 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_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_val_compare_and_swap:
- BuiltinIndex = 12;
+ BuiltinIndex = 10;
NumFixed = 2;
break;
case Builtin::BI__sync_bool_compare_and_swap:
- BuiltinIndex = 13;
+ BuiltinIndex = 11;
NumFixed = 2;
break;
- case Builtin::BI__sync_lock_test_and_set: BuiltinIndex = 14; break;
+ case Builtin::BI__sync_lock_test_and_set: BuiltinIndex = 12; break;
case Builtin::BI__sync_lock_release:
- BuiltinIndex = 15;
+ BuiltinIndex = 13;
NumFixed = 0;
break;
}
Modified: cfe/trunk/test/CodeGen/atomic.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/atomic.c?rev=99522&r1=99521&r2=99522&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/atomic.c (original)
+++ cfe/trunk/test/CodeGen/atomic.c Thu Mar 25 12:13:09 2010
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin9 > %t1
-// RUN: grep @llvm.memory.barrier %t1 | count 42
+// RUN: grep @llvm.memory.barrier %t1 | count 38
// RUN: grep @llvm.atomic.load.add.i32 %t1 | count 3
// RUN: grep @llvm.atomic.load.sub.i8 %t1 | count 2
// RUN: grep @llvm.atomic.load.min.i32 %t1
@@ -8,7 +8,7 @@
// RUN: grep @llvm.atomic.load.umax.i32 %t1
// RUN: grep @llvm.atomic.swap.i32 %t1
// RUN: grep @llvm.atomic.cmp.swap.i32 %t1 | count 4
-// RUN: grep @llvm.atomic.load.and.i32 %t1 | count 2
+// RUN: grep @llvm.atomic.load.and.i32 %t1
// RUN: grep @llvm.atomic.load.or.i8 %t1
// RUN: grep @llvm.atomic.load.xor.i8 %t1
@@ -34,14 +34,12 @@
old = __sync_fetch_and_and(&val, 0x9);
old = __sync_fetch_and_or(&val, 0xa);
old = __sync_fetch_and_xor(&val, 0xb);
- old = __sync_fetch_and_nand(&val, 0xb);
old = __sync_add_and_fetch(&val, 1);
old = __sync_sub_and_fetch(&val, 2);
old = __sync_and_and_fetch(&valc, 3);
old = __sync_or_and_fetch(&valc, 4);
old = __sync_xor_and_fetch(&valc, 5);
- old = __sync_nand_and_fetch(&valc, 5);
__sync_val_compare_and_swap((void **)0, (void *)0, (void *)0);
More information about the cfe-commits
mailing list