Commit Graph

27 Commits

Author SHA1 Message Date
Richard Henderson
672ce9397b re PR c++/60272 (atomic<>::compare_exchange_weak has spurious store and can cause race conditions)
PR c++/60272

gcc/
	* builtins.c (expand_builtin_atomic_compare_exchange): Conditionalize
	on failure the store back into EXPECT.
libatomic/
	* cas_n.c (libat_compare_exchange): Conditionalize on failure
	the store back to EPTR.

From-SVN: r207966
2014-02-20 09:43:53 -08:00
Richard Sandiford
3e6a2e378c Update copyright years in libatomic/
From-SVN: r206291
2014-01-02 22:24:30 +00:00
Uros Bizjak
1f71a3c34d ChangeLog: Fix ChangeLog entry.
* libatomic/ChangeLog: Fix ChangeLog entry.
	* libgcc/ChangeLog: Ditto.

From-SVN: r205812
2013-12-09 18:41:40 +01:00
Uros Bizjak
8b02e720d2 sfp-exceptions.c (__sfp_handle_exceptions): Emit SSE instructions when __TARGET_SSE__ is defined.
libgcc/ChangeLog:

2013-12-09  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/sfp-exceptions.c (__sfp_handle_exceptions): Emit SSE
	instructions when __TARGET_SSE__ is defined.

libatomic/ChangeLog:

2013-12-09  Uros Bizjak  <ubizjak@gmail.com>

	* config/x86/fenv.c (__atomic_feraiseexcept): Emit SSE
	instructions when __TARGET_SSE__ is defined.

From-SVN: r205811
2013-12-09 18:37:43 +01:00
Joseph Myers
a2ca7c8cb9 atomic-compare-exchange-1.c, [...]: Declare main as returning int.
* testsuite/libatomic.c/atomic-compare-exchange-1.c,
	testsuite/libatomic.c/atomic-compare-exchange-2.c,
	testsuite/libatomic.c/atomic-compare-exchange-3.c,
	testsuite/libatomic.c/atomic-compare-exchange-4.c,
	testsuite/libatomic.c/atomic-compare-exchange-5.c,
	testsuite/libatomic.c/atomic-exchange-1.c,
	testsuite/libatomic.c/atomic-exchange-2.c,
	testsuite/libatomic.c/atomic-exchange-3.c,
	testsuite/libatomic.c/atomic-exchange-4.c,
	testsuite/libatomic.c/atomic-exchange-5.c,
	testsuite/libatomic.c/atomic-generic.c,
	testsuite/libatomic.c/atomic-load-1.c,
	testsuite/libatomic.c/atomic-load-2.c,
	testsuite/libatomic.c/atomic-load-3.c,
	testsuite/libatomic.c/atomic-load-4.c,
	testsuite/libatomic.c/atomic-load-5.c,
	testsuite/libatomic.c/atomic-op-1.c,
	testsuite/libatomic.c/atomic-op-2.c,
	testsuite/libatomic.c/atomic-op-3.c,
	testsuite/libatomic.c/atomic-op-4.c,
	testsuite/libatomic.c/atomic-op-5.c,
	testsuite/libatomic.c/atomic-store-1.c,
	testsuite/libatomic.c/atomic-store-2.c,
	testsuite/libatomic.c/atomic-store-3.c,
	testsuite/libatomic.c/atomic-store-4.c,
	testsuite/libatomic.c/atomic-store-5.c: Declare main as returning
	int.  Do not require built-in sync support or add target-specific
	options.
	* testsuite/libatomic.c/atomic-exchange-1.c,
	testsuite/libatomic.c/atomic-exchange-2.c,
	testsuite/libatomic.c/atomic-exchange-3.c,
	testsuite/libatomic.c/atomic-exchange-4.c,
	testsuite/libatomic.c/atomic-exchange-5.c: Separate increments of
	count from expression using value of count.

From-SVN: r204953
2013-11-18 14:50:11 +00:00
Uros Bizjak
6fbf987777 fenv.c: New file.
* config/x86/fenv.c: New file.

From-SVN: r204634
2013-11-10 12:45:42 +01:00
Joseph Myers
267bac1078 tree-core.h (enum cv_qualifier): Add TYPE_QUAL_ATOMIC.
gcc:
2013-11-05  Andrew MacLeod  <amacleod@redhat.com>
	    Joseph Myers  <joseph@codesourcery.com>

	* tree-core.h (enum cv_qualifier): Add TYPE_QUAL_ATOMIC.
	(enum tree_index): Add TI_ATOMICQI_TYPE, TI_ATOMICHI_TYPE,
	TI_ATOMICSI_TYPE, TI_ATOMICDI_TYPE and TI_ATOMICTI_TYPE.
	(struct tree_base): Add atomic_flag field.
	* tree.h (TYPE_ATOMIC): New accessor macro.
	(TYPE_QUALS, TYPE_QUALS_NO_ADDR_SPACE): Add TYPE_QUAL_ATOMIC.
	(TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC): New macro.
	(atomicQI_type_node, atomicHI_type_node, atomicSI_type_node)
	(atomicDI_type_node, atomicTI_type_node): New macros for type
	nodes.
	* tree.c (set_type_quals): Set TYPE_ATOMIC.
	(find_atomic_core_type): New function.
	(build_qualified_type): Adjust alignment for qualified types.
	(build_atomic_base): New function
	(build_common_tree_nodes): Build atomicQI_type_node,
	atomicHI_type_node, atomicSI_type_node, atomicDI_type_node and
	atomicTI_type_node.
	* print-tree.c (print_node): Print atomic qualifier.
	* tree-pretty-print.c (dump_generic_node): Print atomic type
	attribute.
	* target.def (atomic_assign_expand_fenv): New hook.
	* doc/tm.texi.in (TARGET_ATOMIC_ASSIGN_EXPAND_FENV): New @hook.
	* doc/tm.texi: Regenerate.
	* targhooks.c (default_atomic_assign_expand_fenv): New function.
	* targhooks.h (default_atomic_assign_expand_fenv): Declare.
	* sync-builtins.def (__atomic_feraiseexcept): New built-in
	function.
	* config/i386/i386-builtin-types.def (VOID_FTYPE_PUSHORT): New
	function type.
	* config/i386/i386.c (enum ix86_builtins): Add
	IX86_BUILTIN_FNSTENV, IX86_BUILTIN_FLDENV, IX86_BUILTIN_FNSTSW and
	IX86_BUILTIN_FNCLEX.
	(bdesc_special_args): Add __builtin_ia32_fnstenv,
	__builtin_ia32_fldenv, __builtin_ia32_fnstsw and
	__builtin_ia32_fnclex.
	(ix86_expand_builtin): Handle the new built-in functions.
	(ix86_atomic_assign_expand_fenv): New function.
	(TARGET_ATOMIC_ASSIGN_EXPAND_FENV): New macro.
	* config/i386/i386.md (UNSPECV_FNSTENV, UNSPECV_FLDENV)
	(UNSPECV_FNSTSW, UNSPECV_FNCLEX): New unspecs.
	(fnstenv, fldenv, fnstsw, fnclex): New insns.

gcc/c-family:
2013-11-05  Andrew MacLeod  <amacleod@redhat.com>
	    Joseph Myers  <joseph@codesourcery.com>

	* c-common.h (enum rid): Add RID_ATOMIC.
	* c-common.c (c_common_reswords): Add _Atomic.
	(sync_resolve_params): Use TYPE_MAIN_VARIANT on pointer argument.
	(keyword_is_type_qualifier): Accept RID_ATOMIC.
	* c-format.c (check_format_types): Check for extra _Atomic
	qualifiers in format argument.
	* c-pretty-print.c (pp_c_cv_qualifiers): Handle atomic qualifier.
	(pp_c_type_qualifier_list): Mention _Atomic in comment.

gcc/c:
2013-11-05  Joseph Myers  <joseph@codesourcery.com>
	    Andrew MacLeod  <amacleod@redhat.com>

	* c-aux-info.c (gen_type): Handle atomic qualifier.
	* c-decl.c (validate_proto_after_old_defn): Do not remove atomic
	qualifiers when compating types.
	(shadow_tag_warned): Handle atomic_p in declspecs.
	(quals_from_declspecs): Likewise.
	(start_decl): Use c_type_promotes_to when promoting argument
	types.
	(grokdeclarator): Handle _Atomic.
	(get_parm_info): Diagnose any qualifier on "void" as only
	parameter.
	(store_parm_decls_oldstyle): Do not remove atomic qualifiers when
	comparing types.  Use c_type_promotes_to when promoting argument
	types.
	(finish_function): Use c_type_promotes_to when promoting argument
	types.
	(build_null_declspecs): Handle atomic_p in declspecs.
	(declspecs_add_qual): Handle RID_ATOMIC.
	* c-parser.c (c_token_starts_typename, c_token_is_qualifier)
	(c_token_starts_declspecs): Handle RID_ATOMIC.
	(c_parser_declspecs): Handle atomic type specifiers and
	qualifiers.
	(c_parser_typeof_specifier): Remove const and _Atomic qualifiers
	from types of expressions with atomic type.
	(c_parser_direct_declarator_inner): Use convert_lvalue_to_rvalue.
	(c_parser_attribute_any_word): Handle RID_ATOMIC.
	(c_parser_initializer, c_parser_initelt, c_parser_initval)
	(c_parser_statement_after_labels, c_parser_switch_statement)
	(c_parser_for_statement, c_parser_expr_no_commas)
	(c_parser_conditional_expression, c_parser_binary_expression)
	(c_parser_cast_expression, c_parser_unary_expression)
	(c_parser_postfix_expression)
	(c_parser_postfix_expression_after_primary, c_parser_expression):
	Use convert_lvalue_to_rvalue.
	(c_parser_expression_conv, c_parser_expr_list): Document
	conversion of lvalues to rvalues.  Use convert_lvalue_to_rvalue.
	(c_parser_objc_synchronized_statement): Use
	convert_lvalue_to_rvalue.
	(c_parser_objc_selector): Handle RID_ATOMIC.
	(c_parser_objc_receiver, c_parser_array_notation): Use
	convert_lvalue_to_rvalue.
	* c-tree.h (ctsk_typeof): Adjust comment to mention use for
	_Atomic (type-name).
	(struct c_declspecs): Add atomic_p field.
	(convert_lvalue_to_rvalue): Declare.
	* c-typeck.c (c_type_promotes_to): Promote atomic types to
	corresponding atomic types.
	(qualify_type): Don't add _Atomic qualifiers from second argument.
	(comp_target_types): Do not allow _Atomic mismatches.
	(type_lists_compatible_p): Do not remove atomic qualifiers when
	comparing types.
	(really_atomic_lvalue, convert_lvalue_to_rvalue)
	(build_atomic_assign): New functions.
	(build_unary_op): Use build_atomic_assign for atomic increment and
	decrement.
	(build_conditional_expr): Do not treat _Atomic void as a qualified
	version of void.
	(build_modify_expr): Use build_atomic_assign for atomic LHS.
	(find_anonymous_field_with_type, convert_to_anonymous_field)
	(convert_for_assignment): Do not remove atomic qualifiers when
	comparing types.
	(digest_init): Do not accept initialization of arrays of atomic
	elements by string constants.
	(build_asm_expr): Use convert_lvalue_to_rvalue.
	(build_binary_op): Do not treat _Atomic void as a qualified
	version of void.

gcc/objc:
2013-11-05  Andrew MacLeod  <amacleod@redhat.com>

	* objc-act.c (objc_push_parm): Handle atomic qualifier.

gcc/testsuite:
2013-11-05  Joseph Myers  <joseph@codesourcery.com>

	* lib/target-supports.exp
	(check_effective_target_fenv_exceptions): New function.
	* lib/atomic-dg.exp, gcc.dg/atomic/atomic.exp: New files.
	* gcc.dg/atomic/c11-atomic-exec-1.c,
	gcc.dg/atomic/c11-atomic-exec-2.c,
	gcc.dg/atomic/c11-atomic-exec-3.c,
	gcc.dg/atomic/c11-atomic-exec-4.c,
	gcc.dg/atomic/c11-atomic-exec-5.c, gcc.dg/c11-atomic-1.c,
	gcc.dg/c11-atomic-2.c, gcc.dg/c11-atomic-3.c,
	gcc.dg/c90-atomic-1.c, gcc.dg/c99-atomic-1.c: New tests.

libatomic:
2013-11-05  Joseph Myers  <joseph@codesourcery.com>

	* fenv.c: New file.
	* libatomic.map (LIBATOMIC_1.1): New symbol version.  Include
	__atomic_feraiseexcept.
	* configure.ac (libtool_VERSION): Change to 2:0:1.
	(fenv.h): Test for header.
	* Makefile.am (libatomic_la_SOURCES): Add fenv.c.
	* Makefile.in, auto-config.h.in, configure: Regenerate.

From-SVN: r204544
2013-11-07 21:15:25 +00:00
Michael Hudson-Doyle
a115cf9c95 [AArch64] Enable building libatomic on AArch64.
From-SVN: r203774
2013-10-17 15:49:27 +00:00
Alan Modra
3cbe17f7de libtool.m4 (_LT_ENABLE_LOCK <ld -m flags>): Remove non-canonical ppc host match.
* libtool.m4 (_LT_ENABLE_LOCK <ld -m flags>): Remove non-canonical
	ppc host match.  Support little-endian powerpc linux hosts.
Regenerate configure throughout.

From-SVN: r202773
2013-09-20 19:17:52 +09:30
Andi Kleen
94f3ccc8d9 Avoid non constant memory model uses in libatomic
x86 ends up using non constant memory models for some of the libatomic
functions. These all end up as __ATOMIC_SEQ_CST. Just use this
directly. This avoids a new warning for non constant memory
models, which broke the bootstrap with -Werror

Passed bootstrap and test on x86_64-linux.

libatomic/:

2013-03-23  Andi Kleen  <ak@linux.intel.com>

	* gcas.c: (EXACT_INLINE): Use __ATOMIC_SEQ_CST.
	* gexch.c: (EXACT_INLINE): Use __ATOMIC_SEQ_CST.
	* gload.c: (EXACT_INLINE): Use __ATOMIC_SEQ_CST.
	* gstore.c: (EXACT_INLINE): Use __ATOMIC_SEQ_CST.

diff --git a/libatomic/gcas.c b/libatomic/gcas.c
index edbf611..e3d77f3 100644
--- a/libatomic/gcas.c
+++ b/libatomic/gcas.c
@@ -32,7 +32,7 @@
 # define EXACT_INLINE(N)					\
   if (C2(HAVE_ATOMIC_CAS_,N))					\
     return __atomic_compare_exchange_n				\
-      (PTR(N,mptr), PTR(N,eptr), *PTR(N,dptr), false, smodel, fmodel)
+      (PTR(N,mptr), PTR(N,eptr), *PTR(N,dptr), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
 #else
 # define EXACT_INLINE(N)
 #endif
diff --git a/libatomic/gexch.c b/libatomic/gexch.c
index 1999067..c8c8658 100644
--- a/libatomic/gexch.c
+++ b/libatomic/gexch.c
@@ -33,7 +33,7 @@
   if (C2(HAVE_ATOMIC_EXCHANGE_,N))				\
     {								\
       *PTR(N,rptr) = __atomic_exchange_n			\
-	(PTR(N,mptr), *PTR(N,vptr), smodel);			\
+	(PTR(N,mptr), *PTR(N,vptr), __ATOMIC_SEQ_CST);		\
       return;							\
     }
 #else
diff --git a/libatomic/gload.c b/libatomic/gload.c
index df318d5..85865bd 100644
--- a/libatomic/gload.c
+++ b/libatomic/gload.c
@@ -32,7 +32,7 @@
 # define EXACT_INLINE(N, DEST, SRC, DONE)			\
   if (C2(HAVE_ATOMIC_LDST_,N))					\
     {								\
-      DEST = __atomic_load_n (SRC, smodel);			\
+      DEST = __atomic_load_n (SRC, __ATOMIC_SEQ_CST);		\
       DONE;							\
     }
 #else
diff --git a/libatomic/gstore.c b/libatomic/gstore.c
index d571e58..84f9a8d 100644
--- a/libatomic/gstore.c
+++ b/libatomic/gstore.c
@@ -32,7 +32,7 @@
 # define EXACT_INLINE(N)					\
   if (C2(HAVE_ATOMIC_LDST_,N))					\
     {								\
-      __atomic_store_n (PTR(N,mptr), *PTR(N,vptr), smodel);	\
+      __atomic_store_n (PTR(N,mptr), *PTR(N,vptr), __ATOMIC_SEQ_CST);	\
       return;							\
     }
 #else

From-SVN: r197017
2013-03-24 00:23:10 +00:00
Richard Sandiford
69b2c4233b Update copyright years in libatomic.
From-SVN: r195164
2013-01-14 18:16:23 +00:00
Ian Lance Taylor
36749a1fe6 re PR go/55201 (libgo.so: undefined reference to `__atomic_compare_exchange_8')
PR go/55201
	* Makefile.am (noinst_LTLIBRARIES): Define new make variable.
	(libatomic_convenience_la_SOURCES): Likewise.
	(libatomic_convenience_la_LIBADD): Likewise.
	* Makefile.in: Rebuild.
	* testsuite/Makefile.in: Rebuild.

From-SVN: r194592
2012-12-18 22:04:08 +00:00
Marcus Shawcroft
408d29950d libatomic: Detect and build for ARM architecture armv8-a.
2012-12-04  Marcus Shawcroft  <marcus.shawcroft@arm.com>

	* config/arm/arm-config.h (__ARM_ARCH_8A__): New.

From-SVN: r194150
2012-12-04 15:14:47 +00:00
Matthias Klose
5eb4cb4768 configure.tgt (i[3456]86): Handle -mx32 like -m64.
2012-11-21  Matthias Klose  <doko@ubuntu.com>

        * configure.tgt (i[3456]86): Handle -mx32 like -m64.

From-SVN: r193720
2012-11-22 00:47:58 +00:00
Thomas Schwinge
4044815128 acinclude.m4 (LIBAT_CHECK_IFUNC): Clarify message.
libatomic/
	* acinclude.m4 (LIBAT_CHECK_IFUNC): Clarify message.
	* configure: Regenerate.

From-SVN: r193145
2012-11-05 00:27:03 +01:00
Thomas Schwinge
b9efc87730 configure: Regenerate.
libatomic/
	* configure: Regenerate.

libitm/
	* configure: Regenerate.

From-SVN: r193144
2012-11-05 00:17:34 +01:00
Sofiane Naci
34f8442ee2 AArch64 [6/10]
2012-10-23  Sofiane Naci <sofiane.naci@arm.com>

	Mark libatomic unsupported in AArch64.

	* configure.tgt: Mark libatomic unsupported.

From-SVN: r192727
2012-10-23 17:22:48 +00:00
Jakub Jelinek
c0758df921 re PR other/43620 ([4.3 Release Blocker] Uploading to gnu.org will fail due to automake security issue)
PR other/43620
libatomic/
	* configure.ac (AM_INIT_AUTOMAKE): Add no-dist.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
libitm/
	* configure.ac (AM_INIT_AUTOMAKE): Add no-dist.
	* configure: Regenerate.
	* Makefile.in: Regenerate.

From-SVN: r191565
2012-09-20 16:41:17 +02:00
David Edelsohn
00c2f0ef6d * configure: Regenerated.
From-SVN: r191319
2012-09-14 19:30:29 -04:00
John David Anglin
917344232c re PR other/53231 (libatomic/tas_n.c💯10: error: 'ret' undeclared (first use in this function))
PR other/53231
	* tas_n.c (libat_test_and_set): Correct return.  Remove unused variable.

From-SVN: r187783
2012-05-22 23:54:32 +00:00
H.J. Lu
e6d5f8c9c4 Regenerate configure files for libtool.m4 change
boehm-gc/

	* configure: Regenerated.

gcc/

	* configure: Regenerated.

libatomic/

	* configure: Regenerated.

libffi/

	* configure: Regenerated.

libgfortran/

	* configure: Regenerated.

libgomp/

	* configure: Regenerated.

libitm/

	* configure: Regenerated.

libjava/classpath/

	* configure: Regenerated.

libjava/

	* configure: Regenerated.

libmudflap/

	* configure: Regenerated.

libobjc/

	* configure: Regenerated.

libquadmath/

	* configure: Regenerated.

libssp/

	* configure: Regenerated.

libstdc++-v3/

	* configure: Regenerated.

lto-plugin/

	* configure: Regenerated.

zlib/

	* configure: Regenerated.

From-SVN: r187616
2012-05-16 15:11:18 -07:00
Rainer Orth
aaea76b3af Always compile atomic builtin tests with $XCFLAGS
PR other/53284
	* acinclude.m4 (LIBAT_TEST_ATOMIC_BUILTIN): Add -O0 -S to CFLAGS
	instead of overriding.
	* configure: Regenerate.

From-SVN: r187366
2012-05-10 09:11:05 +00:00
Rainer Orth
527eeee5b3 Allow for objects in libatomic_la_LIBADD
* Makefile.am (libatomic.map-sun): Handle objects in
	libatomic_la_LIBADD.
	* aclocal.m4: Regenerate.
	* Makefile.in: Regenerate.

From-SVN: r187257
2012-05-07 16:11:14 +00:00
Rainer Orth
e9885be5c6 Don't include XCFLAGS in CFLAGS
* configure.ac: Add $XPCFLAGS to CFLAGS, not $XCFLAGS.
	* configure: Regenerate.

From-SVN: r187256
2012-05-07 16:10:11 +00:00
Richard Henderson
fa3cd3c37e libatomic: Enable AM_MAINTAINER_MODE
From-SVN: r187108
2012-05-03 09:30:11 -07:00
Richard Henderson
0fe5522f8b acinclude.m4 (LIBAT_TEST_ATOMIC_BUILTIN): Handle compilation failure in gcc_no_link path.
* acinclude.m4 (LIBAT_TEST_ATOMIC_BUILTIN): Handle compilation
        failure in gcc_no_link path.
        * configure: Rebuild.

From-SVN: r187102
2012-05-03 08:59:43 -07:00
Richard Henderson
483104922a Add libatomic as a target library.
From-SVN: r187018
2012-05-01 08:48:28 -07:00