summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2021-12-15 10:44:21 -0700
committerGitHub <noreply@github.com>2021-12-15 10:44:21 -0700
commit06e37a3e6e48f06a3ff4010b4ad88e4b001184fb (patch)
treeb91465b42f9c2871e16aa979d02a829b9c0b872c
parentd3881b360367d2e5b1e44efcb6653c82c36ca68c (diff)
parent3e8123046a686b952e3c624b00b3502406033339 (diff)
downloadnumpy-06e37a3e6e48f06a3ff4010b4ad88e4b001184fb.tar.gz
Merge pull request #20588 from seiko2plus/ccopt_test_implies_flags
BUG, DIST: fix normalize IBMZ features flags
-rw-r--r--numpy/distutils/ccompiler_opt.py12
-rw-r--r--numpy/distutils/tests/test_ccompiler_opt.py6
2 files changed, 14 insertions, 4 deletions
diff --git a/numpy/distutils/ccompiler_opt.py b/numpy/distutils/ccompiler_opt.py
index e020d96ee..f1d024b94 100644
--- a/numpy/distutils/ccompiler_opt.py
+++ b/numpy/distutils/ccompiler_opt.py
@@ -899,7 +899,11 @@ class _CCompiler:
cc_on_x64 : bool
True when the target architecture is 64-bit x86
cc_on_ppc64 : bool
- True when the target architecture is 64-bit big-endian PowerPC
+ True when the target architecture is 64-bit big-endian powerpc
+ cc_on_ppc64le : bool
+ True when the target architecture is 64-bit litle-endian powerpc
+ cc_on_s390x : bool
+ True when the target architecture is IBM/ZARCH on linux
cc_on_armhf : bool
True when the target architecture is 32-bit ARMv7+
cc_on_aarch64 : bool
@@ -1009,7 +1013,7 @@ class _CCompiler:
self.cc_is_gcc = True
self.cc_march = "unknown"
- for arch in ("x86", "x64", "ppc64", "ppc64le",
+ for arch in ("x86", "x64", "ppc64", "ppc64le",
"armhf", "aarch64", "s390x"):
if getattr(self, "cc_on_" + arch):
self.cc_march = arch
@@ -1090,7 +1094,9 @@ class _CCompiler:
_cc_normalize_unix_frgx = re.compile(
# 2- to remove any flags starts with
# -march, -mcpu, -x(INTEL) and '-m' without '='
- r"^(?!(-mcpu=|-march=|-x[A-Z0-9\-]))(?!-m[a-z0-9\-\.]*.$)"
+ r"^(?!(-mcpu=|-march=|-x[A-Z0-9\-]|-m[a-z0-9\-\.]*.$))|"
+ # exclude:
+ r"(?:-mzvector)"
)
_cc_normalize_unix_krgx = re.compile(
# 3- keep only the highest of
diff --git a/numpy/distutils/tests/test_ccompiler_opt.py b/numpy/distutils/tests/test_ccompiler_opt.py
index 6d42cc172..6f9970c75 100644
--- a/numpy/distutils/tests/test_ccompiler_opt.py
+++ b/numpy/distutils/tests/test_ccompiler_opt.py
@@ -443,7 +443,7 @@ class _Test_CCompilerOpt:
ppc64_clang="-maltivec -mvsx -mpower8-vector",
armhf_gcc="-mfpu=neon-fp16 -mfp16-format=ieee",
aarch64="",
- s390="-mzvector -march=arch12"
+ s390x="-mzvector -march=arch12"
)
# testing normalize -march
self.expect_flags(
@@ -467,6 +467,10 @@ class _Test_CCompilerOpt:
"asimddp asimdhp asimdfhm",
aarch64_gcc=r"-march=armv8.2-a\+dotprod\+fp16\+fp16fml"
)
+ self.expect_flags(
+ "vx vxe vxe2",
+ s390x=r"-mzvector -march=arch13"
+ )
def test_targets_exceptions(self):
for targets in (