diff options
author | torvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-09 17:04:40 +0000 |
---|---|---|
committer | torvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-09 17:04:40 +0000 |
commit | 5b35a7918cc42521165f68f4fe3975e25103c798 (patch) | |
tree | 9fd7bd08f877808bd7bb4eb601fd7482c9c85d6f /libitm/retry.cc | |
parent | 024c1ad598b7c9037f5417f56e367f7dd6b6ea45 (diff) | |
download | gcc-5b35a7918cc42521165f68f4fe3975e25103c798.tar.gz |
Add HTM fastpath and use Intel RTM for it on x86.
* beginend.cc (htm_fastpath): New.
(gtm_thread::begin_transaction, _ITM_commitTransaction,
_ITM_commitTransactionEH): Add HTM fastpath handling.
* config/linux/rwlock.h (gtm_rwlock.is_write_locked): New.
* config/posix/rwlock.h (gtm_rwlock.is_write_locked): New.
* config/x86/target.h (htm_available, htm_init, htm_begin_success,
htm_begin, htm_commit, htm_abort, htm_abort_should_retry): New.
* configure.tgt: Add -mrtm to XCFLAGS.
* method-serial.cc (htm_mg, o_htm_mg, htm_dispatch, dispatch_htm): New.
(gtm_thread::serialirr_mode): Add HTM fastpath handling.
* libitm_i.h (htm_fastpath, dispatch_htm): Declare.
* retry.cc (parse_default_method): Add HTM method parsing.
(gtm_thread::number_of_threads_changed): Use HTM by default if
available.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193369 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libitm/retry.cc')
-rw-r--r-- | libitm/retry.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libitm/retry.cc b/libitm/retry.cc index 172419bb803..bb7a1f574a1 100644 --- a/libitm/retry.cc +++ b/libitm/retry.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc. +/* Copyright (C) 2008, 2009, 2011, 2012 Free Software Foundation, Inc. Contributed by Richard Henderson <rth@redhat.com>. This file is part of the GNU Transactional Memory Library (libitm). @@ -254,6 +254,11 @@ parse_default_method() disp = GTM::dispatch_ml_wt(); env += 5; } + else if (strncmp(env, "htm", 3) == 0) + { + disp = GTM::dispatch_htm(); + env += 3; + } else goto unknown; @@ -311,7 +316,15 @@ GTM::gtm_thread::number_of_threads_changed(unsigned previous, unsigned now) set_default_dispatch(default_dispatch_user); else { - abi_dispatch* a = dispatch_ml_wt(); + // If HTM is available, use it by default with serial mode as + // fallback. Otherwise, use ml_wt because it probably scales best. + abi_dispatch* a; +#ifdef USE_HTM_FASTPATH + if (htm_available()) + a = dispatch_htm(); + else +#endif + a = dispatch_ml_wt(); if (a->supports(now)) set_default_dispatch(a); else |