summaryrefslogtreecommitdiff
path: root/libitm
diff options
context:
space:
mode:
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-27 07:44:11 +0000
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-27 07:44:11 +0000
commit5ada7a142c1df1fad051c42f408d84df72a06b4c (patch)
tree9714280940ee187c9f5b17b68759e4465c6c3296 /libitm
parentdd2f8b8cc6e4bfcf12a484c55e5d289e9c218862 (diff)
downloadgcc-5ada7a142c1df1fad051c42f408d84df72a06b4c.tar.gz
2013-06-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* config/s390/s390.c: Rename UNSPEC_CCU_TO_INT to UNSPEC_STRCMPCC_TO_INT and UNSPEC_CCZ_TO_INT to UNSPEC_CC_TO_INT. (struct machine_function): Add tbegin_p. (s390_canonicalize_comparison): Fold CC mode compares to conditional jump if possible. (s390_emit_jump): Return the emitted jump. (s390_branch_condition_mask, s390_branch_condition_mnemonic): Handle CCRAWmode compares. (s390_option_override): Default to -mhtm if available. (s390_reg_clobbered_rtx): Handle floating point regs as well. (s390_regs_ever_clobbered): Use s390_regs_ever_clobbered also for FPRs instead of df_regs_ever_live_p. (s390_optimize_nonescaping_tx): New function. (s390_init_frame_layout): Extend clobbered_regs array to cover FPRs as well. (s390_emit_prologue): Call s390_optimize_nonescaping_tx. (s390_expand_tbegin): New function. (enum s390_builtin): New enum definition. (code_for_builtin): New array definition. (s390_init_builtins): New function. (s390_expand_builtin): New function. (TARGET_INIT_BUILTINS): Define. (TARGET_EXPAND_BUILTIN): Define. * common/config/s390/s390-common.c (processor_flags_table): Add PF_TX. * config/s390/predicates.md (s390_comparison): Handle CCRAWmode. (s390_alc_comparison): Likewise. * config/s390/s390-modes.def: Add CCRAWmode. * config/s390/s390.h (processor_flags): Add PF_TX. (TARGET_CPU_HTM): Define macro. (TARGET_HTM): Define macro. (TARGET_CPU_CPP_BUILTINS): Define __HTM__ for htm. * config/s390/s390.md: Rename UNSPEC_CCU_TO_INT to UNSPEC_STRCMPCC_TO_INT and UNSPEC_CCZ_TO_INT to UNSPEC_CC_TO_INT. (UNSPECV_TBEGIN, UNSPECV_TBEGINC, UNSPECV_TEND, UNSPECV_TABORT) (UNSPECV_ETND, UNSPECV_NTSTG, UNSPECV_PPA): New unspecv enum values. (TBEGIN_MASK, TBEGINC_MASK): New constants. ("*cc_to_int"): Move up. ("*mov<mode>cc", "*cjump_64", "*cjump_31"): Accept integer constants other than 0. ("*ccraw_to_int"): New insn and splitter definition. ("tbegin", "tbegin_nofloat", "tbegin_retry") ("tbegin_retry_nofloat", "tbeginc", "tend", "tabort") ("tx_assist"): New expander. ("tbegin_1", "tbegin_nofloat_1", "*tbeginc_1", "*tend_1") ("*tabort_1", "etnd", "ntstg", "*ppa"): New insn definition. * config/s390/s390.opt: Add -mhtm option. * config/s390/s390-protos.h (s390_emit_jump): Add return type. * config/s390/htmxlintrin.h: New file. * config/s390/htmintrin.h: New file. * config/s390/s390intrin.h: New file. * doc/extend.texi: Document htm builtins. * config.gcc: Add the new header files to extra_headers. 2013-06-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> * gcc.target/s390/htm-1.c: New file. * gcc.target/s390/htm-nofloat-1.c: New file. * gcc.target/s390/htm-xl-intrin-1.c: New file. 2013-06-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> * config/s390/target.h: Include htmintrin.h. (_HTM_ITM_RETRIES): New macro definition. (htm_available, htm_init, htm_begin, htm_begin_success) (htm_commit, htm_abort, htm_abort_should_retry): New functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200454 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libitm')
-rw-r--r--libitm/ChangeLog7
-rw-r--r--libitm/config/s390/target.h59
2 files changed, 66 insertions, 0 deletions
diff --git a/libitm/ChangeLog b/libitm/ChangeLog
index 247886aaac2..27474d7b348 100644
--- a/libitm/ChangeLog
+++ b/libitm/ChangeLog
@@ -1,3 +1,10 @@
+2013-06-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * config/s390/target.h: Include htmintrin.h.
+ (_HTM_ITM_RETRIES): New macro definition.
+ (htm_available, htm_init, htm_begin, htm_begin_success)
+ (htm_commit, htm_abort, htm_abort_should_retry): New functions.
+
2013-06-20 Iain Sandoe <iain@codesourcery.com>
Cesar Philippidis <cesar@codesourcery.com>
diff --git a/libitm/config/s390/target.h b/libitm/config/s390/target.h
index a102e1e3d3d..580606f0270 100644
--- a/libitm/config/s390/target.h
+++ b/libitm/config/s390/target.h
@@ -22,6 +22,12 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+
+#include <htmintrin.h>
+
+/* Number of retries for transient failures. */
+#define _HTM_ITM_RETRIES 10
+
namespace GTM HIDDEN {
#define HW_CACHELINE_SIZE 256
@@ -52,4 +58,57 @@ cpu_relax (void)
__asm volatile ("" : : : "memory");
}
+#ifdef __HTM__
+#define USE_HTM_FASTPATH
+
+static inline bool
+htm_available ()
+{
+ return true;
+}
+
+static inline uint32_t
+htm_init ()
+{
+ return htm_available () ? _HTM_ITM_RETRIES : 0;
+}
+
+static inline uint32_t
+htm_begin ()
+{
+ return __builtin_tbegin_nofloat (NULL);
+}
+
+static inline bool
+htm_begin_success (uint32_t begin_ret)
+{
+ return begin_ret == _HTM_TBEGIN_STARTED;
+}
+
+static inline void
+htm_commit ()
+{
+ __builtin_tend ();
+}
+
+static inline void
+htm_abort ()
+{
+ __builtin_tabort (_HTM_FIRST_USER_ABORT_CODE);
+}
+
+static inline bool
+htm_abort_should_retry (uint32_t begin_ret)
+{
+ return begin_ret == _HTM_TBEGIN_TRANSIENT;
+}
+
+static inline bool
+htm_transaction_active ()
+{
+ return __builtin_tx_nesting_depth() != 0;
+}
+
+#endif
+
} // namespace GTM