public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug libstdc++/14311] New: builtins for atomic operations needed @ 2004-02-27 0:39 bkoz at gcc dot gnu dot org 2004-04-27 19:05 ` [Bug c/14311] " pinskia at gcc dot gnu dot org ` (7 more replies) 0 siblings, 8 replies; 9+ messages in thread From: bkoz at gcc dot gnu dot org @ 2004-02-27 0:39 UTC (permalink / raw) To: gcc-bugs See: http://gcc.gnu.org/ml/libstdc++/2004-02/msg00372.html Currently, the atomicity.h functions are used by: %grep "atomicity.h" include/*/*.h | grep include include/bits/basic_string.h:#include <bits/atomicity.h> include/bits/ios_base.h:#include <bits/atomicity.h> include/bits/locale_classes.h:#include <bits/atomicity.h> include/ext/mt_allocator.h:#include <bits/atomicity.h> include/ext/pool_allocator.h:#include <bits/atomicity.h> This includes reference counting in std::string, std::ios_base callbacks, std::locale::facet and std::locale::_Impl, and in various allocator classes. Although considered useful, this implementation has one drawback: on one popular platform, (x86/linux), switching between atomicity files for i386 and i486 and above is not compatible. Thus, when using i486 and above libstdc++, all C++ applications (and thus C++ packages in an os distribution) have to be compiled for both i386 and i486+. I believe this has been an issue for Red Hat, Debian, and perhaps BSD. One way around this would be to make these atomic functions gcc builtins. These would be different semantics than other gcc builtins, however, because there could be no fall back to a support library in the case of failure to use the builtin. Another would be to not define these functions in headers, and instead put them into libstdc++.so, version them, and then export them. See the attached patch, which was discussed in last week's tools conference call. With this, linux distributions for i386 could use -- Summary: builtins for atomic operations needed Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bkoz at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14311 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/14311] builtins for atomic operations needed 2004-02-27 0:39 [Bug libstdc++/14311] New: builtins for atomic operations needed bkoz at gcc dot gnu dot org @ 2004-04-27 19:05 ` pinskia at gcc dot gnu dot org 2005-04-09 3:09 ` [Bug middle-end/14311] " rth at gcc dot gnu dot org ` (6 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-04-27 19:05 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-27 18:57 ------- Confirmed, there are some builtins without a function to fall back on. -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Component|libstdc++ |c Ever Confirmed| |1 Last reconfirmed|0000-00-00 00:00:00 |2004-04-27 18:57:47 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14311 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14311] builtins for atomic operations needed 2004-02-27 0:39 [Bug libstdc++/14311] New: builtins for atomic operations needed bkoz at gcc dot gnu dot org 2004-04-27 19:05 ` [Bug c/14311] " pinskia at gcc dot gnu dot org @ 2005-04-09 3:09 ` rth at gcc dot gnu dot org 2005-04-09 7:53 ` pcarlini at suse dot de ` (5 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: rth at gcc dot gnu dot org @ 2005-04-09 3:09 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From rth at gcc dot gnu dot org 2005-04-09 03:09 ------- I'm working on atomic builtins, but this will *not* resolve the problem of compiling for i386 and i486+. Indeed, it could easily make it worse because you won't have the kind of control you did before wrt hiding these operations in out-of-line functions. -- What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |rth at gcc dot gnu dot org |dot org | Status|NEW |ASSIGNED Last reconfirmed|2005-03-26 05:33:24 |2005-04-09 03:09:22 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14311 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14311] builtins for atomic operations needed 2004-02-27 0:39 [Bug libstdc++/14311] New: builtins for atomic operations needed bkoz at gcc dot gnu dot org 2004-04-27 19:05 ` [Bug c/14311] " pinskia at gcc dot gnu dot org 2005-04-09 3:09 ` [Bug middle-end/14311] " rth at gcc dot gnu dot org @ 2005-04-09 7:53 ` pcarlini at suse dot de 2005-04-09 8:10 ` pcarlini at suse dot de ` (4 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: pcarlini at suse dot de @ 2005-04-09 7:53 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pcarlini at suse dot de 2005-04-09 07:53 ------- Can you expand a bit on that? I understand perfectly that we are not going to have CAS for i386, but what's wrong with i486+?!? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14311 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14311] builtins for atomic operations needed 2004-02-27 0:39 [Bug libstdc++/14311] New: builtins for atomic operations needed bkoz at gcc dot gnu dot org ` (2 preceding siblings ...) 2005-04-09 7:53 ` pcarlini at suse dot de @ 2005-04-09 8:10 ` pcarlini at suse dot de 2005-04-11 17:14 ` bkoz at redhat dot com ` (3 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: pcarlini at suse dot de @ 2005-04-09 8:10 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pcarlini at suse dot de 2005-04-09 08:10 ------- Ah, ok, now I got it ;) Actually, you meant exactly that i386 will *never* be exchangeable with i486+... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14311 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14311] builtins for atomic operations needed 2004-02-27 0:39 [Bug libstdc++/14311] New: builtins for atomic operations needed bkoz at gcc dot gnu dot org ` (3 preceding siblings ...) 2005-04-09 8:10 ` pcarlini at suse dot de @ 2005-04-11 17:14 ` bkoz at redhat dot com 2005-04-14 23:38 ` cvs-commit at gcc dot gnu dot org ` (2 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: bkoz at redhat dot com @ 2005-04-11 17:14 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From bkoz at redhat dot com 2005-04-11 17:14 ------- Subject: Re: builtins for atomic operations needed > I'm working on atomic builtins, but this will *not* resolve the problem of > compiling for i386 and i486+. Indeed, it could easily make it worse because > you won't have the kind of control you did before wrt hiding these operations > in out-of-line functions. Hurray. I really think that the builtin solution is the right way forward for everybody, design-wise. Thanks for doing this Richard. Pre gcc-3.4, we had the same problem with i386/i486+ separation. I think, realistically, that i486 compilation should be a minimum requirement for linux distros circa 2005. (If not i586.). Thus, the solution I will be in favor of is eliminating i386 compatibility with the version of the toolchain that first implements the atomic builtins. For people that really want to support i386, they should use gcc-2.7 to gcc-3.4. -benjamin -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14311 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14311] builtins for atomic operations needed 2004-02-27 0:39 [Bug libstdc++/14311] New: builtins for atomic operations needed bkoz at gcc dot gnu dot org ` (4 preceding siblings ...) 2005-04-11 17:14 ` bkoz at redhat dot com @ 2005-04-14 23:38 ` cvs-commit at gcc dot gnu dot org 2005-04-16 2:07 ` cvs-commit at gcc dot gnu dot org 2005-04-16 2:08 ` rth at gcc dot gnu dot org 7 siblings, 0 replies; 9+ messages in thread From: cvs-commit at gcc dot gnu dot org @ 2005-04-14 23:38 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-04-14 23:37 ------- Subject: Bug 14311 CVSROOT: /cvs/gcc Module name: gcc Changes by: rth@gcc.gnu.org 2005-04-14 23:37:47 Modified files: gcc : ChangeLog builtin-types.def builtins.c builtins.def c-common.c c-common.h c-typeck.c expr.c expr.h genopinit.c optabs.c optabs.h gcc/doc : extend.texi md.texi Added files: gcc/testsuite/gcc.c-torture/compile: sync-1.c gcc/testsuite/gcc.dg: sync-1.c Log message: PR middle-end/14311 * builtin-types.def (BT_BOOL, BT_VOLATILE_PTR, BT_I1, BT_I2, BT_I4, BT_I8, BT_FN_VOID_VPTR, BT_FN_I1_VPTR_I1, BT_FN_I2_VPTR_I2, BT_FN_I4_VPTR_I4, BT_FN_I8_VPTR_I8, BT_FN_BOOL_VPTR_I1_I1, BT_FN_BOOL_VPTR_I2_I2, BT_FN_BOOL_VPTR_I4_I4, BT_FN_BOOL_VPTR_I8_I8, BT_FN_I1_VPTR_I1_I1, BT_FN_I2_VPTR_I2_I2, BT_FN_I4_VPTR_I4_I4, BT_FN_I8_VPTR_I8_I8): New. * builtins.def (DEF_SYNC_BUILTIN): New. (BUILT_IN_FETCH_AND_ADD_N, BUILT_IN_FETCH_AND_ADD_1, BUILT_IN_FETCH_AND_ADD_2, BUILT_IN_FETCH_AND_ADD_4, BUILT_IN_FETCH_AND_ADD_8, BUILT_IN_FETCH_AND_SUB_N, BUILT_IN_FETCH_AND_SUB_1, BUILT_IN_FETCH_AND_SUB_2, BUILT_IN_FETCH_AND_SUB_4, BUILT_IN_FETCH_AND_SUB_8, BUILT_IN_FETCH_AND_OR_N, BUILT_IN_FETCH_AND_OR_1, BUILT_IN_FETCH_AND_OR_2, BUILT_IN_FETCH_AND_OR_4, BUILT_IN_FETCH_AND_OR_8, BUILT_IN_FETCH_AND_AND_N, BUILT_IN_FETCH_AND_AND_1, BUILT_IN_FETCH_AND_AND_2, BUILT_IN_FETCH_AND_AND_4, BUILT_IN_FETCH_AND_AND_8, BUILT_IN_FETCH_AND_XOR_N, BUILT_IN_FETCH_AND_XOR_1, BUILT_IN_FETCH_AND_XOR_2, BUILT_IN_FETCH_AND_XOR_4, BUILT_IN_FETCH_AND_XOR_8, BUILT_IN_FETCH_AND_NAND_N, BUILT_IN_FETCH_AND_NAND_1, BUILT_IN_FETCH_AND_NAND_2, BUILT_IN_FETCH_AND_NAND_4, BUILT_IN_FETCH_AND_NAND_8, BUILT_IN_ADD_AND_FETCH_N, BUILT_IN_ADD_AND_FETCH_1, BUILT_IN_ADD_AND_FETCH_2, BUILT_IN_ADD_AND_FETCH_4, BUILT_IN_ADD_AND_FETCH_8, BUILT_IN_SUB_AND_FETCH_N, BUILT_IN_SUB_AND_FETCH_1, BUILT_IN_SUB_AND_FETCH_2, BUILT_IN_SUB_AND_FETCH_4, BUILT_IN_SUB_AND_FETCH_8, BUILT_IN_OR_AND_FETCH_N, BUILT_IN_OR_AND_FETCH_1, BUILT_IN_OR_AND_FETCH_2, BUILT_IN_OR_AND_FETCH_4, BUILT_IN_OR_AND_FETCH_8, BUILT_IN_AND_AND_FETCH_N, BUILT_IN_AND_AND_FETCH_1, BUILT_IN_AND_AND_FETCH_2, BUILT_IN_AND_AND_FETCH_4, BUILT_IN_AND_AND_FETCH_8, BUILT_IN_XOR_AND_FETCH_N, BUILT_IN_XOR_AND_FETCH_1, BUILT_IN_XOR_AND_FETCH_2, BUILT_IN_XOR_AND_FETCH_4, BUILT_IN_XOR_AND_FETCH_8, BUILT_IN_NAND_AND_FETCH_N, BUILT_IN_NAND_AND_FETCH_1, BUILT_IN_NAND_AND_FETCH_2, BUILT_IN_NAND_AND_FETCH_4, BUILT_IN_NAND_AND_FETCH_8, BUILT_IN_BOOL_COMPARE_AND_SWAP_N, BUILT_IN_BOOL_COMPARE_AND_SWAP_1, BUILT_IN_BOOL_COMPARE_AND_SWAP_2, BUILT_IN_BOOL_COMPARE_AND_SWAP_4, BUILT_IN_BOOL_COMPARE_AND_SWAP_8, BUILT_IN_VAL_COMPARE_AND_SWAP_N, BUILT_IN_VAL_COMPARE_AND_SWAP_1, BUILT_IN_VAL_COMPARE_AND_SWAP_2, BUILT_IN_VAL_COMPARE_AND_SWAP_4, BUILT_IN_VAL_COMPARE_AND_SWAP_8, BUILT_IN_LOCK_TEST_AND_SET_N, BUILT_IN_LOCK_TEST_AND_SET_1, BUILT_IN_LOCK_TEST_AND_SET_2, BUILT_IN_LOCK_TEST_AND_SET_4, BUILT_IN_LOCK_TEST_AND_SET_8, BUILT_IN_LOCK_RELEASE_N, BUILT_IN_LOCK_RELEASE_1, BUILT_IN_LOCK_RELEASE_2, BUILT_IN_LOCK_RELEASE_4, BUILT_IN_LOCK_RELEASE_8, BUILT_IN_SYNCHRONIZE: New. * builtins.c (called_as_built_in): Rewrite from CALLED_AS_BUILT_IN as a function. Accept __sync_ as a prefix as well. (expand_builtin_sync_operation, expand_builtin_compare_and_swap, expand_builtin_lock_test_and_set, expand_builtin_synchronize, expand_builtin_lock_release): New. (expand_builtin): Call them. * c-common.c (DEF_BUILTIN): Don't require __builtin_ prefix if neither BOTH_P nor FALLBACK_P are defined. (builtin_type_for_size): New. (sync_resolve_size, sync_resolve_params, sync_resolve_return): New. (resolve_overloaded_builtin): New. * c-common.h (resolve_overloaded_builtin): Declare. (builtin_type_for_size): Declare. * c-typeck.c (build_function_call): Invoke resolve_overloaded_builtin. * expr.c (sync_add_optab, sync_sub_optab, sync_ior_optab, sync_and_optab, sync_xor_optab, sync_nand_optab, sync_old_add_optab, sync_old_sub_optab, sync_old_ior_optab, sync_old_and_optab, sync_old_xor_optab, sync_old_nand_optab, sync_new_add_optab, sync_new_sub_optab, sync_new_ior_optab, sync_new_and_optab, sync_new_xor_optab, sync_new_nand_optab, sync_compare_and_swap, sync_compare_and_swap_cc, sync_lock_test_and_set, sync_lock_release): New. * optabs.h: Declare them. * expr.h (expand_val_compare_and_swap, expand_bool_compare_and_swap, expand_sync_operation, expand_sync_fetch_operation, expand_sync_lock_test_and_set): Declare. * genopinit.c (optabs): Add sync optabs. * optabs.c (init_optabs): Initialize sync optabs. (expand_val_compare_and_swap_1, expand_val_compare_and_swap, expand_bool_compare_and_swap, expand_compare_and_swap_loop, expand_sync_operation, expand_sync_fetch_operation, expand_sync_lock_test_and_set): New. * doc/extend.texi (Atomic Builtins): New section * doc/md.texi (Standard Names): Add sync patterns. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8294&r2=2.8295 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtin-types.def.diff?cvsroot=gcc&r1=1.30&r2=1.31 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.c.diff?cvsroot=gcc&r1=1.452&r2=1.453 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.def.diff?cvsroot=gcc&r1=1.101&r2=1.102 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.621&r2=1.622 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.h.diff?cvsroot=gcc&r1=1.283&r2=1.284 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.431&r2=1.432 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.c.diff?cvsroot=gcc&r1=1.783&r2=1.784 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.h.diff?cvsroot=gcc&r1=1.186&r2=1.187 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/genopinit.c.diff?cvsroot=gcc&r1=1.91&r2=1.92 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/optabs.c.diff?cvsroot=gcc&r1=1.270&r2=1.271 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/optabs.h.diff?cvsroot=gcc&r1=1.54&r2=1.55 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/extend.texi.diff?cvsroot=gcc&r1=1.250&r2=1.251 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/md.texi.diff?cvsroot=gcc&r1=1.128&r2=1.129 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/sync-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/sync-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14311 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14311] builtins for atomic operations needed 2004-02-27 0:39 [Bug libstdc++/14311] New: builtins for atomic operations needed bkoz at gcc dot gnu dot org ` (5 preceding siblings ...) 2005-04-14 23:38 ` cvs-commit at gcc dot gnu dot org @ 2005-04-16 2:07 ` cvs-commit at gcc dot gnu dot org 2005-04-16 2:08 ` rth at gcc dot gnu dot org 7 siblings, 0 replies; 9+ messages in thread From: cvs-commit at gcc dot gnu dot org @ 2005-04-16 2:07 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-04-16 02:07 ------- Subject: Bug 14311 CVSROOT: /cvs/gcc Module name: gcc Changes by: rth@gcc.gnu.org 2005-04-16 02:07:33 Modified files: gcc/cp : ChangeLog semantics.c Added files: gcc/testsuite/g++.dg/ext: sync-1.C sync-2.C Log message: PR middle-end/14311 * semantics.c (finish_call_expr): Call resolve_overloaded_builtin. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4707&r2=1.4708 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.467&r2=1.468 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/sync-1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/sync-2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14311 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14311] builtins for atomic operations needed 2004-02-27 0:39 [Bug libstdc++/14311] New: builtins for atomic operations needed bkoz at gcc dot gnu dot org ` (6 preceding siblings ...) 2005-04-16 2:07 ` cvs-commit at gcc dot gnu dot org @ 2005-04-16 2:08 ` rth at gcc dot gnu dot org 7 siblings, 0 replies; 9+ messages in thread From: rth at gcc dot gnu dot org @ 2005-04-16 2:08 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From rth at gcc dot gnu dot org 2005-04-16 02:08 ------- Middle-end bits are done. Target maintainers need to update md files for new patterns, but i686 and ia64 are done. -- What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED Target Milestone|--- |4.1.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14311 ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-04-16 2:08 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-02-27 0:39 [Bug libstdc++/14311] New: builtins for atomic operations needed bkoz at gcc dot gnu dot org 2004-04-27 19:05 ` [Bug c/14311] " pinskia at gcc dot gnu dot org 2005-04-09 3:09 ` [Bug middle-end/14311] " rth at gcc dot gnu dot org 2005-04-09 7:53 ` pcarlini at suse dot de 2005-04-09 8:10 ` pcarlini at suse dot de 2005-04-11 17:14 ` bkoz at redhat dot com 2005-04-14 23:38 ` cvs-commit at gcc dot gnu dot org 2005-04-16 2:07 ` cvs-commit at gcc dot gnu dot org 2005-04-16 2:08 ` rth at gcc dot gnu dot org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).