Define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL
authorRichard Henderson <rth@redhat.com>
Thu, 26 Jan 2012 21:48:27 +0000 (13:48 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 26 Jan 2012 21:48:27 +0000 (13:48 -0800)
        * target.def (TARGET_ATOMIC_TEST_AND_SET_TRUEVAL): New.
        * c-cppbuiltin.c (cpp_atomic_builtins): Define
        __GCC_ATOMIC_TEST_AND_SET_TRUEVAL.
        * doc/tm.texi.in (TARGET_ATOMIC_TEST_AND_SET_TRUEVAL): Add doc hook.
        * doc/tm.texi: Rebuild.

From-SVN: r183581

gcc/ChangeLog
gcc/c-family/c-cppbuiltin.c
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/target.def

index 0e81d1af04e80c1b02acc7a7c8f886ec7c5b92ed..bbe300f6f6043686c950fc866abf663fc8efac24 100644 (file)
@@ -1,3 +1,11 @@
+2012-01-27  Richard Henderson  <rth@redhat.com>
+
+       * target.def (TARGET_ATOMIC_TEST_AND_SET_TRUEVAL): New.
+       * c-cppbuiltin.c (cpp_atomic_builtins): Define
+       __GCC_ATOMIC_TEST_AND_SET_TRUEVAL.
+       * doc/tm.texi.in (TARGET_ATOMIC_TEST_AND_SET_TRUEVAL): Add doc hook.
+       * doc/tm.texi: Rebuild.
+
 2012-01-27  Richard Henderson  <rth@redhat.com>
 
        * optabs.c (gen_atomic_test_and_set): Remove default.
index 7e7b9c158767813309bd3051d4a2b147f7522650..608dba6ecd42decc80e87f0fcdbe7959c13df42d 100644 (file)
@@ -670,6 +670,11 @@ cpp_atomic_builtins (cpp_reader *pfile)
   builtin_define_with_int_value ("__GCC_ATOMIC_LLONG_LOCK_FREE", 
                (have_swap[SWAP_INDEX (long_long_integer_type_node)]? 2 : 1));
 
+  /* If we're dealing with a "set" value that doesn't exactly correspond
+     to a boolean truth value, let the library work around that.  */
+  builtin_define_with_int_value ("__GCC_ATOMIC_TEST_AND_SET_TRUEVAL",
+                                targetm.atomic_test_and_set_trueval);
+
   /* ptr_type_node can't be used here since ptr_mode is only set when
      toplev calls backend_init which is not done with -E  or pch.  */
   psize = POINTER_SIZE / BITS_PER_UNIT;
index ceb0d1ea4dec5b469af947cf1b7d4c323c67e40c..91e4b047fe53465903cdea3f63cbdcd04308f471 100644 (file)
@@ -11359,3 +11359,7 @@ value of @code{TARGET_CONST_ANCHOR} is a power of 2.  For example, on
 MIPS, where add-immediate takes a 16-bit signed value,
 @code{TARGET_CONST_ANCHOR} is set to @samp{0x8000}.  The default value
 is zero, which disables this optimization.  @end deftypevr
+
+@deftypevr {Target Hook} {unsigned char} TARGET_ATOMIC_TEST_AND_SET_TRUEVAL
+This value should be set if the result written by @code{atomic_test_and_set} is not exactly 1, i.e. the @code{bool} @code{true}.
+@end deftypevr
index 55c8432c3bf1ea1d9ec80f4dd3e3e666f89e2ccc..0ebc15d5ebfd8a897ae18ac2443cd97ef8f16939 100644 (file)
@@ -11237,3 +11237,5 @@ value of @code{TARGET_CONST_ANCHOR} is a power of 2.  For example, on
 MIPS, where add-immediate takes a 16-bit signed value,
 @code{TARGET_CONST_ANCHOR} is set to @samp{0x8000}.  The default value
 is zero, which disables this optimization.  @end deftypevr
+
+@hook TARGET_ATOMIC_TEST_AND_SET_TRUEVAL
index f86f782b0209bcd2f3b6bb2133d6d3ec2fdfdd5a..6084b21dca54eb76324af79833c2fb490a8063b4 100644 (file)
@@ -2667,6 +2667,13 @@ DEFHOOK
  enum unwind_info_type, (void),
  default_debug_unwind_info)
 
+DEFHOOKPOD
+(atomic_test_and_set_trueval,
+ "This value should be set if the result written by\
+ @code{atomic_test_and_set} is not exactly 1, i.e. the\
+ @code{bool} @code{true}.",
+ unsigned char, 1)
 /* Leave the boolean fields at the end.  */
 
 /* True if we can create zeroed data by switching to a BSS section