From 465510a211db97132a8df192cbe0f92195fabed0 Mon Sep 17 00:00:00 2001 From: Yukari Chiba Date: Tue, 25 Jun 2024 13:44:40 +0800 Subject: [PATCH] util: detect RISC-V architecture Reviewed-by: Dave Airlie Part-of: --- src/util/detect_arch.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/util/detect_arch.h b/src/util/detect_arch.h index 83e4784465b..35385a02b49 100644 --- a/src/util/detect_arch.h +++ b/src/util/detect_arch.h @@ -101,6 +101,17 @@ #define DETECT_ARCH_HPPA 1 #endif +#if defined(__riscv) +#define DETECT_ARCH_RISCV 1 +#if __riscv_xlen == 64 +#define DETECT_ARCH_RISCV64 1 +#elif __riscv_xlen == 32 +#define DETECT_ARCH_RISCV32 1 +#else +#error "detect_arch: unknown target riscv xlen" +#endif +#endif + #ifndef DETECT_ARCH_X86 #define DETECT_ARCH_X86 0 #endif @@ -145,4 +156,16 @@ #define DETECT_ARCH_HPPA 0 #endif +#ifndef DETECT_ARCH_RISCV +#define DETECT_ARCH_RISCV 0 +#endif + +#ifndef DETECT_ARCH_RISCV32 +#define DETECT_ARCH_RISCV32 0 +#endif + +#ifndef DETECT_ARCH_RISCV64 +#define DETECT_ARCH_RISCV64 0 +#endif + #endif /* UTIL_DETECT_ARCH_H_ */