build: verify that the assembler can handle crc32 functions#10806
build: verify that the assembler can handle crc32 functions#10806laanwj merged 1 commit intobitcoin:masterfrom
Conversation
|
@theuni I'm confused why the old code wouldn't build the sse library with the correct flags? |
|
@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)] |
393708c to
d34d77a
Compare
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.
|
@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 |
…ions d34d77a build: verify that the assembler can handle crc32 functions (Cory Fields) Pull request description: 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. Tree-SHA512: e1a41a87b078d270bc645814315b229ad9c16556a4d14fb66b27a65b28d0caf9bf324f8c1e221854992aa17f53466eece06faebbf74d59b3d4ff2e6db6c614a4
…c32 functions d34d77a build: verify that the assembler can handle crc32 functions (Cory Fields) Pull request description: 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.
…2 functions d34d77a build: verify that the assembler can handle crc32 functions (Cory Fields) Pull request description: 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 bitcoin#10670. Tree-SHA512: e1a41a87b078d270bc645814315b229ad9c16556a4d14fb66b27a65b28d0caf9bf324f8c1e221854992aa17f53466eece06faebbf74d59b3d4ff2e6db6c614a4
Update LevelDB to upstream commit f545dfabf Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#7911 - bitcoin/bitcoin#7982 - bitcoin/bitcoin#8133 - bitcoin/bitcoin#8784 - Only the missing changes. - bitcoin/bitcoin#8826 - bitcoin/bitcoin#8613 - bitcoin/bitcoin#10544 - bitcoin/bitcoin#10633 - Only the changes to files and code we have. - bitcoin/bitcoin#10806 - bitcoin/bitcoin#10958 - bitcoin/bitcoin#12451 - bitcoin/bitcoin#13925 - bitcoin/bitcoin#15270 This upgrades LevelDB in the exact same commit progression as upstream, up to January 2019.
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.