github.com/aergoio/aergo@v1.3.1/libtool/src/gmp-6.1.2/mpn/x86_64/missing-inline.m4 (about) 1 dnl AMD64 MULX/ADX simulation support, inline version. 2 3 dnl Contributed to the GNU project by Torbjörn Granlund. 4 5 dnl Copyright 2013 Free Software Foundation, Inc. 6 7 dnl This file is part of the GNU MP Library. 8 dnl 9 dnl The GNU MP Library is free software; you can redistribute it and/or modify 10 dnl it under the terms of either: 11 dnl 12 dnl * the GNU Lesser General Public License as published by the Free 13 dnl Software Foundation; either version 3 of the License, or (at your 14 dnl option) any later version. 15 dnl 16 dnl or 17 dnl 18 dnl * the GNU General Public License as published by the Free Software 19 dnl Foundation; either version 2 of the License, or (at your option) any 20 dnl later version. 21 dnl 22 dnl or both in parallel, as here. 23 dnl 24 dnl The GNU MP Library is distributed in the hope that it will be useful, but 25 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 26 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 27 dnl for more details. 28 dnl 29 dnl You should have received copies of the GNU General Public License and the 30 dnl GNU Lesser General Public License along with the GNU MP Library. If not, 31 dnl see https://www.gnu.org/licenses/. 32 33 34 define(`adox',` 35 push $2 36 push %rcx 37 push %rbx 38 push %rax 39 mov $1, %rcx 40 pushfq 41 pushfq 42 C copy 0(%rsp):11 to 0(%rsp):0 43 mov (%rsp), %rbx 44 shr %rbx 45 bt $`'10, %rbx 46 adc %rbx, %rbx 47 mov %rbx, (%rsp) 48 C put manipulated flags into eflags, execute a plain adc 49 popfq 50 adc %rcx, 32(%rsp) 51 C copy CF to 0(%rsp):11 52 mov (%rsp), %rbx 53 sbb R32(%rax), R32(%rax) 54 and $`'0x800, R32(%rax) 55 and $`'0xfffffffffffff7ff, %rbx 56 or %rax, %rbx 57 mov %rbx, (%rsp) 58 C put manipulated flags into eflags 59 popfq 60 pop %rax 61 pop %rbx 62 pop %rcx 63 pop $2 64 ') 65 66 define(`adcx',` 67 push $2 68 push %rcx 69 push %rbx 70 push %rax 71 mov $1, %rcx 72 pushfq 73 adc %rcx, 32(%rsp) 74 mov (%rsp), %rbx 75 sbb R32(%rax), R32(%rax) 76 and $`'0xfffffffffffffffe, %rbx 77 sub %rax, %rbx 78 mov %rbx, (%rsp) 79 popfq 80 pop %rax 81 pop %rbx 82 pop %rcx 83 pop $2 84 ') 85 86 define(`mulx',` 87 lea -16(%rsp), %rsp 88 push %rax 89 push %rdx 90 pushfq C preserve all flags 91 mov $1, %rax 92 mul %rdx 93 mov %rax, 24(%rsp) 94 mov %rdx, 32(%rsp) 95 popfq C restore eflags 96 pop %rdx 97 pop %rax 98 pop $2 99 pop $3 100 ')