diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2015-11-27 13:58:30 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-12-09 16:52:12 +0400 |
commit | 218da97d5d8e42de68d38aee25d5367569a35c4c (patch) | |
tree | 1c21d2fc0917878d0490e0e765ed34ea7df20e2a | |
parent | f3e5329846a99339d8b69e27b2470956bcf1ed29 (diff) | |
download | mariadb-git-218da97d5d8e42de68d38aee25d5367569a35c4c.tar.gz |
MDEV-9172 - Analyze patches for IBM System z
Extended my_timer_cycles() to support s390.
Some compiler tunings for RHEL/SLES RPM packages on s390.
-rw-r--r-- | cmake/build_configurations/mysql_release.cmake | 19 | ||||
-rw-r--r-- | include/my_rdtsc.h | 1 | ||||
-rw-r--r-- | mysys/my_rdtsc.c | 9 |
3 files changed, 29 insertions, 0 deletions
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 8c79ec2dea2..75ce57e45e0 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -154,6 +154,25 @@ IF(UNIX) SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}") ENDIF() + # IBM Z flags + IF(CMAKE_SYSTEM_PROCESSOR MATCHES "s390x") + IF(RPM MATCHES "(rhel|centos)6" OR RPM MATCHES "(suse|sles)11") + SET(z_flags "-funroll-loops -march=z9-109 -mtune=z10 ") + ELSEIF(RPM MATCHES "(rhel|centos)7" OR RPM MATCHES "(suse|sles)12") + SET(z_flags "-funroll-loops -march=z196 -mtune=zEC12 ") + ELSE() + SET(z_flags "") + ENDIF() + + IF(CMAKE_COMPILER_IS_GNUCC) + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${z_flags}${CMAKE_C_FLAGS_RELWITHDEBINFO}") + ENDIF() + IF(CMAKE_COMPILER_IS_GNUCXX) + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${z_flags}${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") + ENDIF() + UNSET(z_flags) + ENDIF() + # HPUX flags IF(CMAKE_SYSTEM_NAME MATCHES "HP-UX") IF(CMAKE_C_COMPILER_ID MATCHES "HP") diff --git a/include/my_rdtsc.h b/include/my_rdtsc.h index 38ab0de8040..d24e2116733 100644 --- a/include/my_rdtsc.h +++ b/include/my_rdtsc.h @@ -125,6 +125,7 @@ C_MODE_END #define MY_TIMER_ROUTINE_MACH_ABSOLUTE_TIME 25 #define MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME 26 #define MY_TIMER_ROUTINE_ASM_SUNPRO_X86_64 27 +#define MY_TIMER_ROUTINE_ASM_S390 28 #endif diff --git a/mysys/my_rdtsc.c b/mysys/my_rdtsc.c index 82e560944f9..4228973caa8 100644 --- a/mysys/my_rdtsc.c +++ b/mysys/my_rdtsc.c @@ -249,6 +249,13 @@ ulonglong my_timer_cycles(void) clock_gettime(CLOCK_SGI_CYCLE, &tp); return (ulonglong) tp.tv_sec * 1000000000 + (ulonglong) tp.tv_nsec; } +#elif defined(__GNUC__) && defined(__s390__) + /* covers both s390 and s390x */ + { + ulonglong result; + __asm__ __volatile__ ("stck %0" : "=Q" (result) : : "cc"); + return result; + } #elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME) /* gethrtime may appear as either cycle or nanosecond counter */ return (ulonglong) gethrtime(); @@ -558,6 +565,8 @@ void my_timer_init(MY_TIMER_INFO *mti) mti->cycles.routine= MY_TIMER_ROUTINE_ASM_GCC_SPARC32; #elif defined(__sgi) && defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_SGI_CYCLE) mti->cycles.routine= MY_TIMER_ROUTINE_SGI_CYCLE; +#elif defined(__GNUC__) && defined(__s390__) + mti->cycles.routine= MY_TIMER_ROUTINE_ASM_S390; #elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME) mti->cycles.routine= MY_TIMER_ROUTINE_GETHRTIME; #else |