[Gmp-commit] /var/hg/gmp: Enforce proper stack allocation.
mercurial at gmplib.org
mercurial at gmplib.org
Wed Jul 2 14:49:38 UTC 2014
details: /var/hg/gmp/rev/c32093b0c771
changeset: 16446:c32093b0c771
user: Torbjorn Granlund <tege at gmplib.org>
date: Wed Jul 02 16:49:34 2014 +0200
description:
Enforce proper stack allocation.
diffstat:
ChangeLog | 17 +++++++++++++++++
mpn/x86_64/atom/redc_1.asm | 1 +
mpn/x86_64/bobcat/redc_1.asm | 1 +
mpn/x86_64/core2/divrem_1.asm | 6 +++++-
mpn/x86_64/core2/gcd_1.asm | 2 ++
mpn/x86_64/core2/redc_1.asm | 1 +
mpn/x86_64/coreihwl/redc_1.asm | 1 +
mpn/x86_64/coreinhm/redc_1.asm | 1 +
mpn/x86_64/coreisbr/redc_1.asm | 1 +
mpn/x86_64/divrem_1.asm | 18 +++++++++++++-----
mpn/x86_64/divrem_2.asm | 5 ++++-
mpn/x86_64/gcd_1.asm | 2 ++
mpn/x86_64/mod_1_1.asm | 5 ++++-
mpn/x86_64/mod_1_2.asm | 5 ++++-
mpn/x86_64/mod_1_4.asm | 5 ++++-
15 files changed, 61 insertions(+), 10 deletions(-)
diffs (truncated from 331 to 300 lines):
diff -r 0a75dba2147e -r c32093b0c771 ChangeLog
--- a/ChangeLog Mon Jun 30 17:36:31 2014 +0200
+++ b/ChangeLog Wed Jul 02 16:49:34 2014 +0200
@@ -1,3 +1,20 @@
+2014-07-02 Torbjörn Granlund <tege at gmplib.org>
+
+ mpn/x86_64/atom/redc_1.asm: Enforce proper stack allocation.
+ mpn/x86_64/bobcat/redc_1.asm: Likewise.
+ mpn/x86_64/core2/divrem_1.asm: Likewise.
+ mpn/x86_64/core2/gcd_1.asm: Likewise.
+ mpn/x86_64/core2/redc_1.asm: Likewise.
+ mpn/x86_64/coreihwl/redc_1.asm: Likewise.
+ mpn/x86_64/coreinhm/redc_1.asm: Likewise.
+ mpn/x86_64/coreisbr/redc_1.asm: Likewise.
+ mpn/x86_64/divrem_1.asm: Likewise.
+ mpn/x86_64/divrem_2.asm: Likewise.
+ mpn/x86_64/gcd_1.asm: Likewise.
+ mpn/x86_64/mod_1_1.asm: Likewise.
+ mpn/x86_64/mod_1_2.asm: Likewise.
+ mpn/x86_64/mod_1_4.asm: Likewise.
+
2014-06-30 Torbjörn Granlund <tege at gmplib.org>
* config.sub: Generalise x86 patterns.
diff -r 0a75dba2147e -r c32093b0c771 mpn/x86_64/atom/redc_1.asm
--- a/mpn/x86_64/atom/redc_1.asm Mon Jun 30 17:36:31 2014 +0200
+++ b/mpn/x86_64/atom/redc_1.asm Wed Jul 02 16:49:34 2014 +0200
@@ -276,6 +276,7 @@
mov n, %r9 C param 4: n
mov rp, %rcx ') C param 1: rp
+ ASSERT(z, `test $15, %rsp')
CALL( mpn_add_n)
L(ret): pop %r15
diff -r 0a75dba2147e -r c32093b0c771 mpn/x86_64/bobcat/redc_1.asm
--- a/mpn/x86_64/bobcat/redc_1.asm Mon Jun 30 17:36:31 2014 +0200
+++ b/mpn/x86_64/bobcat/redc_1.asm Wed Jul 02 16:49:34 2014 +0200
@@ -258,6 +258,7 @@
mov n, %r9 C param 4: n
mov rp, %rcx ') C param 1: rp
+ ASSERT(z, `test $15, %rsp')
CALL( mpn_add_n)
L(ret): pop %r15
diff -r 0a75dba2147e -r c32093b0c771 mpn/x86_64/core2/divrem_1.asm
--- a/mpn/x86_64/core2/divrem_1.asm Mon Jun 30 17:36:31 2014 +0200
+++ b/mpn/x86_64/core2/divrem_1.asm Wed Jul 02 16:49:34 2014 +0200
@@ -1,6 +1,6 @@
dnl x86-64 mpn_divrem_1 -- mpn by limb division.
-dnl Copyright 2004, 2005, 2007-2010, 2012 Free Software Foundation, Inc.
+dnl Copyright 2004, 2005, 2007-2010, 2012, 2014 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -139,8 +139,11 @@
IFSTD(` push %rsi ')
push %r8
IFSTD(` mov d, %rdi ')
+IFDOS(` sub $32, %rsp ')
IFDOS(` mov d, %rcx ')
+ ASSERT(z, `test $15, %rsp')
CALL( mpn_invert_limb)
+IFDOS(` add $32, %rsp ')
pop %r8
IFSTD(` pop %rsi ')
IFSTD(` pop %rdi ')
@@ -150,6 +153,7 @@
mov %rbp, %rax
test un, un
je L(frac)
+
L(ent): mov -8(up,un,8), %rbp
shr R8(%rcx), %rax
shld R8(%rcx), %rbp, %rax
diff -r 0a75dba2147e -r c32093b0c771 mpn/x86_64/core2/gcd_1.asm
--- a/mpn/x86_64/core2/gcd_1.asm Mon Jun 30 17:36:31 2014 +0200
+++ b/mpn/x86_64/core2/gcd_1.asm Wed Jul 02 16:49:34 2014 +0200
@@ -108,12 +108,14 @@
IFDOS(` mov %rdx, %r8 ')
IFDOS(` mov %rsi, %rdx ')
IFDOS(` mov %rdi, %rcx ')
+ ASSERT(z, `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')
CALL( mpn_modexact_1_odd)
L(reduced):
diff -r 0a75dba2147e -r c32093b0c771 mpn/x86_64/core2/redc_1.asm
--- a/mpn/x86_64/core2/redc_1.asm Mon Jun 30 17:36:31 2014 +0200
+++ b/mpn/x86_64/core2/redc_1.asm Wed Jul 02 16:49:34 2014 +0200
@@ -280,6 +280,7 @@
mov n, %r9 C param 4: n
mov rp, %rcx ') C param 1: rp
+ ASSERT(z, `test $15, %rsp')
CALL( mpn_add_n)
L(ret): pop %r15
diff -r 0a75dba2147e -r c32093b0c771 mpn/x86_64/coreihwl/redc_1.asm
--- a/mpn/x86_64/coreihwl/redc_1.asm Mon Jun 30 17:36:31 2014 +0200
+++ b/mpn/x86_64/coreihwl/redc_1.asm Wed Jul 02 16:49:34 2014 +0200
@@ -420,6 +420,7 @@
mov 8(%rsp), %rcx C param 1: rp
lea 16(%rsp), %rsp ') C deallocate two slots
+ ASSERT(z, `test $15, %rsp')
CALL( mpn_add_n)
L(ret): pop %r15
diff -r 0a75dba2147e -r c32093b0c771 mpn/x86_64/coreinhm/redc_1.asm
--- a/mpn/x86_64/coreinhm/redc_1.asm Mon Jun 30 17:36:31 2014 +0200
+++ b/mpn/x86_64/coreinhm/redc_1.asm Wed Jul 02 16:49:34 2014 +0200
@@ -276,6 +276,7 @@
mov n, %r9 C param 4: n
mov rp, %rcx ') C param 1: rp
+ ASSERT(z, `test $15, %rsp')
CALL( mpn_add_n)
L(ret): pop %r15
diff -r 0a75dba2147e -r c32093b0c771 mpn/x86_64/coreisbr/redc_1.asm
--- a/mpn/x86_64/coreisbr/redc_1.asm Mon Jun 30 17:36:31 2014 +0200
+++ b/mpn/x86_64/coreisbr/redc_1.asm Wed Jul 02 16:49:34 2014 +0200
@@ -282,6 +282,7 @@
mov n, %r9 C param 4: n
mov rp, %rcx ') C param 1: rp
+ ASSERT(z, `test $15, %rsp')
CALL( mpn_add_n)
L(ret): pop %r15
diff -r 0a75dba2147e -r c32093b0c771 mpn/x86_64/divrem_1.asm
--- a/mpn/x86_64/divrem_1.asm Mon Jun 30 17:36:31 2014 +0200
+++ b/mpn/x86_64/divrem_1.asm Wed Jul 02 16:49:34 2014 +0200
@@ -1,6 +1,6 @@
dnl x86-64 mpn_divrem_1 -- mpn by limb division.
-dnl Copyright 2004, 2005, 2007-2012 Free Software Foundation, Inc.
+dnl Copyright 2004, 2005, 2007-2012, 2014 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -139,9 +139,14 @@
IFSTD(` push %rdi ')
IFSTD(` push %rsi ')
push %r8
+IFSTD(` sub $8, %rsp ')
IFSTD(` mov d, %rdi ')
+IFDOS(` sub $40, %rsp ')
IFDOS(` mov d, %rcx ')
+ ASSERT(z, `test $15, %rsp')
CALL( mpn_invert_limb)
+IFSTD(` add $8, %rsp ')
+IFDOS(` add $40, %rsp ')
pop %r8
IFSTD(` pop %rsi ')
IFSTD(` pop %rdi ')
@@ -173,7 +178,7 @@
jns L(ntop) C
xor R32(%rcx), R32(%rcx)
- jmp L(87)
+ jmp L(frac)
L(nfx): sub d, %rax
inc %r13
@@ -201,8 +206,11 @@
IFSTD(` push %rsi ')
push %r8
IFSTD(` mov d, %rdi ')
+IFDOS(` sub $32, %rsp ')
IFDOS(` mov d, %rcx ')
+ ASSERT(z, `test $15, %rsp')
CALL( mpn_invert_limb)
+IFDOS(` add $32, %rsp ')
pop %r8
IFSTD(` pop %rsi ')
IFSTD(` pop %rdi ')
@@ -211,7 +219,7 @@
mov %rax, dinv
mov %rbp, %rax
test un, un
- je L(87)
+ je L(frac)
L(uent):dec un
mov (up,un,8), %rbp
@@ -266,7 +274,7 @@
jae L(efx)
L(eok): mov %r13, (qp)
sub $8, qp
- jmp L(87)
+ jmp L(frac)
L(ufx): sub d, %rax
inc %r13
@@ -275,7 +283,7 @@
inc %r13
jmp L(eok)
-L(87): mov d, %rbp
+L(frac):mov d, %rbp
neg %rbp
jmp L(fent)
diff -r 0a75dba2147e -r c32093b0c771 mpn/x86_64/divrem_2.asm
--- a/mpn/x86_64/divrem_2.asm Mon Jun 30 17:36:31 2014 +0200
+++ b/mpn/x86_64/divrem_2.asm Wed Jul 02 16:49:34 2014 +0200
@@ -1,6 +1,6 @@
dnl x86-64 mpn_divrem_2 -- Divide an mpn number by a normalized 2-limb number.
-dnl Copyright 2007, 2008, 2010 Free Software Foundation, Inc.
+dnl Copyright 2007, 2008, 2010, 2014 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -98,9 +98,12 @@
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')
CALL( mpn_invert_limb)
+ add $8, %rsp C stack alignment
pop %r11
pop %r10
pop %r8
diff -r 0a75dba2147e -r c32093b0c771 mpn/x86_64/gcd_1.asm
--- a/mpn/x86_64/gcd_1.asm Mon Jun 30 17:36:31 2014 +0200
+++ b/mpn/x86_64/gcd_1.asm Wed Jul 02 16:49:34 2014 +0200
@@ -112,6 +112,7 @@
IFDOS(` mov %rdx, %r8 ')
IFDOS(` mov %rsi, %rdx ')
IFDOS(` mov %rdi, %rcx ')
+ ASSERT(z, `test $15, %rsp')
CALL( mpn_modexact_1_odd)
L(reduced):
@@ -134,6 +135,7 @@
IFDOS(` mov %rdx, %r8 ')
IFDOS(` mov %rsi, %rdx ')
IFDOS(` mov %rdi, %rcx ')
+ ASSERT(z, `test $15, %rsp')
CALL( mpn_mod_1)
jmp L(reduced)
diff -r 0a75dba2147e -r c32093b0c771 mpn/x86_64/mod_1_1.asm
--- a/mpn/x86_64/mod_1_1.asm Mon Jun 30 17:36:31 2014 +0200
+++ b/mpn/x86_64/mod_1_1.asm Wed Jul 02 16:49:34 2014 +0200
@@ -2,7 +2,7 @@
dnl Contributed to the GNU project by Torbjörn Granlund and Niels Möller.
-dnl Copyright 2009-2012 Free Software Foundation, Inc.
+dnl Copyright 2009-2012, 2014 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -196,9 +196,12 @@
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')
CALL( mpn_invert_limb)
+ add $8, %rsp C stack alignment
neg %r12
mov %r12, %r8
mov %rax, (%rbx) C store bi
diff -r 0a75dba2147e -r c32093b0c771 mpn/x86_64/mod_1_2.asm
--- a/mpn/x86_64/mod_1_2.asm Mon Jun 30 17:36:31 2014 +0200
+++ b/mpn/x86_64/mod_1_2.asm Wed Jul 02 16:49:34 2014 +0200
@@ -2,7 +2,7 @@
dnl Contributed to the GNU project by Torbjorn Granlund.
-dnl Copyright 2009-2012 Free Software Foundation, Inc.
+dnl Copyright 2009-2012, 2014 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -181,9 +181,12 @@
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
More information about the gmp-commit
mailing list