* 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
+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.
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;
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
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
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