Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
build: verify that the assembler can handle crc32 functions #10806
Conversation
|
@theuni I'm confused why the old code wouldn't build the sse library with the correct flags? |
fanquake
added the
Build system
label
Jul 12, 2017
|
@sipa This addresses 2 things:
I think 2 is what you're asking about? If so, it wouldn't work before because, even though the user has specified -msse4.2 (or -march=native, or whatever it takes to get the intrinsics working), our build wouldn't have the necessary make option set here: https://github.com/bitcoin/bitcoin/blob/master/src/Makefile.leveldb.include#L145, so the necessary define wouldn't be added. |
|
Going to test. |
|
Interesting. On OpenBSD 6.1:
Then when running gmake:
So somehow it works while running configure, but not while building confused. |
|
@laanwj Grr, I checked an asm dump of the test to make sure that the crc32s are actually emitted, but it looks like I forgot to test with -O2. Indeed with optims on, they're optimized out. I'll add something to use the result. |
|
@theuni this solves it: diff --git a/configure.ac b/configure.ac
index 5c3dac648..6b5d891fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -262,9 +262,10 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#endif
]],[[
uint64_t l = 0;
- l = _mm_crc32_u8(0, 0);
- l = _mm_crc32_u32(0, 0);
- l = _mm_crc32_u64(0, 0);
+ l = _mm_crc32_u8(l, 0);
+ l = _mm_crc32_u32(l, 0);
+ l = _mm_crc32_u64(l, 0);
+ return l;
]])],
[ AC_MSG_RESULT(yes); enable_hwcrc32=yes],
[ AC_MSG_RESULT(no)] |
|
@laanwj Aha. I was messing with printf to force it to stay around, I didn't realize that the test function was "int main()". That makes total sense and is really good to know! Pushed with your fix. |
|
Tested ACK d34d77a |
laanwj
merged commit d34d77a
into
bitcoin:master
Jul 14, 2017
1 check passed
laanwj
added a commit
that referenced
this pull request
Jul 14, 2017
|
|
laanwj |
db825d2
|
theuni commentedJul 12, 2017
Also, enable crc32 even if -msse4.2 wasn't added by us, as long as it works. This allows custom flags (such as -march=native) to work as expected.
Addresses #10670.