mirrored from git://gcc.gnu.org/git/gcc.git
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
krebbel
committed
Jun 27, 2013
1 parent
dd2f8b8
commit 5ada7a1
Showing
20 changed files
with
1,438 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* GNU compiler hardware transactional execution intrinsics | ||
Copyright (C) 2013 Free Software Foundation, Inc. | ||
Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com) | ||
This file is part of GCC. | ||
GCC is free software; you can redistribute it and/or modify it under | ||
the terms of the GNU General Public License as published by the Free | ||
Software Foundation; either version 3, or (at your option) any later | ||
version. | ||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY | ||
WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with GCC; see the file COPYING3. If not see | ||
<http://www.gnu.org/licenses/>. */ | ||
|
||
#ifndef _HTMINTRIN_H | ||
#define _HTMINTRIN_H | ||
|
||
|
||
/* Condition codes generated by tbegin */ | ||
#define _HTM_TBEGIN_STARTED 0 | ||
#define _HTM_TBEGIN_INDETERMINATE 1 | ||
#define _HTM_TBEGIN_TRANSIENT 2 | ||
#define _HTM_TBEGIN_PERSISTENT 3 | ||
|
||
/* The abort codes below this threshold are reserved for machine | ||
use. */ | ||
#define _HTM_FIRST_USER_ABORT_CODE 256 | ||
|
||
/* The transaction diagnostic block is it is defined in the Principles | ||
of Operation chapter 5-91. */ | ||
|
||
struct __htm_tdb { | ||
unsigned char format; /* 0 */ | ||
unsigned char flags; | ||
unsigned char reserved1[4]; | ||
unsigned short nesting_depth; | ||
unsigned long long abort_code; /* 8 */ | ||
unsigned long long conflict_token; /* 16 */ | ||
unsigned long long atia; /* 24 */ | ||
unsigned char eaid; /* 32 */ | ||
unsigned char dxc; | ||
unsigned char reserved2[2]; | ||
unsigned int program_int_id; | ||
unsigned long long exception_id; /* 40 */ | ||
unsigned long long bea; /* 48 */ | ||
unsigned char reserved3[72]; /* 56 */ | ||
unsigned long long gprs[16]; /* 128 */ | ||
} __attribute__((__packed__, __aligned__ (8))); | ||
|
||
|
||
#endif /* _HTMINTRIN_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
/* XL compiler hardware transactional execution intrinsics | ||
Copyright (C) 2013 Free Software Foundation, Inc. | ||
Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com) | ||
This file is part of GCC. | ||
GCC is free software; you can redistribute it and/or modify it under | ||
the terms of the GNU General Public License as published by the Free | ||
Software Foundation; either version 3, or (at your option) any later | ||
version. | ||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY | ||
WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with GCC; see the file COPYING3. If not see | ||
<http://www.gnu.org/licenses/>. */ | ||
|
||
#ifndef _HTMXLINTRIN_H | ||
#define _HTMXLINTRIN_H | ||
|
||
#include <stdint.h> | ||
|
||
#include <htmintrin.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/* These intrinsics are being made available for compatibility with | ||
the IBM XL compiler. For documentation please see the "z/OS XL | ||
C/C++ Programming Guide" publically available on the web. */ | ||
|
||
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_simple_begin () | ||
{ | ||
return __builtin_tbegin_nofloat (0); | ||
} | ||
|
||
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_begin (void* const tdb) | ||
{ | ||
return __builtin_tbegin_nofloat (tdb); | ||
} | ||
|
||
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_end () | ||
{ | ||
return __builtin_tend (); | ||
} | ||
|
||
extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_abort () | ||
{ | ||
return __builtin_tabort (_HTM_FIRST_USER_ABORT_CODE); | ||
} | ||
|
||
extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_named_abort (unsigned char const code) | ||
{ | ||
return __builtin_tabort ((int)_HTM_FIRST_USER_ABORT_CODE + code); | ||
} | ||
|
||
extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_non_transactional_store (void* const addr, long long const value) | ||
{ | ||
__builtin_non_tx_store ((uint64_t*)addr, (uint64_t)value); | ||
} | ||
|
||
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_nesting_depth (void* const tdb_ptr) | ||
{ | ||
int depth = __builtin_tx_nesting_depth (); | ||
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; | ||
|
||
if (depth != 0) | ||
return depth; | ||
|
||
if (tdb->format == 0) | ||
return 0; | ||
return tdb->nesting_depth; | ||
} | ||
|
||
/* Transaction failure diagnostics */ | ||
|
||
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_is_user_abort (void* const tdb_ptr) | ||
{ | ||
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; | ||
|
||
if (tdb->format == 0) | ||
return 0; | ||
|
||
return !!(tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE); | ||
} | ||
|
||
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_is_named_user_abort (void* const tdb_ptr, unsigned char* code) | ||
{ | ||
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; | ||
|
||
if (tdb->format == 0) | ||
return 0; | ||
|
||
if (tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE) | ||
{ | ||
*code = tdb->abort_code - _HTM_FIRST_USER_ABORT_CODE; | ||
return 1; | ||
} | ||
return 0; | ||
} | ||
|
||
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_is_illegal (void* const tdb_ptr) | ||
{ | ||
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; | ||
|
||
return (tdb->format == 0 | ||
&& (tdb->abort_code == 4 /* unfiltered program interruption */ | ||
|| tdb->abort_code == 11 /* restricted instruction */)); | ||
} | ||
|
||
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_is_footprint_exceeded (void* const tdb_ptr) | ||
{ | ||
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; | ||
|
||
return (tdb->format == 0 | ||
&& (tdb->abort_code == 7 /* fetch overflow */ | ||
|| tdb->abort_code == 8 /* store overflow */)); | ||
} | ||
|
||
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_is_nested_too_deep (void* const tdb_ptr) | ||
{ | ||
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; | ||
|
||
return tdb->format == 0 && tdb->abort_code == 13; /* depth exceeded */ | ||
} | ||
|
||
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_is_conflict (void* const tdb_ptr) | ||
{ | ||
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; | ||
|
||
return (tdb->format == 0 | ||
&& (tdb->abort_code == 9 /* fetch conflict */ | ||
|| tdb->abort_code == 10 /* store conflict */)); | ||
} | ||
|
||
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_is_failure_persistent (long const result) | ||
{ | ||
return result == _HTM_TBEGIN_PERSISTENT; | ||
} | ||
|
||
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_failure_address (void* const tdb_ptr) | ||
{ | ||
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; | ||
#ifdef __s390x__ | ||
return tdb->atia; | ||
#else | ||
return tdb->atia & 0xffffffff; | ||
#endif | ||
} | ||
|
||
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
__TM_failure_code (void* const tdb_ptr) | ||
{ | ||
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; | ||
|
||
return tdb->abort_code; | ||
} | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* _HTMXLINTRIN_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.