public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hongjiu.lu@intel.com>
To: GNU C Library <libc-alpha@sourceware.org>
Subject: [PATCH] x86-64: Use direct TLS initial-exec access to update errno
Date: Mon, 04 Dec 2017 23:13:00 -0000	[thread overview]
Message-ID: <20171204231315.GA17402@intel.com> (raw)

Replace __errno_location call with direct TLS initial-exec access to
update errno.

Any comments?

H.J.
---
	* sysdeps/x86_64/fpu/s_cosf.S: Use direct TLS initial-exec
	access to update errno.
	* sysdeps/x86_64/fpu/s_sincosf.S: Likewise.
	* sysdeps/x86_64/fpu/s_sinf.S: Likewise.
---
 sysdeps/x86_64/fpu/s_cosf.S    | 11 ++---------
 sysdeps/x86_64/fpu/s_sincosf.S | 11 ++---------
 sysdeps/x86_64/fpu/s_sinf.S    | 11 ++---------
 3 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/sysdeps/x86_64/fpu/s_cosf.S b/sysdeps/x86_64/fpu/s_cosf.S
index 327fd27fd5..33fff5febc 100644
--- a/sysdeps/x86_64/fpu/s_cosf.S
+++ b/sysdeps/x86_64/fpu/s_cosf.S
@@ -310,15 +310,8 @@ L(arg_inf_or_nan):
 	/* Here if |x| is Inf or NAN */
 	jne	L(skip_errno_setting)	/* in case of x is NaN */
 
-	/* Align stack to 16 bytes.  */
-	subq	$8, %rsp
-	cfi_adjust_cfa_offset (8)
-	/* Here if x is Inf. Set errno to EDOM.  */
-	call	JUMPTARGET(__errno_location)
-	addq	$8, %rsp
-	cfi_adjust_cfa_offset (-8)
-
-	movl	$EDOM, (%rax)
+	movq	errno@gottpoff(%rip), %rax
+	movl	$EDOM, %fs:(%rax)
 
 	.p2align	4
 L(skip_errno_setting):
diff --git a/sysdeps/x86_64/fpu/s_sincosf.S b/sysdeps/x86_64/fpu/s_sincosf.S
index f608aa948f..8549537cbb 100644
--- a/sysdeps/x86_64/fpu/s_sincosf.S
+++ b/sysdeps/x86_64/fpu/s_sincosf.S
@@ -354,15 +354,8 @@ L(arg_inf_or_nan):
 	/* Here if |x| is Inf or NAN */
 	jne	L(skip_errno_setting)	/* in case of x is NaN */
 
-	/* Align stack to 16 bytes.  */
-	subq	$8, %rsp
-	cfi_adjust_cfa_offset (8)
-	/* Here if x is Inf. Set errno to EDOM.  */
-	call	JUMPTARGET(__errno_location)
-	addq	$8, %rsp
-	cfi_adjust_cfa_offset (-8)
-
-	movl	$EDOM, (%rax)
+	movq	errno@gottpoff(%rip), %rax
+	movl	$EDOM, %fs:(%rax)
 
 	.p2align	4
 L(skip_errno_setting):
diff --git a/sysdeps/x86_64/fpu/s_sinf.S b/sysdeps/x86_64/fpu/s_sinf.S
index c505d60091..ddf8dedbf9 100644
--- a/sysdeps/x86_64/fpu/s_sinf.S
+++ b/sysdeps/x86_64/fpu/s_sinf.S
@@ -336,15 +336,8 @@ L(arg_inf_or_nan):
 	/* Here if |x| is Inf or NAN */
 	jne	L(skip_errno_setting)	/* in case of x is NaN */
 
-	/* Align stack to 16 bytes.  */
-	subq	$8, %rsp
-	cfi_adjust_cfa_offset (8)
-	/* Here if x is Inf. Set errno to EDOM.  */
-	call	JUMPTARGET(__errno_location)
-	addq	$8, %rsp
-	cfi_adjust_cfa_offset (-8)
-
-	movl	$EDOM, (%rax)
+	movq	errno@gottpoff(%rip), %rax
+	movl	$EDOM, %fs:(%rax)
 
 	.p2align	4
 L(skip_errno_setting):
-- 
2.14.3

             reply	other threads:[~2017-12-04 23:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04 23:13 H.J. Lu [this message]
2017-12-04 23:33 ` Carlos O'Donell
2017-12-05  0:21   ` H.J. Lu
2017-12-05 10:24     ` Szabolcs Nagy
2017-12-05 13:47 ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171204231315.GA17402@intel.com \
    --to=hongjiu.lu@intel.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).