8000 BUG: Fix compile-time test of POPCNT by charris · Pull Request #19074 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Fix compile-time test of POPCNT #19074

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 2 commits into from
May 23, 2021

Conversation

charris
Copy link
Member
@charris charris commented May 23, 2021

Backport of #19071.

The compile-time test of POPCNT, cpu_popcnt.c produced code that would
execute without error even if the machine didn't support the popcnt
instruction. This patch changes the test so that it attempts to use popcnt on
random numbers so the compiler can't substitute the answer at compile
time. Resolves issue #19067.

cmichal2 added 2 commits May 23, 2021 13:04
The compile-time test of POPCNT, cpu_popcnt.c produced code that would
execute without error even if the machine didn't support the popcnt
instruction. This patch attempts to use popcnt on random numbers so the
compiler can't substitute the answer at compile time.
_builtin_popcount is always available, so the compile-time check always
succeeds.
@charris charris added 00 - Bug component: numpy.distutils 08 - Backport Used to tag backport PRs component: SIMD Issues in SIMD (fast instruction sets) code or machinery 36 - Build Build related PR labels May 23, 2021
@charris charris added this to the 1.21.0 release milestone May 23, 2021
@charris charris merged commit 32b0261 into numpy:maintenance/1.21.x May 23, 2021
@charris charris deleted the backport-19071 branch May 23, 2021 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug 08 - Backport Used to tag backport PRs 36 - Build Build related PR component: numpy.distutils component: SIMD Issues in SIMD (fast instruction sets) code or machinery
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
31AD
0