aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/arch/aarch64
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2020-07-06 16:02:43 +0300
committerPetri Savolainen <petri.savolainen@nokia.com>2020-07-10 11:28:59 +0300
commit0fdfb1bec47adb77d29aaf2a21e45d199fd9b459 (patch)
tree834c3b867f4b30e4ffa9efc159c415ac751bc63c /platform/linux-generic/arch/aarch64
parentb41e5ca8f52ae63d636d7a4068ed154736a40d3c (diff)
linux-gen: sysinfo: update ARM ISA version number detection
Current Arm C Language Extensions (ACLE) documentation defines that from v8.1 onwards __ARM_ARCH value includes the minor version number. This applies to more recent compilers. Older compilers set __ARM_ARCH value to 8 also when building for v8.1. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-and-tested-by: Jerin Jacob <jerinj@marvell.com>
Diffstat (limited to 'platform/linux-generic/arch/aarch64')
-rw-r--r--platform/linux-generic/arch/aarch64/odp_sysinfo_parse.c52
1 files changed, 33 insertions, 19 deletions
diff --git a/platform/linux-generic/arch/aarch64/odp_sysinfo_parse.c b/platform/linux-generic/arch/aarch64/odp_sysinfo_parse.c
index ae8a34381..56f33cdce 100644
--- a/platform/linux-generic/arch/aarch64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/aarch64/odp_sysinfo_parse.c
@@ -255,25 +255,6 @@ void sys_info_print_arch(void)
printf("%s\n", ndef);
#endif
-#if defined(__ARM_ARCH) && __ARM_ARCH >= 8
- /* Actually, this checks for new NEON instructions in
- * v8.1, but is currently the only way to distinguish
- * v8.0 and >=v8.1. */
- printf(" ARMv8 ISA version ");
-#ifdef __ARM_FEATURE_QRDMX
- printf("v8.1 or higher\n");
-#else
- printf("v8.0\n");
-#endif
-#endif
-
-#ifdef __ARM_FEATURE_QRDMX
- /* Actually, this checks for new NEON instructions in
- * v8.1, but is currently the only way to distinguish
- * v8.0 and >=v8.1. */
- printf(" ARMv8.1 instructions\n");
-#endif
-
printf(" __ARM_NEON ");
#ifdef __ARM_NEON
printf("%i\n", __ARM_NEON);
@@ -288,6 +269,13 @@ void sys_info_print_arch(void)
printf("%s\n", ndef);
#endif
+ printf(" __ARM_FEATURE_QRDMX ");
+#ifdef __ARM_FEATURE_QRDMX
+ printf("%i\n", __ARM_FEATURE_QRDMX);
+#else
+ printf("%s\n", ndef);
+#endif
+
printf(" __ARM_FEATURE_CRYPTO ");
#ifdef __ARM_FEATURE_CRYPTO
printf("%i\n", __ARM_FEATURE_CRYPTO);
@@ -302,6 +290,32 @@ void sys_info_print_arch(void)
printf("%s\n", ndef);
#endif
+ printf(" ARM ISA version: ");
+#if defined(__ARM_ARCH)
+ if (__ARM_ARCH < 8) {
+ printf("v%i\n", __ARM_ARCH);
+ } else if (__ARM_ARCH == 8) {
+ /* Actually, this checks for new NEON instructions in
+ * v8.1, but is currently the only way to distinguish
+ * v8.0 and >=v8.1. */
+ #ifdef __ARM_FEATURE_QRDMX
+ printf("v8.1 or higher\n");
+ #else
+ printf("v8.0\n");
+ #endif
+ } else {
+ /* ACLE 2018 defines that from v8.1 onwards the value includes
+ * the minor version number: __ARM_ARCH = X * 100 + Y
+ * E.g. for Armv8.1 __ARM_ARCH = 801 */
+ int major = __ARM_ARCH / 100;
+ int minor = __ARM_ARCH - (major * 100);
+
+ printf("v%i.%i\n", major, minor);
+ }
+#else
+ printf("%s\n", ndef);
+#endif
+
printf("\n");
}