File openblas-ppc64be_up2_p8.patch of Package openblas.22623

From: Michel Normand <normand@linux.vnet.ibm.com>
Subject: openblas ppc64be up2 p8
Date: Wed, 03 Feb 2021 15:39:25 +0100

openblas ppc64be up2 p8

because:
* openblas build failed for ppc64 (BE) in openSUSE
  since version 0.3.12
* ppc64 (BE) not supported by IBM after P8.

Signed-off-by: Michel Normand <normand@linux.vnet.ibm.com>
---
 Makefile.system               |    4 ++++
 driver/others/dynamic_power.c |   11 +++++++++++
 2 files changed, 15 insertions(+)

Index: OpenBLAS-0.3.13/Makefile.system
===================================================================
--- OpenBLAS-0.3.13.orig/Makefile.system
+++ OpenBLAS-0.3.13/Makefile.system
@@ -665,6 +665,9 @@ endif # ARCH zarch
 ifeq ($(ARCH), power)
 DYNAMIC_CORE = POWER6
 DYNAMIC_CORE += POWER8
+ifeq ($(__BYTE_ORDER__),__ORDER_BIG_ENDIAN__)
+$(info, OpenBLAS: for big endian limit to POWER8 kernels.)
+else
 ifneq ($(C_COMPILER), GCC)
 DYNAMIC_CORE += POWER9
 DYNAMIC_CORE += POWER10
@@ -690,6 +693,7 @@ $(info, OpenBLAS: Your gcc version is to
 endif
 endif
 endif
+endif
 
 # If DYNAMIC_CORE is not set, DYNAMIC_ARCH cannot do anything, so force it to empty
 ifndef DYNAMIC_CORE
Index: OpenBLAS-0.3.13/driver/others/dynamic_power.c
===================================================================
--- OpenBLAS-0.3.13.orig/driver/others/dynamic_power.c
+++ OpenBLAS-0.3.13/driver/others/dynamic_power.c
@@ -3,6 +3,7 @@
 
 extern gotoblas_t gotoblas_POWER6;
 extern gotoblas_t gotoblas_POWER8;
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 #if (!defined __GNUC__) || ( __GNUC__ >= 6)
 extern gotoblas_t gotoblas_POWER9;
 #endif
@@ -13,6 +14,7 @@ extern gotoblas_t gotoblas_POWER9;
 #ifdef HAVE_P10_SUPPORT
 extern gotoblas_t gotoblas_POWER10;
 #endif
+#endif
 
 extern void openblas_warning(int verbose, const char *msg);
 
@@ -29,12 +31,14 @@ static char *corename[] = {
 char *gotoblas_corename(void) {
 	if (gotoblas == &gotoblas_POWER6)	return corename[1];
 	if (gotoblas == &gotoblas_POWER8)	return corename[2];
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 #if (!defined __GNUC__) || ( __GNUC__ >= 6)
 	if (gotoblas == &gotoblas_POWER9)	return corename[3];
 #endif
 #ifdef HAVE_P10_SUPPORT
 	if (gotoblas == &gotoblas_POWER10)	return corename[4];
 #endif
+#endif
 	return corename[0];
 }
 
@@ -44,6 +48,10 @@ static gotoblas_t *get_coretype(void) {
 		return &gotoblas_POWER6;
 	if (__builtin_cpu_is("power8"))
 		return &gotoblas_POWER8;
+	/* Fall back to the POWER8 implementation for big endian */
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+		return &gotoblas_POWER8;
+#else
 #if (!defined __GNUC__) || ( __GNUC__ >= 6)
 	if (__builtin_cpu_is("power9"))
 		return &gotoblas_POWER9;
@@ -57,6 +65,7 @@ static gotoblas_t *get_coretype(void) {
 	if (__builtin_cpu_is("power10"))
 		return &gotoblas_POWER9;
 #endif	
+#endif
 	return NULL;
 }
 
@@ -79,12 +88,14 @@ static gotoblas_t *force_coretype(char *
 	{
 	case  1: return (&gotoblas_POWER6);
 	case  2: return (&gotoblas_POWER8);
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 #if (!defined __GNUC__) || ( __GNUC__ >= 6)
 	case  3: return (&gotoblas_POWER9);
 #endif
 #ifdef HAVE_P10_SUPPORT
 	case  4: return (&gotoblas_POWER10);
 #endif
+#endif
 	default: return NULL;
 	}
 	snprintf(message, 128, "Core not found: %s\n", coretype);
openSUSE Build Service is sponsored by