Unverified Commit dce3322a by Fanbo Meng Committed by GitHub

Add support for z/OS XL compiler inline asm syntax (#1063)

On s390 architecture, z/OS XL compiler uses HLASM inline assembly, which has different syntax and needs to be distinguished to avoid compilation error.
parent 3d1c2677
...@@ -41,6 +41,7 @@ Eric Backus <eric_backus@alum.mit.edu> ...@@ -41,6 +41,7 @@ Eric Backus <eric_backus@alum.mit.edu>
Eric Fiselier <eric@efcs.ca> Eric Fiselier <eric@efcs.ca>
Eugene Zhuk <eugene.zhuk@gmail.com> Eugene Zhuk <eugene.zhuk@gmail.com>
Evgeny Safronov <division494@gmail.com> Evgeny Safronov <division494@gmail.com>
Fanbo Meng <fanbo.meng@ibm.com>
Federico Ficarelli <federico.ficarelli@gmail.com> Federico Ficarelli <federico.ficarelli@gmail.com>
Felix Homann <linuxaudio@showlabor.de> Felix Homann <linuxaudio@showlabor.de>
Geoffrey Martin-Noble <gcmn@google.com> <gmngeoffrey@gmail.com> Geoffrey Martin-Noble <gcmn@google.com> <gmngeoffrey@gmail.com>
......
...@@ -170,7 +170,12 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() { ...@@ -170,7 +170,12 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
#elif defined(__s390__) // Covers both s390 and s390x. #elif defined(__s390__) // Covers both s390 and s390x.
// Return the CPU clock. // Return the CPU clock.
uint64_t tsc; uint64_t tsc;
#if defined(BENCHMARK_OS_ZOS) && defined(COMPILER_IBMXL)
// z/OS XL compiler HLASM syntax.
asm(" stck %0" : "=m"(tsc) : : "cc");
#else
asm("stck %0" : "=Q"(tsc) : : "cc"); asm("stck %0" : "=Q"(tsc) : : "cc");
#endif
return tsc; return tsc;
#elif defined(__riscv) // RISC-V #elif defined(__riscv) // RISC-V
// Use RDCYCLE (and RDCYCLEH on riscv32) // Use RDCYCLE (and RDCYCLEH on riscv32)
......
...@@ -13,7 +13,11 @@ ...@@ -13,7 +13,11 @@
#endif #endif
#if defined(__clang__) #if defined(__clang__)
#if !defined(COMPILER_CLANG) #if defined(__ibmxl__)
#if !defined(COMPILER_IBMXL)
#define COMPILER_IBMXL
#endif
#elif !defined(COMPILER_CLANG)
#define COMPILER_CLANG #define COMPILER_CLANG
#endif #endif
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
...@@ -74,6 +78,8 @@ ...@@ -74,6 +78,8 @@
#define BENCHMARK_OS_SOLARIS 1 #define BENCHMARK_OS_SOLARIS 1
#elif defined(__QNX__) #elif defined(__QNX__)
#define BENCHMARK_OS_QNX 1 #define BENCHMARK_OS_QNX 1
#elif defined(__MVS__)
#define BENCHMARK_OS_ZOS 1
#endif #endif
#if defined(__ANDROID__) && defined(__GLIBCXX__) #if defined(__ANDROID__) && defined(__GLIBCXX__)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment