summaryrefslogtreecommitdiff
path: root/mpn/x86
diff options
context:
space:
mode:
authorTorbjorn Granlund <tege@gmplib.org>2014-07-27 16:40:23 +0200
committerTorbjorn Granlund <tege@gmplib.org>2014-07-27 16:40:23 +0200
commitde5056f90ea675a3ec6b0a790121c47002723ad5 (patch)
tree0b5b38853fdb2c03443aa010fd777cc9db1f3b57 /mpn/x86
parent15be4cf02e634b331b8eef36c7558533fdb38712 (diff)
downloadgmp-de5056f90ea675a3ec6b0a790121c47002723ad5.tar.gz
Rewrite LEA, add LEAL.
Diffstat (limited to 'mpn/x86')
-rw-r--r--mpn/x86/darwin.m418
-rw-r--r--mpn/x86/x86-defs.m440
2 files changed, 48 insertions, 10 deletions
diff --git a/mpn/x86/darwin.m4 b/mpn/x86/darwin.m4
index b90b39161..02dca0822 100644
--- a/mpn/x86/darwin.m4
+++ b/mpn/x86/darwin.m4
@@ -1,5 +1,5 @@
divert(-1)
-dnl Copyright 2007, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2007, 2011, 2012, 2014 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -31,6 +31,7 @@ define(`DARWIN')
dnl Usage LEA(symbol,reg)
+dnl Usage LEAL(symbol_local_to_file,reg)
dnl
dnl We maintain lists of stuff to append in load_eip and darwin_bd. The
dnl `index' stuff is needed to suppress repeated definitions. To avoid
@@ -61,6 +62,21 @@ L($1`'$non_lazy_ptr):
movl `$'$1, $2
')')
+define(`LEAL',
+m4_assert_numargs(2)
+`ifdef(`PIC',`
+ifelse(index(defn(`load_eip'), `$2'),-1,
+`m4append(`load_eip',
+`L(movl_eip_`'substr($2,1)):
+ movl (%esp), $2
+ ret_internal
+')')
+ call L(movl_eip_`'substr($2,1))
+ leal $1-.($2), $2
+',`
+ movl `$'$1, $2
+')')
+
dnl ASM_END
diff --git a/mpn/x86/x86-defs.m4 b/mpn/x86/x86-defs.m4
index fe2012507..4bba13ea6 100644
--- a/mpn/x86/x86-defs.m4
+++ b/mpn/x86/x86-defs.m4
@@ -1,10 +1,8 @@
divert(-1)
-
dnl m4 macros for x86 assembler.
-
-dnl Copyright 1999-2003, 2007, 2010, 2012 Free Software Foundation, Inc.
+dnl Copyright 1999-2003, 2007, 2010, 2012, 2014 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -954,16 +952,17 @@ m4_assert_numargs(1)
dnl Usage LEA(symbol,reg)
+dnl Usage LEAL(symbol_local_to_file,reg)
define(`LEA',
m4_assert_numargs(2)
-`ifdef(`PIC',`
-define(`ASM_END',
-`
-L(movl_eip_`'substr($2,1)):
+`ifdef(`PIC',`dnl
+ifelse(index(defn(`load_eip'), `$2'),-1,
+`m4append(`load_eip',
+`L(movl_eip_`'substr($2,1)):
movl (%esp), $2
- ret_internal')
-
+ ret_internal
+')')dnl
call L(movl_eip_`'substr($2,1))
addl $_GLOBAL_OFFSET_TABLE_, $2
movl $1@GOT($2), $2
@@ -971,6 +970,29 @@ L(movl_eip_`'substr($2,1)):
movl `$'$1, $2
')')
+define(`LEAL',
+m4_assert_numargs(2)
+`ifdef(`PIC',`dnl
+ifelse(index(defn(`load_eip'), `$2'),-1,
+`m4append(`load_eip',
+`L(movl_eip_`'substr($2,1)):
+ movl (%esp), $2
+ ret_internal
+')')dnl
+ call L(movl_eip_`'substr($2,1))
+ addl $_GLOBAL_OFFSET_TABLE_, $2
+ leal $1@GOTOFF($2), $2
+',`
+ movl `$'$1, $2
+')')
+
+dnl ASM_END
+
+define(`ASM_END',`load_eip')
+
+define(`load_eip', `') dnl updated in LEA/LEAL
+
+
define(`DEF_OBJECT',
m4_assert_numargs_range(1,2)
`RODATA