Commit Graph

31 Commits

Author SHA1 Message Date
Torvald Riegel 6041f70ae3 libitm: Fix HTM fastpath.
* beginend.cc (GTM::gtm_thread::serial_lock): Put on cacheline
	boundary.
	(htm_fastpath): Remove.
	(gtm_thread::begin_transaction): Fix HTM fastpath.
	(_ITM_commitTransaction): Adapt.
	(_ITM_commitTransactionEH): Adapt.
	* libitm/config/linux/rwlock.h (gtm_rwlock): Add htm_fastpath member
	and accessors.
	* libitm/config/posix/rwlock.h (gtm_rwlock): Likewise.
	* libitm/config/posix/rwlock.cc (gtm_rwlock::gtm_rwlock): Adapt.
	* libitm/config/x86/sjlj.S (_ITM_beginTransaction): Fix HTM fastpath.
	* libitm/libitm_i.h (htm_fastpath): Remove declaration.
	* libitm/method-serial.cc (htm_mg): Adapt.
	(gtm_thread::serialirr_mode): Adapt.
	* libitm/query.cc (_ITM_inTransaction, _ITM_getTransactionId): Adapt.

From-SVN: r232735
2016-01-22 16:13:06 +00:00
Richard Henderson b1de98e3d9 re PR target/69343 (Bootstrap failure on s390{,x}-linux)
PR bootstrap/69343
PR bootstrap/69339
PR tree-opt/68964

Revert:
gcc/
  * tree.c (tm_define_builtin): New.
  (find_tm_vector_type): New.
  (build_tm_vector_builtins): New.
  (build_common_builtin_nodes): Call it.
libitm/
  * Makefile.am (libitm_la_SOURCES) [ARCH_AARCH64]: Add vect128.cc
  (libitm_la_SOURCES) [ARCH_ARM]: Add neon.cc
  (libitm_la_SOURCES) [ARCH_PPC]: Add vect128.cc
  (libitm_la_SOURCES) [ARCH_S390]: Add vect128.cc
  * configure.ac (ARCH_AARCH64): New conditional.
  (ARCH_PPC, ARCH_S390): Likewise.
  * Makefile.in, configure: Rebuild.
  * libitm.h (_ITM_TYPE_M128): Always define.
  * vect64.cc: Split ...
  * vect128.cc: ... out of...
  * config/x86/x86_sse.cc: ... here.
  * config/arm/neon.cc: New file.

From-SVN: r232631
2016-01-20 10:53:56 -08:00
Richard Henderson 4c868789e4 re PR target/68964 (Internal compiler error for test case gcc.dg/tm/20100610.c since r231674)
PR 68964

gcc/
 PR tree-opt/68964
 * target.def (builtin_tm_load, builtin_tm_store): Remove.
 * config/i386/i386.c (ix86_builtin_tm_load): Remove.
 (ix86_builtin_tm_store): Remove.
 (TARGET_VECTORIZE_BUILTIN_TM_LOAD): Remove.
 (TARGET_VECTORIZE_BUILTIN_TM_STORE): Remove.
 * doc/tm.texi.in (TARGET_VECTORIZE_BUILTIN_TM_LOAD): Remove.
 (TARGET_VECTORIZE_BUILTIN_TM_STORE): Remove.
 * doc/tm.texi: Rebuild.
 * gtm-builtins.def (BUILT_IN_TM_MEMCPY_RNWT): New.
 (BUILT_IN_TM_MEMCPY_RTWN): New.
 * trans-mem.c (tm_log_emit_stmt): Rearrange code for better
 fallback from vector to integer helpers.
 (build_tm_load): Handle vector types directly, instead of
 via target hook.
 (build_tm_store): Likewise.
 (expand_assign_tm): Prepare for register types not handled by
 the above.  Copy them to memory and use memcpy.
 * tree.c (tm_define_builtin): New.
 (find_tm_vector_type): New.
 (build_tm_vector_builtins): New.
 (build_common_builtin_nodes): Call it.

libitm/
 * Makefile.am (libitm_la_SOURCES) [ARCH_AARCH64]: Add vect128.cc
 (libitm_la_SOURCES) [ARCH_ARM]: Add neon.cc
 (libitm_la_SOURCES) [ARCH_PPC]: Add vect128.cc
 (libitm_la_SOURCES) [ARCH_S390]: Add vect128.cc
 * configure.ac (ARCH_AARCH64): New conditional.
 (ARCH_PPC, ARCH_S390): Likewise.
 * Makefile.in, configure: Rebuild.
 * libitm.h (_ITM_TYPE_M128): Always define.
 * vect64.cc: Split ...
 * vect128.cc: ... out of...
 * config/x86/x86_sse.cc: ... here.
 * config/arm/neon.cc: New file.

From-SVN: r232330
2016-01-13 09:03:42 -08:00
Torvald Riegel 0d1ed41261 libitm: Remove dead code and data.
From-SVN: r232275
2016-01-12 14:57:45 +00:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Jakub Jelinek 5624e564d2 Update copyright years.
From-SVN: r219188
2015-01-05 13:33:28 +01:00
Richard Henderson 84c2f4b068 libitm: Remove unused PAGE_SIZE macros
* config/alpha/target.h (PAGE_SIZE, FIXED_PAGE_SIZE): Remove.
        * config/arm/target.h, config/sh/target.h: Likewise.
        * config/sparc/target.h, config/x86/target.h: Likewise.

From-SVN: r209027
2014-04-02 10:49:36 -07:00
Richard Sandiford f93608e6d4 Update copyright years in libitm/
From-SVN: r206298
2014-01-02 22:26:00 +00:00
Torvald Riegel bec9ec3fc1 Add custom HTM fast path for RTM on x86_64.
* libitm_i.h (gtm_thread): Assign an asm name to serial_lock.
	(htm_fastpath): Assign an asm name.
	* libitm.h (_ITM_codeProperties): Add non-ABI flags used by custom
	HTM fast paths.
	(_ITM_actions): Likewise.
	* config/x86/target.h (HTM_CUSTOM_FASTPATH): Enable custom fastpath on
	x86_64.
	* config/x86/sjlj.S (_ITM_beginTransaction): Add custom HTM fast path.
	* config/posix/rwlock.h (gtm_rwlock): Update comments.  Move summary
	field to the start of the structure.
	* config/linux/rwlock.h (gtm_rwlock): Update comments.
	* beginend.cc (gtm_thread::begin_transaction): Add retry policy
	handling for custom HTM fast paths.

From-SVN: r202101
2013-08-30 10:33:41 +00:00
Torvald Riegel 480c696bb0 libitm: Handle HTM fastpath in status query functions.
* query.cc (_ITM_inTransaction): Abort when using the HTM fastpath.
	(_ITM_getTransactionId): Same.
	* config/x86/target.h (htm_transaction_active): New.

From-SVN: r200251
2013-06-20 16:40:54 +00:00
Richard Sandiford 75f9527c9b Update copyright in libitm.
From-SVN: r195697
2013-02-03 17:46:11 +00:00
Torvald Riegel 64fbcc74a3 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.

From-SVN: r193369
2012-11-09 17:04:40 +00:00
Uros Bizjak 0c609a2144 target.h (struct gtm_jmpbuf): Merge x86_64 and ia32 declarations some more.
* config/x86/target.h (struct gtm_jmpbuf): Merge x86_64
	and ia32 declarations some more.
	* config/x86/sjlj.S (_ITM_beginTransaction): Move ret to common code.

From-SVN: r191955
2012-10-02 09:50:36 +02:00
Uros Bizjak 68a12ef35b xmmintrin.h (_mm_sfence): Use __builtin_ia32_pause.
gcc/

2012-07-03  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/xmmintrin.h (_mm_sfence): Use __builtin_ia32_pause.

libgomp/

2012-07-03  Uros Bizjak  <ubizjak@gmail.com>

	* config/linux/x86/futex.h (cpu_relax): Use __builtin_ia32_pause.
	* testsuite/libgomp.c/sort-1.c (busy_wait): Ditto.

libitm/

2012-07-03  Uros Bizjak  <ubizjak@gmail.com>

	* config/x86/target.h (cpu_relax): Use __builtin_ia32_pause.

From-SVN: r189194
2012-07-03 09:24:10 +02:00
H.J. Lu 0100e3b3e8 Use long long in gtm_jmpbuf for x86-64
2012-04-04  H.J. Lu  <hongjiu.lu@intel.com>

	PR libitm/52854
	* config/x86/target.h (gtm_jmpbuf): Replace long with long long
	for x86-64.

From-SVN: r186140
2012-04-04 08:49:23 -07:00
Richard Henderson 72824d5e40 * config/x86/target.h (GTM_longjmp): Correct the .cfi corrections.
From-SVN: r184227
2012-02-14 11:46:46 -08:00
Uros Bizjak 1f319dbad6 target.h (GTM_longjmp): Correct .cfi directives.
* config/x86/target.h (GTM_longjmp): Correct .cfi directives.

From-SVN: r184220
2012-02-14 19:38:38 +01:00
Uros Bizjak d4a698d494 target.h (GTM_longjmp): Jump indirect from memory address.
* config/x86/target.h (GTM_longjmp): Jump indirect from memory address.

From-SVN: r184198
2012-02-14 08:50:38 +01:00
Uros Bizjak 9848887afa target.h (gtm_jmpbuf): Move rip to the end of structure.
* config/x86/target.h (gtm_jmpbuf) [__x86_64__]: Move rip to the
	end of structure.
	* config/x86/sjlj.S (_ITM_beginTransaction) [__x86_64__]: Update
	offset values.  Do not copy return address.  Decrement stack
	by 56 bytes only.
	(GTM_longjump) [__x86_64__]: Update offset values.

From-SVN: r183467
2012-01-24 08:23:57 +01:00
Uros Bizjak 5752c591bc re PR libitm/51830 (FAIL: libitm.c/mem(cpy|set)-1.c execution test)
PR libitm/51830
	* builtin-types.def (BT_FN_UINT_UINT_VAR): New.
	* gtm-builtins.def (BUILT_IN_TM_START): Declare as BT_FN_UINT_UINT_VAR.

libitm/ChangeLog:

	PR libitm/51830
	* config/x86/sjlj.S (_ITM_beginTransaction) [!__x86_64__]: Load
	the first function argument to %eax.

From-SVN: r183435
2012-01-23 15:57:44 +01:00
Richard Henderson 36cfbee133 libitm: Conversion to c++11 atomics.
* local_atomic: New file.
        * libitm_i.h: Include it.
        (gtm_thread::shared_state): Use atomic template.
        * beginend.cc (GTM::gtm_clock): Use atomic template.
        (global_tid): Use atomic template if 64-bit atomics available.
        (gtm_thread::gtm_thread): Update shared_state access.
        (gtm_thread::trycommit): Likewise.
        (choose_code_path): Update global_tid access.
        * method-gl.cc (gl_mg::orec): Use atomic template.  Update all users.
        * stmlock.h (GTM::gtm_clock): Use atomic template.
        (gtm_get_clock, gtm_inc_clock): Update accesses.
        * config/linux/rwlock.cc (gtm_rwlock::read_lock): Remove
        redundant __sync_synchronize after atomic shared_state access.
        * config/posix/rwlock.cc (gtm_rwlock::read_lock): Likewise.
        (gtm_rwlock::write_lock_generic): Likewise.
        (gtm_rwlock::read_unlock): Likewise.
        * config/alpha/target.h (atomic_read_barrier): Remove.
        (atomic_write_barrier): Remove.
        * config/x86/target.h (atomic_read_barrier): Remove.
        (atomic_write_barrier): Remove.

From-SVN: r182294
2011-12-13 11:11:25 -08:00
Richard Henderson 062f93f255 Swap the action and jmpbuf arguments to GTM_longjmp
On several ABIs, the first register parameter is the same as
the return value register.  Moving the action parameter first
avoids the need for register shuffling on these targets.

        * libitm_i.h (GTM_longjmp): Swap first and second arguments.
        * beginend.c (_ITM_abortTransaction): Update to match.
        (GTM::gtm_thread::restart): Likewise.
        * config/alpha/sjlj.S (GTM_longjmp): Likewise.
        * config/x86/sjlj.S (GTM_longjmp): Likewise.

From-SVN: r181863
2011-11-30 14:29:33 -08:00
Iain Sandoe 0b41ebef72 sjlj.S (CONCAT1, [...]): Respond to __USER_LABEL_PREFIX__ for targets that use it.
libitm:

	* config/x86/sjlj.S (CONCAT1, CONCAT2, SYM): Respond to
	__USER_LABEL_PREFIX__ for targets that use it.
	TYPE, SIZE, HIDDEN): New macros to assist on non-elf targets.
	(_ITM_beginTransaction): Use SYM, TYPE, SIZE macros to assist
	in portability to non-elf targets.
	(GTM_longjmp): LIkewise.
	* libitm_i.h (begin_transaction): Apply __USER_LABEL_PREFIX__
	where required.

From-SVN: r181612
2011-11-22 09:57:19 +00:00
Rainer Orth 59659b5967 Support libitm on Solaris 8 and 9/x86 with Sun as
* config/generic/asmcfi.h: Fix comment.
	* config/x86/sjlj.S (_ITM_beginTransaction): Provide ELF PIC code
	sequence without .hidden support, error for non-ELF targets.
	(GTM_longjmp) [__ELF__]: Only use .hidden if
	HAVE_ATTRIBUTE_VISIBILITY.

From-SVN: r181481
2011-11-18 16:15:59 +00:00
Richard Henderson d4b179020b libitm: Don't add -mavx if the assembler doesn't support avx.
* config/x86/x86_avx.cc: Remove #undef __AVX__ hack.  Tidy comments.
        * Makefile.am (x86_avx.lo): Only add -mavx if ARCH_X86_AVX.
        * configure.ac (ARCH_X86_AVX): New conditional.
        * Makefile.in, configure: Rebuild.

From-SVN: r181261
2011-11-10 09:09:04 -08:00
Richard Henderson 430616e7a7 libitm: Work around assembler missing AVX insns.
From-SVN: r181246
2011-11-09 16:29:38 -08:00
Richard Henderson 79b1edb6b5 libitm: Remove unused code.
In particular, unused code that's presenting portability problems.

From-SVN: r181241
2011-11-09 14:54:55 -08:00
Richard Henderson 8ee9fac21e libitm: Avoid non-portable x86 branch prediction mnemonic.
From-SVN: r181233
2011-11-09 11:51:49 -08:00
Richard Henderson 9bdc63433a libitm: de-ELF-ize x86/sjlj.S.
* config/x86/sjlj.S: Protect elf directives with __ELF__.
        Protect .note.GNU-stack with __linux__.

From-SVN: r181229
2011-11-09 10:38:21 -08:00
Richard Henderson 4bdd090f8e libitm: Configure for gas cfi pseudo ops.
* asmcfi.m4: New file.

	* configure.ac (GCC_AS_CFI_PSEUDO_OP): Test it.
	* configure, aclocal.m4, config.h.in: Rebuild.
	* config/generic/asmcfi.h: New file.
	* config/x86/sjlj.S: Use it.

From-SVN: r181224
2011-11-09 10:09:53 -08:00
Aldy Hernandez 0a35513e4e Merge from transactional-memory branch.
From-SVN: r181154
2011-11-08 11:13:41 +00:00