[compiler-rt] [compiler-rt][RISCV] Use u64 data type for marchid and mimpid (PR #112163)
Yangyu Chen via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 13 23:27:26 PDT 2024
https://github.com/cyyself created https://github.com/llvm/llvm-project/pull/112163
Base on https://github.com/riscv-non-isa/riscv-c-api-doc/pull/91 , the marchid and mimpid are MXLEN bits wide, and kernel returned them as u64 data type. So we should use u64 data type for marchid and mimpid in __riscv_cpu_model struct here.
>From a1ff7ddedb052a76e08aac74d4a4d51eba9cfbdb Mon Sep 17 00:00:00 2001
From: Yangyu Chen <cyy at cyyself.name>
Date: Mon, 14 Oct 2024 14:26:10 +0800
Subject: [PATCH] [compiler-rt][RISCV] Use u64 data type for marchid and mimpid
Base on https://github.com/riscv-non-isa/riscv-c-api-doc/pull/91 , the
marchid and mimpid are MXLEN bits wide, and kernel returned them as u64
data type. So we should use u64 data type for marchid and mimpid in
__riscv_cpu_model struct here.
Signed-off-by: Yangyu Chen <cyy at cyyself.name>
---
compiler-rt/lib/builtins/cpu_model/riscv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/compiler-rt/lib/builtins/cpu_model/riscv.c b/compiler-rt/lib/builtins/cpu_model/riscv.c
index 85b24ab8f43bc1..052124fdde447e 100644
--- a/compiler-rt/lib/builtins/cpu_model/riscv.c
+++ b/compiler-rt/lib/builtins/cpu_model/riscv.c
@@ -22,8 +22,8 @@ struct {
struct {
unsigned mvendorid;
- unsigned marchid;
- unsigned mimpid;
+ unsigned long long marchid;
+ unsigned long long mimpid;
} __riscv_cpu_model __attribute__((visibility("hidden"), nocommon));
// NOTE: Should sync-up with RISCVFeatures.td
More information about the llvm-commits
mailing list