0002-Add-support-of-ARC.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From 9a225e7d4fb1de5c99c6b5b17cae2fc4c2d1c59a Mon Sep 17 00:00:00 2001
  2. From: Alexey Brodkin <abrodkin@synopsys.com>
  3. Date: Fri, 15 Sep 2017 11:59:14 +0300
  4. Subject: [PATCH] Add support of ARC
  5. Synopsys DesignWare ARC Processors are a family of 32-bit CPUs
  6. which in some configurations may run Linux kernel and full stack
  7. of applications on top of it. Among other things is Python.
  8. With that change we allow building and usage of Numpy on ARC.
  9. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
  10. ---
  11. numpy/core/include/numpy/npy_cpu.h | 6 ++++++
  12. numpy/core/include/numpy/npy_endian.h | 6 ++++--
  13. 2 files changed, 10 insertions(+), 2 deletions(-)
  14. diff --git a/numpy/core/include/numpy/npy_cpu.h b/numpy/core/include/numpy/npy_cpu.h
  15. index 60abae4e0b0e..84653ea183ce 100644
  16. --- a/numpy/core/include/numpy/npy_cpu.h
  17. +++ b/numpy/core/include/numpy/npy_cpu.h
  18. @@ -15,6 +15,8 @@
  19. * NPY_CPU_ARMEB
  20. * NPY_CPU_SH_LE
  21. * NPY_CPU_SH_BE
  22. + * NPY_CPU_ARCEL
  23. + * NPY_CPU_ARCEB
  24. */
  25. #ifndef _NPY_CPUARCH_H_
  26. #define _NPY_CPUARCH_H_
  27. @@ -76,6 +78,10 @@
  28. #define NPY_CPU_AARCH64
  29. #elif defined(__mc68000__)
  30. #define NPY_CPU_M68K
  31. +#elif defined(__arc__) && defined(__LITTLE_ENDIAN__)
  32. + #define NPY_CPU_ARCEL
  33. +#elif defined(__arc__) && defined(__BIG_ENDIAN__)
  34. + #define NPY_CPU_ARCEB
  35. #else
  36. #error Unknown CPU, please report this to numpy maintainers with \
  37. information about your platform (OS, CPU and compiler)
  38. diff --git a/numpy/core/include/numpy/npy_endian.h b/numpy/core/include/numpy/npy_endian.h
  39. index e34b1d97e655..1a42121db92e 100644
  40. --- a/numpy/core/include/numpy/npy_endian.h
  41. +++ b/numpy/core/include/numpy/npy_endian.h
  42. @@ -45,7 +45,8 @@
  43. || defined(NPY_CPU_AARCH64) \
  44. || defined(NPY_CPU_SH_LE) \
  45. || defined(NPY_CPU_MIPSEL) \
  46. - || defined(NPY_CPU_PPC64LE)
  47. + || defined(NPY_CPU_PPC64LE) \
  48. + || defined(NPY_CPU_ARCEL)
  49. #define NPY_BYTE_ORDER NPY_LITTLE_ENDIAN
  50. #elif defined(NPY_CPU_PPC) \
  51. || defined(NPY_CPU_SPARC) \
  52. @@ -56,7 +57,8 @@
  53. || defined(NPY_CPU_SH_BE) \
  54. || defined(NPY_CPU_MIPSEB) \
  55. || defined(NPY_CPU_OR1K) \
  56. - || defined(NPY_CPU_M68K)
  57. + || defined(NPY_CPU_M68K) \
  58. + || defined(NPY_CPU_ARCEB)
  59. #define NPY_BYTE_ORDER NPY_BIG_ENDIAN
  60. #else
  61. #error Unknown CPU: can not set endianness
  62. --
  63. 2.7.5