[compiler-rt] 7fc3491 - [compiler-rt][RISCV] Use u64 data type for marchid and mimpid (#112163)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 01:23:06 PDT 2024


Author: Yangyu Chen
Date: 2024-10-14T16:23:01+08:00
New Revision: 7fc3491c045bf6acb9c904a5da95bbac66ad487f

URL: https://github.com/llvm/llvm-project/commit/7fc3491c045bf6acb9c904a5da95bbac66ad487f
DIFF: https://github.com/llvm/llvm-project/commit/7fc3491c045bf6acb9c904a5da95bbac66ad487f.diff

LOG: [compiler-rt][RISCV] Use u64 data type for marchid and mimpid (#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.

Signed-off-by: Yangyu Chen <cyy at cyyself.name>

Added: 
    

Modified: 
    compiler-rt/lib/builtins/cpu_model/riscv.c

Removed: 
    


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