[Gmp-commit] /var/hg/gmp: Fixes to: Enforce proper stack allocation.
mercurial at gmplib.org
mercurial at gmplib.org
Thu Jul 3 00:14:09 UTC 2014
details: /var/hg/gmp/rev/d650c7326db0
changeset: 16448:d650c7326db0
user: Torbjorn Granlund <tege at gmplib.org>
date: Thu Jul 03 02:14:04 2014 +0200
description:
Fixes to: Enforce proper stack allocation.
diffstat:
mpn/x86_64/atom/redc_1.asm | 6 +++++-
mpn/x86_64/bobcat/redc_1.asm | 6 +++++-
mpn/x86_64/core2/divrem_1.asm | 8 +++++---
mpn/x86_64/core2/gcd_1.asm | 4 ++--
mpn/x86_64/core2/redc_1.asm | 6 +++++-
mpn/x86_64/coreihwl/redc_1.asm | 9 ++++++---
mpn/x86_64/coreinhm/redc_1.asm | 6 +++++-
mpn/x86_64/coreisbr/redc_1.asm | 6 +++++-
mpn/x86_64/divrem_1.asm | 16 ++++++++--------
mpn/x86_64/divrem_2.asm | 4 +---
mpn/x86_64/gcd_1.asm | 4 ++--
mpn/x86_64/mod_1_1.asm | 4 +---
mpn/x86_64/mod_1_2.asm | 4 +---
mpn/x86_64/mod_1_4.asm | 4 +---
14 files changed, 52 insertions(+), 35 deletions(-)
diffs (283 lines):
diff -r 44b0a511acff -r d650c7326db0 mpn/x86_64/atom/redc_1.asm
--- a/mpn/x86_64/atom/redc_1.asm Wed Jul 02 22:29:09 2014 +0200
+++ b/mpn/x86_64/atom/redc_1.asm Thu Jul 03 02:14:04 2014 +0200
@@ -276,8 +276,12 @@
mov n, %r9 C param 4: n
mov rp, %rcx ') C param 1: rp
- ASSERT(z, `test $15, %rsp')
+IFSTD(` sub $8, %rsp ')
+IFDOS(` sub $40, %rsp ')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_add_n)
+IFSTD(` add $8, %rsp ')
+IFDOS(` add $40, %rsp ')
L(ret): pop %r15
pop %r14
diff -r 44b0a511acff -r d650c7326db0 mpn/x86_64/bobcat/redc_1.asm
--- a/mpn/x86_64/bobcat/redc_1.asm Wed Jul 02 22:29:09 2014 +0200
+++ b/mpn/x86_64/bobcat/redc_1.asm Thu Jul 03 02:14:04 2014 +0200
@@ -258,8 +258,12 @@
mov n, %r9 C param 4: n
mov rp, %rcx ') C param 1: rp
- ASSERT(z, `test $15, %rsp')
+IFSTD(` sub $8, %rsp ')
+IFDOS(` sub $40, %rsp ')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_add_n)
+IFSTD(` add $8, %rsp ')
+IFDOS(` add $40, %rsp ')
L(ret): pop %r15
pop %r14
diff -r 44b0a511acff -r d650c7326db0 mpn/x86_64/core2/divrem_1.asm
--- a/mpn/x86_64/core2/divrem_1.asm Wed Jul 02 22:29:09 2014 +0200
+++ b/mpn/x86_64/core2/divrem_1.asm Thu Jul 03 02:14:04 2014 +0200
@@ -138,12 +138,14 @@
IFSTD(` push %rdi ')
IFSTD(` push %rsi ')
push %r8
+IFSTD(` sub $8, %rsp ')
IFSTD(` mov d, %rdi ')
-IFDOS(` sub $32, %rsp ')
+IFDOS(` sub $40, %rsp ')
IFDOS(` mov d, %rcx ')
- ASSERT(z, `test $15, %rsp')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_invert_limb)
-IFDOS(` add $32, %rsp ')
+IFSTD(` add $8, %rsp ')
+IFDOS(` add $40, %rsp ')
pop %r8
IFSTD(` pop %rsi ')
IFSTD(` pop %rdi ')
diff -r 44b0a511acff -r d650c7326db0 mpn/x86_64/core2/gcd_1.asm
--- a/mpn/x86_64/core2/gcd_1.asm Wed Jul 02 22:29:09 2014 +0200
+++ b/mpn/x86_64/core2/gcd_1.asm Thu Jul 03 02:14:04 2014 +0200
@@ -108,14 +108,14 @@
IFDOS(` mov %rdx, %r8 ')
IFDOS(` mov %rsi, %rdx ')
IFDOS(` mov %rdi, %rcx ')
- ASSERT(z, `test $15, %rsp')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_mod_1)
jmp L(reduced)
L(bmod):
IFDOS(` mov %rdx, %r8 ')
IFDOS(` mov %rsi, %rdx ')
IFDOS(` mov %rdi, %rcx ')
- ASSERT(z, `test $15, %rsp')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_modexact_1_odd)
L(reduced):
diff -r 44b0a511acff -r d650c7326db0 mpn/x86_64/core2/redc_1.asm
--- a/mpn/x86_64/core2/redc_1.asm Wed Jul 02 22:29:09 2014 +0200
+++ b/mpn/x86_64/core2/redc_1.asm Thu Jul 03 02:14:04 2014 +0200
@@ -280,8 +280,12 @@
mov n, %r9 C param 4: n
mov rp, %rcx ') C param 1: rp
- ASSERT(z, `test $15, %rsp')
+IFSTD(` sub $8, %rsp ')
+IFDOS(` sub $40, %rsp ')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_add_n)
+IFSTD(` add $8, %rsp ')
+IFDOS(` add $40, %rsp ')
L(ret): pop %r15
pop %r14
diff -r 44b0a511acff -r d650c7326db0 mpn/x86_64/coreihwl/redc_1.asm
--- a/mpn/x86_64/coreihwl/redc_1.asm Wed Jul 02 22:29:09 2014 +0200
+++ b/mpn/x86_64/coreihwl/redc_1.asm Thu Jul 03 02:14:04 2014 +0200
@@ -409,7 +409,7 @@
L(cj):
IFSTD(` mov 8(%rsp), %rdi C param 1: rp
- lea 16(%rsp), %rsp C deallocate two slots
+ lea 16-8(%rsp), %rsp C deallocate 2, add back for alignment
lea (up,n,8), %rdx C param 3: up - n
neg R32(n) ') C param 4: n
@@ -418,11 +418,14 @@
neg R32(n)
mov n, %r9 C param 4: n
mov 8(%rsp), %rcx C param 1: rp
- lea 16(%rsp), %rsp ') C deallocate two slots
+ lea -16(%rsp), %rsp ') C deallocate 2, allocate shadow
- ASSERT(z, `test $15, %rsp')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_add_n)
+IFSTD(` lea 8(%rsp), %rsp ')
+IFDOS(` lea 32(%rsp), %rsp ')
+
L(ret): pop %r15
pop %r14
pop %r13
diff -r 44b0a511acff -r d650c7326db0 mpn/x86_64/coreinhm/redc_1.asm
--- a/mpn/x86_64/coreinhm/redc_1.asm Wed Jul 02 22:29:09 2014 +0200
+++ b/mpn/x86_64/coreinhm/redc_1.asm Thu Jul 03 02:14:04 2014 +0200
@@ -276,8 +276,12 @@
mov n, %r9 C param 4: n
mov rp, %rcx ') C param 1: rp
- ASSERT(z, `test $15, %rsp')
+IFSTD(` sub $8, %rsp ')
+IFDOS(` sub $40, %rsp ')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_add_n)
+IFSTD(` add $8, %rsp ')
+IFDOS(` add $40, %rsp ')
L(ret): pop %r15
pop %r14
diff -r 44b0a511acff -r d650c7326db0 mpn/x86_64/coreisbr/redc_1.asm
--- a/mpn/x86_64/coreisbr/redc_1.asm Wed Jul 02 22:29:09 2014 +0200
+++ b/mpn/x86_64/coreisbr/redc_1.asm Thu Jul 03 02:14:04 2014 +0200
@@ -282,8 +282,12 @@
mov n, %r9 C param 4: n
mov rp, %rcx ') C param 1: rp
- ASSERT(z, `test $15, %rsp')
+IFSTD(` sub $8, %rsp ')
+IFDOS(` sub $40, %rsp ')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_add_n)
+IFSTD(` add $8, %rsp ')
+IFDOS(` add $40, %rsp ')
L(ret): pop %r15
pop %r14
diff -r 44b0a511acff -r d650c7326db0 mpn/x86_64/divrem_1.asm
--- a/mpn/x86_64/divrem_1.asm Wed Jul 02 22:29:09 2014 +0200
+++ b/mpn/x86_64/divrem_1.asm Thu Jul 03 02:14:04 2014 +0200
@@ -139,14 +139,12 @@
IFSTD(` push %rdi ')
IFSTD(` push %rsi ')
push %r8
-IFSTD(` sub $8, %rsp ')
IFSTD(` mov d, %rdi ')
-IFDOS(` sub $40, %rsp ')
+IFDOS(` sub $32, %rsp ')
IFDOS(` mov d, %rcx ')
- ASSERT(z, `test $15, %rsp')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_invert_limb)
-IFSTD(` add $8, %rsp ')
-IFDOS(` add $40, %rsp ')
+IFDOS(` add $32, %rsp ')
pop %r8
IFSTD(` pop %rsi ')
IFSTD(` pop %rdi ')
@@ -205,12 +203,14 @@
IFSTD(` push %rdi ')
IFSTD(` push %rsi ')
push %r8
+IFSTD(` sub $8, %rsp ')
IFSTD(` mov d, %rdi ')
-IFDOS(` sub $32, %rsp ')
+IFDOS(` sub $40, %rsp ')
IFDOS(` mov d, %rcx ')
- ASSERT(z, `test $15, %rsp')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_invert_limb)
-IFDOS(` add $32, %rsp ')
+IFSTD(` add $8, %rsp ')
+IFDOS(` add $40, %rsp ')
pop %r8
IFSTD(` pop %rsi ')
IFSTD(` pop %rdi ')
diff -r 44b0a511acff -r d650c7326db0 mpn/x86_64/divrem_2.asm
--- a/mpn/x86_64/divrem_2.asm Wed Jul 02 22:29:09 2014 +0200
+++ b/mpn/x86_64/divrem_2.asm Thu Jul 03 02:14:04 2014 +0200
@@ -98,12 +98,10 @@
push %r8
push %r10
push %r11
- sub $8, %rsp C stack alignment
IFSTD(` mov %r11, %rdi ')
IFDOS(` mov %r11, %rcx ')
- ASSERT(z, `test $15, %rsp')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_invert_limb)
- add $8, %rsp C stack alignment
pop %r11
pop %r10
pop %r8
diff -r 44b0a511acff -r d650c7326db0 mpn/x86_64/gcd_1.asm
--- a/mpn/x86_64/gcd_1.asm Wed Jul 02 22:29:09 2014 +0200
+++ b/mpn/x86_64/gcd_1.asm Thu Jul 03 02:14:04 2014 +0200
@@ -112,7 +112,7 @@
IFDOS(` mov %rdx, %r8 ')
IFDOS(` mov %rsi, %rdx ')
IFDOS(` mov %rdi, %rcx ')
- ASSERT(z, `test $15, %rsp')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_modexact_1_odd)
L(reduced):
@@ -135,7 +135,7 @@
IFDOS(` mov %rdx, %r8 ')
IFDOS(` mov %rsi, %rdx ')
IFDOS(` mov %rdi, %rcx ')
- ASSERT(z, `test $15, %rsp')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_mod_1)
jmp L(reduced)
diff -r 44b0a511acff -r d650c7326db0 mpn/x86_64/mod_1_1.asm
--- a/mpn/x86_64/mod_1_1.asm Wed Jul 02 22:29:09 2014 +0200
+++ b/mpn/x86_64/mod_1_1.asm Thu Jul 03 02:14:04 2014 +0200
@@ -196,12 +196,10 @@
mov %rsi, %r12
mov R32(%rcx), R32(%rbp)
sal R8(%rcx), %r12
- sub $8, %rsp C stack alignment
IFSTD(` mov %r12, %rdi ') C pass parameter
IFDOS(` mov %r12, %rcx ') C pass parameter
- ASSERT(z, `test $15, %rsp')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_invert_limb)
- add $8, %rsp C stack alignment
neg %r12
mov %r12, %r8
mov %rax, (%rbx) C store bi
diff -r 44b0a511acff -r d650c7326db0 mpn/x86_64/mod_1_2.asm
--- a/mpn/x86_64/mod_1_2.asm Wed Jul 02 22:29:09 2014 +0200
+++ b/mpn/x86_64/mod_1_2.asm Thu Jul 03 02:14:04 2014 +0200
@@ -181,12 +181,10 @@
mov %rsi, %r12
mov R32(%rcx), R32(%rbp) C preserve cnt over call
sal R8(%rcx), %r12 C b << cnt
- sub $8, %rsp C stack alignment
IFSTD(` mov %r12, %rdi ') C pass parameter
IFDOS(` mov %r12, %rcx ') C pass parameter
- ASSERT(z, `test $15, %rsp')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_invert_limb)
- add $8, %rsp C stack alignment
mov %r12, %r8
mov %rax, %r11
mov %rax, (%rbx) C store bi
diff -r 44b0a511acff -r d650c7326db0 mpn/x86_64/mod_1_4.asm
--- a/mpn/x86_64/mod_1_4.asm Wed Jul 02 22:29:09 2014 +0200
+++ b/mpn/x86_64/mod_1_4.asm Thu Jul 03 02:14:04 2014 +0200
@@ -188,12 +188,10 @@
mov %rsi, %r12
mov R32(%rcx), R32(%rbp) C preserve cnt over call
sal R8(%rcx), %r12 C b << cnt
- sub $8, %rsp C stack alignment
IFSTD(` mov %r12, %rdi ') C pass parameter
IFDOS(` mov %r12, %rcx ') C pass parameter
- ASSERT(z, `test $15, %rsp')
+ ASSERT(nz, `test $15, %rsp')
CALL( mpn_invert_limb)
- add $8, %rsp C stack alignment
mov %r12, %r8
mov %rax, %r11
mov %rax, (%rbx) C store bi
More information about the gmp-commit
mailing list