Fix bignum.cc build failure on GCC 8 (x86_64)#569
Closed
akhanzode wants to merge 1 commit intogoogle:masterfrom
Closed
Fix bignum.cc build failure on GCC 8 (x86_64)#569akhanzode wants to merge 1 commit intogoogle:masterfrom
akhanzode wants to merge 1 commit intogoogle:masterfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
The _addcarry_u64 and _subborrow_u64 intrinsics require the ADX instruction set extension, which GCC < 9 does not enable by default on x86_64. The existing #ifdef __x86_64__ guard is too broad. Replace with a stricter check that also verifies ADX support: - Clang (all versions support the intrinsics on x86_64) - GCC >= 9 (enables ADX by default) - Any compiler with -madx flag (__ADX__ is defined) On older GCC without ADX, falls through to the existing portable absl::uint128 arithmetic path with no functional change. Fixes google#568
c4ad8f7 to
af2e6d5
Compare
Member
Member
|
You can replace |
Member
|
I think |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
_addcarry_u64and_subborrow_u64intrinsics inbignum.ccrequire the ADX instruction set extension, which GCC < 9 does not enable by default on x86_64. The existing#ifdef __x86_64__guard is too broad, causing build failures on GCC 8.5.0 (the default compiler on Rocky Linux 8 / RHEL 8).Fix
Replace
#ifdef __x86_64__with a stricter check:#if defined(__x86_64__) && (defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 9) || defined(__ADX__))This allows the intrinsics on Clang (all versions), GCC >= 9, or any compiler with
-madx. On older GCC, falls through to the existing portableabsl::uint128arithmetic path with no functional change.Fixes #568