Skip to content

Commit 8123324

Browse files
committed
Fix riscv64 arch detect
Signed-off-by: Han Gao <gaohan@uniontech.com>
1 parent 3fc52eb commit 8123324

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

cpuid_riscv64.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*****************************************************************************
2-
Copyright (c) 2011-2014, The OpenBLAS Project
2+
Copyright (c) 2011-2022, The OpenBLAS Project
33
All rights reserved.
44
55
Redistribution and use in source and binary forms, with or without
@@ -13,9 +13,9 @@ modification, are permitted provided that the following conditions are
1313
notice, this list of conditions and the following disclaimer in
1414
the documentation and/or other materials provided with the
1515
distribution.
16-
3. Neither the name of the OpenBLAS project nor the names of
17-
its contributors may be used to endorse or promote products
18-
derived from this software without specific prior written
16+
3. Neither the name of the OpenBLAS project nor the names of
17+
its contributors may be used to endorse or promote products
18+
derived from this software without specific prior written
1919
permission.
2020
2121
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
@@ -70,16 +70,16 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7070
/* or implied, of The University of Texas at Austin. */
7171
/*********************************************************************/
7272

73-
#define CPU_UNKNOWN 0
74-
#define CPU_C910V 1
73+
#define CPU_GENERIC 0
74+
#define CPU_C910V 1
7575

7676
static char *cpuname[] = {
77-
"UNKOWN",
77+
"RISCV64_GENERIC",
7878
"C910V"
7979
};
8080

8181
int detect(void){
82-
return CPU_UNKNOWN;
82+
return CPU_GENERIC;
8383
}
8484

8585
char *get_corename(void){
@@ -98,7 +98,7 @@ void get_subdirname(void){
9898
}
9999

100100
void get_cpuconfig(void){
101-
printf("#define UNKNOWN\n");
101+
printf("#define %s\n", cpuname[detect()]);
102102
printf("#define L1_DATA_SIZE 65536\n");
103103
printf("#define L1_DATA_LINESIZE 32\n");
104104
printf("#define L2_SIZE 512488\n");

getarch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,7 @@ int main(int argc, char *argv[]){
17311731
#ifdef FORCE
17321732
printf("CORE=%s\n", CORENAME);
17331733
#else
1734-
#if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH) || defined(sparc) || defined(__loongarch__)
1734+
#if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH) || defined(sparc) || defined(__loongarch__) || defined(__riscv)
17351735
printf("CORE=%s\n", get_corename());
17361736
#endif
17371737
#endif
@@ -1879,7 +1879,7 @@ printf("ELF_VERSION=2\n");
18791879
#ifdef FORCE
18801880
printf("#define CHAR_CORENAME \"%s\"\n", CORENAME);
18811881
#else
1882-
#if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH) || defined(sparc) || defined(__loongarch__)
1882+
#if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH) || defined(sparc) || defined(__loongarch__) || defined(__riscv)
18831883
printf("#define CHAR_CORENAME \"%s\"\n", get_corename());
18841884
#endif
18851885
#endif

0 commit comments

Comments
 (0)