[llvm] HP PA-RISC architecture initial build support (PR #121220)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 27 10:39:37 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-third-party-benchmark
Author: Helge Deller (hdeller)
<details>
<summary>Changes</summary>
Two small patches, which allows to sucessfully build the basic LLVM tools on the HP PA-RISC (hppa) architecture.
Please pull.
Thanks!
Helge
---
Full diff: https://github.com/llvm/llvm-project/pull/121220.diff
2 Files Affected:
- (modified) llvm/cmake/config-ix.cmake (+4)
- (modified) third-party/benchmark/src/cycleclock.h (+10)
``````````diff
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 64878d28d9e1e5..1dbb468a460447 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -512,6 +512,10 @@ elseif (LLVM_NATIVE_ARCH STREQUAL "m68k")
set(LLVM_NATIVE_ARCH M68k)
elseif (LLVM_NATIVE_ARCH MATCHES "loongarch")
set(LLVM_NATIVE_ARCH LoongArch)
+elseif (LLVM_NATIVE_ARCH MATCHES "hppa1.1")
+ set(LLVM_NATIVE_ARCH HPPA)
+elseif (LLVM_NATIVE_ARCH MATCHES "hppa64")
+ set(LLVM_NATIVE_ARCH HPPA)
else ()
message(FATAL_ERROR "Unknown architecture ${LLVM_NATIVE_ARCH}")
endif ()
diff --git a/third-party/benchmark/src/cycleclock.h b/third-party/benchmark/src/cycleclock.h
index d4f1330b671db9..723a3bd17094de 100644
--- a/third-party/benchmark/src/cycleclock.h
+++ b/third-party/benchmark/src/cycleclock.h
@@ -228,6 +228,16 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
struct timeval tv;
gettimeofday(&tv, nullptr);
return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
+#elif defined(__hppa__)
+ // HP PA-RISC provides a user-readable clock counter (cr16), but
+ // it's not syncronized across CPUs and only 32-bit wide when programs
+ // are built as 32-bit binaries.
+ // Use clock_gettime(CLOCK_MONOTONIC, ...) instead of gettimeofday
+ // because is provides nanosecond resolution.
+ // Initialize to always return 0 if clock_gettime fails.
+ struct timespec ts = {0, 0};
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ return static_cast<int64_t>(ts.tv_sec) * 1000000000 + ts.tv_nsec;
#else
// The soft failover to a generic implementation is automatic only for ARM.
// For other platforms the developer is expected to make an attempt to create
``````````
</details>
https://github.com/llvm/llvm-project/pull/121220
More information about the llvm-commits
mailing list