Rewrite the logic to check for CRC32 at runtime#3072
Merged
leggettc18 merged 10 commits intoHarbourMasters:develop-sulufrom Aug 12, 2023
Merged
Rewrite the logic to check for CRC32 at runtime#3072leggettc18 merged 10 commits intoHarbourMasters:develop-sulufrom
leggettc18 merged 10 commits intoHarbourMasters:develop-sulufrom
Conversation
Malkierian
reviewed
Jul 14, 2023
Contributor
Malkierian
left a comment
There was a problem hiding this comment.
I feel like this needs a bit of code clarification.
soh/soh/Extractor/FastCrc32C.c
Outdated
|
|
||
| #if ((defined(__llvm__) && defined(__x86_64__) || defined(__i386__))) | ||
| #pragma clang attribute pop | ||
| #elif ((defined(__GNUC__) && defined(__x86_64__) || defined(__i386__))) |
soh/soh/Extractor/FastCrc32C.c
Outdated
| #include <immintrin.h> | ||
| #elif ((defined(__GNUC__) && defined(__x86_64__) || defined(__i386__)) && defined(__SSE4_2__)) | ||
| #include <intrin.h> | ||
| #elif ((defined(__GNUC__) && defined(__x86_64__) || defined(__i386__))) |
soh/soh/Extractor/FastCrc32C.c
Outdated
| // Clang will define both __llvm__ and __GNUC__ but GCC will only define __GNUC__. So we need to check for __llvm__ first. | ||
| #if ((defined(__llvm__) && defined(__x86_64__) || defined(__i386__))) | ||
| #pragma clang attribute push(__attribute__((target("crc32"))), apply_to = function) | ||
| #elif ((defined(__GNUC__) && defined(__x86_64__) || defined(__i386__))) |
soh/soh/Extractor/FastCrc32C.c
Outdated
|
|
||
| // Force the compiler to assume we have support for the CRC32 intrinsic. We will check for our selves later. | ||
| // Clang will define both __llvm__ and __GNUC__ but GCC will only define __GNUC__. So we need to check for __llvm__ first. | ||
| #if ((defined(__llvm__) && defined(__x86_64__) || defined(__i386__))) |
Contributor
There was a problem hiding this comment.
I may not be able to follow the entirety of the code, but this mix of && and || doesn't seem to be properly isolated. I find it hard to follow what the groupings are supposed to be. is it (llvm && x86_64) || i386, or llvm && (x86_64 || i386?
Contributor
There was a problem hiding this comment.
Oh, great, I added them out of order XD.
Contributor
|
@louist103 what's the status of this? Is it good to go? |
Contributor
Author
Just tested it on M1. Seems good to me. |
garrettjoecox
approved these changes
Aug 8, 2023
Contributor
|
Since we know this fixes issues that users are facing in our support channels, I think this might be better suited for |
b387cd5 to
7994cd9
Compare
briaguya0
approved these changes
Aug 11, 2023
Archez
approved these changes
Aug 11, 2023
leggettc18
approved these changes
Aug 12, 2023
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.
Some users of older AMD CPUs have issues with the CRC intrinsic not being supported on their CPU leading to a crash. This changes the logic to check for the instruction at run time before running the CRC check on the rom.
Build Artifacts