diff --git a/Makefile.system b/Makefile.system index 8113c26e7..a8ef659f1 100644 --- a/Makefile.system +++ b/Makefile.system @@ -1742,6 +1742,9 @@ export HAVE_NEON ifndef NO_MSA export HAVE_MSA export MSA_FLAGS +else +HAVE_MSA = +MSA_FLAGS = endif export KERNELDIR export FUNCTION_PROFILE diff --git a/getarch.c b/getarch.c index f26ca6325..1ff0806f0 100644 --- a/getarch.c +++ b/getarch.c @@ -1,5 +1,7 @@ /***************************************************************************** Copyright (c) 2011-2014, The OpenBLAS Project +Copyright (c) 2022, Arm Limited and/or its affiliates + All rights reserved. Redistribution and use in source and binary forms, with or without @@ -1815,51 +1817,16 @@ static int get_num_cores(void) { #endif } -int main(int argc, char *argv[]){ - -#ifdef FORCE - char buffer[8192], *p, *q; - int length; -#endif - - if (argc == 1) return 0; - - switch (argv[1][0]) { - - case '0' : /* for Makefile */ - #ifdef FORCE - printf("CORE=%s\n", CORENAME); -#else -#if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH) || defined(sparc) || defined(__loongarch__) || defined(__riscv) || defined(__alpha__) - printf("CORE=%s\n", get_corename()); -#endif -#endif - -#ifdef FORCE - printf("LIBCORE=%s\n", LIBNAME); -#else - printf("LIBCORE="); - get_libname(); - printf("\n"); -#endif - - printf("NUM_CORES=%d\n", get_num_cores()); - -#if defined(__arm__) -#if !defined(FORCE) - fprintf(stderr,"get features!\n"); - get_features(); -#else - fprintf(stderr,"split archconfig!\n"); +static void split_archconfig_makefile(char* buffer) { sprintf(buffer, "%s", ARCHCONFIG); - p = &buffer[0]; + char* p = &buffer[0]; while (*p) { if ((*p == '-') && (*(p + 1) == 'D')) { p += 2; - if (*p != 'H') { + if (*p != 'H' && *p != 'N') { while( (*p != ' ') && (*p != '-') && (*p != '\0') && (*p != '\n')) {p++; } if (*p == '-') continue; } @@ -1880,43 +1847,76 @@ int main(int argc, char *argv[]){ } } else p ++; } -#endif -#endif - - -#ifdef INTEL_AMD -#ifndef FORCE - get_sse(); -#else - - sprintf(buffer, "%s", ARCHCONFIG); +} - p = &buffer[0]; +static void split_archconfig_header(char* buffer) { + sprintf(buffer, "%s -DCORE_%s\n", ARCHCONFIG, CORENAME); + char* p = &buffer[0]; while (*p) { if ((*p == '-') && (*(p + 1) == 'D')) { p += 2; + printf("#define "); while ((*p != ' ') && (*p != '\0')) { if (*p == '=') { - printf("="); + printf(" "); p ++; while ((*p != ' ') && (*p != '\0')) { printf("%c", *p); p ++; } } else { + if (*p != '\n') printf("%c", *p); p ++; - if ((*p == ' ') || (*p =='\0')) printf("=1"); } } printf("\n"); } else p ++; } +} #endif + +int main(int argc, char *argv[]){ + +#ifdef FORCE + char buffer[8192], *p, *q; + int length; +#endif + + if (argc == 1) return 0; + + switch (argv[1][0]) { + + case '0' : /* for Makefile */ + +#ifdef FORCE + printf("CORE=%s\n", CORENAME); +#else +#if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH) || defined(sparc) || defined(__loongarch__) || defined(__riscv) || defined(__alpha__) + printf("CORE=%s\n", get_corename()); +#endif +#endif + +#ifdef FORCE + printf("LIBCORE=%s\n", LIBNAME); +#else + printf("LIBCORE="); + get_libname(); + printf("\n"); +#endif + + printf("NUM_CORES=%d\n", get_num_cores()); + +#ifdef FORCE + split_archconfig_makefile(buffer); +#elif defined(__arm__) + get_features(); +#elif defined(INTEL_AMD) + get_sse(); #endif #if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ @@ -1945,33 +1945,7 @@ printf("ELF_VERSION=2\n"); case '1' : /* For config.h */ #ifdef FORCE - sprintf(buffer, "%s -DCORE_%s\n", ARCHCONFIG, CORENAME); - - p = &buffer[0]; - while (*p) { - if ((*p == '-') && (*(p + 1) == 'D')) { - p += 2; - printf("#define "); - - while ((*p != ' ') && (*p != '\0')) { - - if (*p == '=') { - printf(" "); - p ++; - while ((*p != ' ') && (*p != '\0')) { - printf("%c", *p); - p ++; - } - } else { - if (*p != '\n') - printf("%c", *p); - p ++; - } - } - - printf("\n"); - } else p ++; - } + split_archconfig_header(buffer); #else get_cpuconfig(); #endif