- Updates the assembly code to use @peterdettman's parallel multiplication algorithm.
- Convert the YASM code to inline asm blocks.
Convert YASM code to inline assembly #128
pull sipa wants to merge 3 commits into bitcoin-core:master from sipa:inlineasm changing 9 files +514 −590-
sipa commented at 3:23 PM on December 2, 2014: contributor
- sipa cross-referenced this on Dec 2, 2014 from issue Portability fixups by luke-jr
-
gmaxwell commented at 3:28 PM on December 2, 2014: contributor
Any performance impact?
-
gmaxwell commented at 3:28 PM on December 2, 2014: contributor
This is going to be MSVC incompatible. Do we care?
- sipa force-pushed on Dec 2, 2014
-
sipa commented at 3:31 PM on December 2, 2014: contributor
-
jgarzik commented at 3:33 PM on December 2, 2014: none
+1 If the inline asm conditions are properly and fully specified, sometimes the code is slightly more efficient, as the compiler has more information to work with.
-
gmaxwell commented at 3:38 PM on December 2, 2014: contributor
Chatter from bitcoin-dev
07:34 @gmaxwell (MSFT decided that for 64-bit they were not going to support inline asm... apparently windows developers were disrupting msft's portability hopes by needlessly writing too much of their software in ASM.) 07:34 @gmaxwell sipa: yes, assuming someone adds yasm to their msvc setup. 07:34 < sipa> well, if MSFT doesn't like app developers writing ASM, they won't get any ASM... 07:34 @gmaxwell instead they'd have to add GCC to it. :) 07:35 @gmaxwell I am not arguing against it. Just making sure we know and are all okay with it. I certantly am okay with it.
(I support this, and would have ACKed right away too except it'll take me a bit to review and test)
- sipa force-pushed on Dec 2, 2014
- sipa force-pushed on Dec 2, 2014
- sipa force-pushed on Dec 2, 2014
- sipa cross-referenced this on Dec 2, 2014 from issue Rewrite field assembly to match the C version by sipa
- sipa force-pushed on Dec 2, 2014
-
gmaxwell commented at 10:23 AM on December 3, 2014: contributor
So on a fedora host here, gcc version 4.8.3 20140624 (Red Hat 4.8.3-1) (GCC)
w/ endomorphism configure: Using field implementation: 64bit_asm configure: Using bignum implementation: gmp configure: Using scalar implementation: 64bit
bench_sign and bench_verify are segfaulting. The tests pass, however.
segfault is at 0x0000000000400b59 <+25>: push %rbp 0x0000000000400b5a <+26>: mov %rdx,%r15 0x0000000000400b5d <+29>: mov (%rsi),%r10 0x0000000000400b60 <+32>: mov 0x8(%rsi),%r11 0x0000000000400b64 <+36>: mov 0x10(%rsi),%r12 0x0000000000400b68 <+40>: mov 0x18(%rsi),%r13 0x0000000000400b6c <+44>: mov 0x20(%rsi),%r14 0x0000000000400b70 <+48>: movabs $0x1000003d10,%rbp => 0x0000000000400b7a <+58>: mov (%r15),%rax 0x0000000000400b7d <+61>: mul %r13
Importantly: the tests crash too if I compile them without -DVERIFY. (I'd kinda worried we'd run into something like this eventually... the verify stuff is stirring the optimizer) Crashes go away at O0.
- sipa force-pushed on Dec 3, 2014
-
gmaxwell commented at 7:18 PM on December 3, 2014: contributor
It's gratitiously incompatible with clang (at least some commonly deployed versions): http://llvm.org/bugs/show_bug.cgi?id=18916
- sipa force-pushed on Dec 3, 2014
-
sipa commented at 8:35 PM on December 3, 2014: contributor
Gah, to be compatible with OSX we need att_syntax? :(
-
gmaxwell commented at 11:22 PM on December 3, 2014: contributor
You broke it now. :)
- sipa force-pushed on Dec 4, 2014
-
sipa commented at 12:02 AM on December 4, 2014: contributor
Converted to att syntax :(
- sipa force-pushed on Dec 4, 2014
- sipa force-pushed on Dec 4, 2014
- sipa force-pushed on Dec 4, 2014
-
Rewrite field assembly to match the C version f048615970
-
Convert YASM code into inline assembly 67935050e1
-
Make {mul,sqr}_inner use the same argument order as {mul,sqr} b2c9681c6f
- sipa force-pushed on Dec 4, 2014
-
gmaxwell commented at 1:03 PM on December 7, 2014: contributor
ACK.
- sipa merged this on Dec 7, 2014
- sipa closed this on Dec 7, 2014
- sipa referenced this in commit 376b28b096 on Dec 7, 2014