Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUG, DIST: fix normalize IBMZ features flags #20588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions numpy/distutils/ccompiler_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1009,7 +1013,7 @@ def __init__(self):
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
Expand Down Expand Up @@ -1090,7 +1094,9 @@ def cc_normalize_flags(self, flags):
_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
Expand Down
6 changes: 5 additions & 1 deletion numpy/distutils/tests/test_ccompiler_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ def test_flags(self):
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(
Expand All @@ -467,6 +467,10 @@ def test_flags(self):
"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 (
Expand Down