summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/highway
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2024-10-04 23:49:52 -0700
committerKhem Raj <raj.khem@gmail.com>2024-10-04 23:54:29 -0700
commitb8ec9a232503a68e7ee6e75086b053d9e4aeb412 (patch)
treedf609107d92bacd7536648a9d4d0b4cc258ff688 /meta-oe/recipes-extended/highway
parentfb566b0d097bcb55592dd4cd445ac3a3c5f402f3 (diff)
downloadmeta-openembedded-b8ec9a232503a68e7ee6e75086b053d9e4aeb412.tar.gz
highway: Update the risc32 RVV selection patch
Use the v3 of upstream submitted patch Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-extended/highway')
-rw-r--r--meta-oe/recipes-extended/highway/highway/0001-Add-cmake-check-for-deducing-32bit-or-64bit-RISCV.patch71
1 files changed, 35 insertions, 36 deletions
diff --git a/meta-oe/recipes-extended/highway/highway/0001-Add-cmake-check-for-deducing-32bit-or-64bit-RISCV.patch b/meta-oe/recipes-extended/highway/highway/0001-Add-cmake-check-for-deducing-32bit-or-64bit-RISCV.patch
index bafe218f0d..ecc9c441c5 100644
--- a/meta-oe/recipes-extended/highway/highway/0001-Add-cmake-check-for-deducing-32bit-or-64bit-RISCV.patch
+++ b/meta-oe/recipes-extended/highway/highway/0001-Add-cmake-check-for-deducing-32bit-or-64bit-RISCV.patch
@@ -1,4 +1,4 @@
1From 5d40c0c49f9acde83ba71b6f59094cdbd12e1b78 Mon Sep 17 00:00:00 2001 1From b06541a75043c9a8213187fca942a0270783bd0e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 17 Sep 2024 18:22:36 +0000 3Date: Tue, 17 Sep 2024 18:22:36 +0000
4Subject: [PATCH] Add cmake check for deducing 32bit or 64bit RISCV 4Subject: [PATCH] Add cmake check for deducing 32bit or 64bit RISCV
@@ -7,52 +7,49 @@ Currently its only compilable for RV64 when RVV is
7enabled, this will extend it to build for RV32 with 7enabled, this will extend it to build for RV32 with
8RVV as well 8RVV as well
9 9
10Upstream-Status: Pending 10Upstream-Status: Submitted [https://github.com/google/highway/pull/2330]
11Signed-off-by: Khem Raj <raj.khem@gmail.com> 11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12--- 12---
13 CMakeLists.txt | 36 ++++++++++++++++++++++++++++++++++-- 13 CMakeLists.txt | 38 +++++++++++++++++++++++++++++++++++---
14 1 file changed, 34 insertions(+), 2 deletions(-) 14 1 file changed, 35 insertions(+), 3 deletions(-)
15 15
16diff --git a/CMakeLists.txt b/CMakeLists.txt
17index ea8b330c..cd824787 100644
18--- a/CMakeLists.txt 16--- a/CMakeLists.txt
19+++ b/CMakeLists.txt 17+++ b/CMakeLists.txt
20@@ -65,6 +65,34 @@ if (NOT CMAKE_BUILD_TYPE) 18@@ -59,6 +59,33 @@ if(CHECK_PIE_SUPPORTED)
21 set(CMAKE_BUILD_TYPE RelWithDebInfo) 19 endif()
22 endif() 20 endif()
23 21
24+include(CheckCSourceCompiles) 22+if (CMAKE_CXX_COMPILER_ARCHITECTURE_ID MATCHES "RISCV32|RISCV64|RISCV128" OR CMAKE_SYSTEM_PROCESSOR MATCHES "riscv32|riscv64|riscv128")
23+ include(CheckCSourceCompiles)
24+ check_c_source_compiles("
25+ #if __riscv_xlen == 64
26+ int main() { return 0; }
27+ #else
28+ #error Not RISCV-64
29+ #endif
30+ " IS_RISCV_XLEN_64)
25+ 31+
26+check_c_source_compiles(" 32+ check_c_source_compiles("
27+#if __riscv_xlen == 64 33+ #if __riscv_xlen == 32
28+int main() { return 0; } 34+ int main() { return 0; }
29+#else 35+ #else
30+#error Not RISCV-64 36+ #error Not RISCV-32
31+#endif 37+ #endif
32+" IS_RISCV_XLEN_64) 38+ " IS_RISCV_XLEN_32)
33+ 39+
34+check_c_source_compiles(" 40+ if(IS_RISCV_XLEN_32)
35+#if __riscv_xlen == 32 41+ set(RISCV_XLEN 32)
36+int main() { return 0; } 42+ elseif(IS_RISCV_XLEN_64)
37+#else 43+ set(RISCV_XLEN 64)
38+#error Not RISCV-32 44+ else()
39+#endif 45+ message(WARNING "Unable to determine RISC-V XLEN")
40+" IS_RISCV_XLEN_32) 46+ endif()
41+
42+if(IS_RISCV_XLEN_32)
43+ set(RISCV_XLEN 32)
44+elseif(IS_RISCV_XLEN_64)
45+ set(RISCV_XLEN 64)
46+else()
47+ message(WARNING "Unable to determine RISC-V XLEN")
48+endif() 47+endif()
49+ 48+
50+message(STATUS "RISC-V XLEN: ${RISCV_XLEN}") 49 include(GNUInstallDirs)
51+
52 # The following is only required with GCC < 6.1.0 or CLANG < 16.0
53 set(HWY_CMAKE_ARM7 OFF CACHE BOOL "Set copts for Armv7 with NEON (requires vfpv4)?")
54 50
55@@ -72,7 +100,7 @@ set(HWY_CMAKE_ARM7 OFF CACHE BOOL "Set copts for Armv7 with NEON (requires vfpv4 51 if (NOT CMAKE_BUILD_TYPE)
52@@ -72,7 +99,7 @@ set(HWY_CMAKE_ARM7 OFF CACHE BOOL "Set c
56 # skipped. For GCC 13.1+, you can also build with -fexcess-precision=standard. 53 # skipped. For GCC 13.1+, you can also build with -fexcess-precision=standard.
57 set(HWY_CMAKE_SSE2 OFF CACHE BOOL "Set SSE2 as baseline for 32-bit x86?") 54 set(HWY_CMAKE_SSE2 OFF CACHE BOOL "Set SSE2 as baseline for 32-bit x86?")
58 55
@@ -61,15 +58,17 @@ index ea8b330c..cd824787 100644
61 set(HWY_CMAKE_RVV ON CACHE BOOL "Set copts for RISCV with RVV?") 58 set(HWY_CMAKE_RVV ON CACHE BOOL "Set copts for RISCV with RVV?")
62 59
63 # Unconditionally adding -Werror risks breaking the build when new warnings 60 # Unconditionally adding -Werror risks breaking the build when new warnings
64@@ -378,7 +406,11 @@ else() 61@@ -378,7 +405,13 @@ else()
65 # we add the gcv compiler flag, which then requires the CPU (now when using 62 # we add the gcv compiler flag, which then requires the CPU (now when using
66 # either compiler) to support V. 63 # either compiler) to support V.
67 if(HWY_CMAKE_RVV) 64 if(HWY_CMAKE_RVV)
68- list(APPEND HWY_FLAGS -march=rv64gcv1p0) 65- list(APPEND HWY_FLAGS -march=rv64gcv1p0)
69+ if(RISCV_XLEN EQUAL 64) 66+ if(RISCV_XLEN EQUAL 64)
70+ list(APPEND HWY_FLAGS -march=rv64gcv1p0) 67+ list(APPEND HWY_FLAGS -march=rv64gcv1p0)
68+ add_link_options(-march=rv64gcv1p0)
71+ elseif(RISCV_XLEN EQUAL 32) 69+ elseif(RISCV_XLEN EQUAL 32)
72+ list(APPEND HWY_FLAGS -march=rv32gcv1p0) 70+ list(APPEND HWY_FLAGS -march=rv32gcv1p0)
71+ add_link_options(-march=rv32gcv1p0)
73+ endif() 72+ endif()
74 if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") 73 if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
75 list(APPEND HWY_FLAGS -menable-experimental-extensions) 74 list(APPEND HWY_FLAGS -menable-experimental-extensions)