Thanks to visit codestin.com
Credit goes to github.com

Skip to content

HP PA-RISC architecture initial build support #121220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hdeller
Copy link

@hdeller hdeller commented Dec 27, 2024

Two small patches, which allows to sucessfully build the basic LLVM tools on the HP PA-RISC (hppa) architecture.
Please pull.
Thanks!
Helge

Helge and others added 2 commits December 27, 2024 19:34
Fix this configure stage error:
-- LLVM host triple: hppa1.1-unknown-linux-gnu
CMake Error at cmake/config-ix.cmake:516 (message):
  Unknown architecture hppa1.1
Add support for time measurements on hppa, otherwise build breaks with this
compiler error:
 You need to define CycleTimer for your OS and CPU
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added cmake Build system in general and CMake in particular third-party:benchmark labels Dec 27, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 27, 2024

@llvm/pr-subscribers-third-party-benchmark

Author: Helge Deller (hdeller)

Changes

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 --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

Copy link
Member

@mtrofin mtrofin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please reference in the commit message the corresponding commit in the google/benchmark repo? It'll make life easier when we sync. Thanks.

@hdeller
Copy link
Author

hdeller commented Dec 28, 2024

Can you please reference in the commit message the corresponding commit in the google/benchmark repo? It'll make life easier when we sync. Thanks.

Here is the pull request for the commit in google/benchmark repo:
google/benchmark#1894

@hdeller
Copy link
Author

hdeller commented Jan 8, 2025

Can you please reference in the commit message the corresponding commit in the google/benchmark repo? It'll make life easier when we sync. Thanks.

Here is the pull request for the commit in google/benchmark repo: google/benchmark#1894

Info: The pull request for benchmark project has been resolved & closed since the changes were just merged into mainline repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake Build system in general and CMake in particular third-party:benchmark
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants