25a977
---
25a977
 numpy/core/include/numpy/npy_cpu.h        | 3 +++
25a977
 numpy/core/include/numpy/npy_endian.h     | 3 ++-
25a977
 numpy/core/setup.py                       | 2 +-
25a977
 numpy/core/setup_common.py                | 4 ++++
25a977
 numpy/core/src/npymath/ieee754.c.src      | 3 ++-
25a977
 numpy/core/src/npymath/npy_math_private.h | 3 ++-
25a977
 numpy/core/src/private/npy_fpmath.h       | 5 ++++-
25a977
 7 files changed, 18 insertions(+), 5 deletions(-)
25a977
25a977
diff --git a/numpy/core/include/numpy/npy_cpu.h b/numpy/core/include/numpy/npy_cpu.h
25a977
index 9707a7a..321cc04 100644
25a977
--- a/numpy/core/include/numpy/npy_cpu.h
25a977
+++ b/numpy/core/include/numpy/npy_cpu.h
25a977
@@ -5,6 +5,7 @@
25a977
  *              NPY_CPU_AMD64
25a977
  *              NPY_CPU_PPC
25a977
  *              NPY_CPU_PPC64
25a977
+ *              NPY_CPU_PPC64LE
25a977
  *              NPY_CPU_SPARC
25a977
  *              NPY_CPU_S390
25a977
  *              NPY_CPU_IA64
25a977
@@ -41,6 +42,8 @@
25a977
      * _ARCH_PPC is used by at least gcc on AIX
25a977
      */
25a977
     #define NPY_CPU_PPC
25a977
+#elif defined(__ppc64le__)
25a977
+    #define NPY_CPU_PPC64LE
25a977
 #elif defined(__ppc64__)
25a977
     #define NPY_CPU_PPC64
25a977
 #elif defined(__sparc__) || defined(__sparc)
25a977
diff --git a/numpy/core/include/numpy/npy_endian.h b/numpy/core/include/numpy/npy_endian.h
25a977
index 4e3349f..d8af8b3 100644
25a977
--- a/numpy/core/include/numpy/npy_endian.h
25a977
+++ b/numpy/core/include/numpy/npy_endian.h
25a977
@@ -27,7 +27,8 @@
25a977
             || defined(NPY_CPU_ARMEL)   \
25a977
             || defined(NPY_CPU_AARCH64) \
25a977
             || defined(NPY_CPU_SH_LE)   \
25a977
-            || defined(NPY_CPU_MIPSEL)
25a977
+            || defined(NPY_CPU_MIPSEL)  \
25a977
+            || defined(NPY_CPU_PPC64LE)
25a977
         #define NPY_BYTE_ORDER NPY_LITTLE_ENDIAN
25a977
     #elif defined(NPY_CPU_PPC)          \
25a977
             || defined(NPY_CPU_SPARC)   \
25a977
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
25a977
index a1000ae..36cec26 100644
25a977
--- a/numpy/core/setup.py
25a977
+++ b/numpy/core/setup.py
25a977
@@ -444,7 +444,7 @@ def configuration(parent_package='',top_path=None):
25a977
                            'INTEL_EXTENDED_16_BYTES_LE',
25a977
                            'IEEE_QUAD_LE', 'IEEE_QUAD_BE',
25a977
                            'IEEE_DOUBLE_LE', 'IEEE_DOUBLE_BE',
25a977
-                           'DOUBLE_DOUBLE_BE']:
25a977
+                           'DOUBLE_DOUBLE_BE', 'DOUBLE_DOUBLE_LE']:
25a977
                     moredefs.append(('HAVE_LDOUBLE_%s' % rep, 1))
25a977
                 else:
25a977
                     raise ValueError("Unrecognized long double format: %s" % rep)
25a977
diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py
25a977
index 58876a8..3289afe 100644
25a977
--- a/numpy/core/setup_common.py
25a977
+++ b/numpy/core/setup_common.py
25a977
@@ -221,6 +221,8 @@ _IEEE_QUAD_PREC_BE = ['300', '031', '326', '363', '105', '100', '000', '000',
25a977
 _IEEE_QUAD_PREC_LE = _IEEE_QUAD_PREC_BE[::-1]
25a977
 _DOUBLE_DOUBLE_BE = ['301', '235', '157', '064', '124', '000', '000', '000'] + \
25a977
                     ['000'] * 8
25a977
+_DOUBLE_DOUBLE_LE = ['000', '000', '000', '124', '064', '157', '235', '301'] + \
25a977
+                    ['000'] * 8
25a977
 
25a977
 def long_double_representation(lines):
25a977
     """Given a binary dump as given by GNU od -b, look for long double
25a977
@@ -258,6 +260,8 @@ def long_double_representation(lines):
25a977
                         return 'IEEE_QUAD_LE'
25a977
                     elif read[8:-8] == _DOUBLE_DOUBLE_BE:
25a977
                         return 'DOUBLE_DOUBLE_BE'
25a977
+                    elif read[8:-8] == _DOUBLE_DOUBLE_LE:
25a977
+                        return 'DOUBLE_DOUBLE_LE'
25a977
                 elif read[:16] == _BEFORE_SEQ:
25a977
                     if read[16:-8] == _IEEE_DOUBLE_LE:
25a977
                         return 'IEEE_DOUBLE_LE'
25a977
diff --git a/numpy/core/src/npymath/ieee754.c.src b/numpy/core/src/npymath/ieee754.c.src
25a977
index 90bbf5f..bccb3c8 100644
25a977
--- a/numpy/core/src/npymath/ieee754.c.src
25a977
+++ b/numpy/core/src/npymath/ieee754.c.src
25a977
@@ -133,7 +133,8 @@ float _nextf(float x, int p)
25a977
     return x;
25a977
 }
25a977
 
25a977
-#ifdef HAVE_LDOUBLE_DOUBLE_DOUBLE_BE
25a977
+#if defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_BE) || \
25a977
+    defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_LE)
25a977
 
25a977
 /*
25a977
  * FIXME: this is ugly and untested. The asm part only works with gcc, and we
25a977
diff --git a/numpy/core/src/npymath/npy_math_private.h b/numpy/core/src/npymath/npy_math_private.h
25a977
index 722d03f..b0ede48 100644
25a977
--- a/numpy/core/src/npymath/npy_math_private.h
25a977
+++ b/numpy/core/src/npymath/npy_math_private.h
25a977
@@ -398,7 +398,8 @@ do {                                                            \
25a977
     typedef npy_uint32 ldouble_sign_t;
25a977
 #endif
25a977
 
25a977
-#ifndef HAVE_LDOUBLE_DOUBLE_DOUBLE_BE
25a977
+#if !defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_BE) && \
25a977
+    !defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_LE)
25a977
 /* Get the sign bit of x. x should be of type IEEEl2bitsrep */
25a977
 #define GET_LDOUBLE_SIGN(x) \
25a977
     (((x).a[LDBL_SIGN_INDEX] & LDBL_SIGN_MASK) >> LDBL_SIGN_SHIFT)
25a977
diff --git a/numpy/core/src/private/npy_fpmath.h b/numpy/core/src/private/npy_fpmath.h
25a977
index 92338e4..f709d39 100644
25a977
--- a/numpy/core/src/private/npy_fpmath.h
25a977
+++ b/numpy/core/src/private/npy_fpmath.h
25a977
@@ -29,6 +29,8 @@
25a977
             #define HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE
25a977
         #elif defined(NPY_CPU_PPC) || defined(NPY_CPU_PPC64)
25a977
             #define HAVE_LDOUBLE_IEEE_DOUBLE_16_BYTES_BE
25a977
+        #elif defined(NPY_CPU_PPC64LE)
25a977
+            #define HAVE_LDOUBLE_IEEE_DOUBLE_16_BYTES_LE
25a977
         #endif
25a977
     #endif
25a977
 #endif
25a977
@@ -40,7 +42,8 @@
25a977
       defined(HAVE_LDOUBLE_IEEE_DOUBLE_16_BYTES_BE) || \
25a977
       defined(HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE) || \
25a977
       defined(HAVE_LDOUBLE_INTEL_EXTENDED_12_BYTES_LE) || \
25a977
-      defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_BE))
25a977
+      defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_BE) || \
25a977
+      defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_LE))
25a977
     #error No long double representation defined
25a977
 #endif
25a977
 
25a977
-- 
25a977
1.9.3
25a977