From patchwork Wed Jun 22 15:41:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 13306 Received: (qmail 79682 invoked by alias); 22 Jun 2016 15:41:43 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 79670 invoked by uid 89); 22 Jun 2016 15:41:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_50, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=9, 10, orl, fnstsw, 9, 6 X-HELO: relay1.mentorg.com Date: Wed, 22 Jun 2016 15:41:26 +0000 From: Joseph Myers To: Subject: Simplify x86 nearbyint functions [committed] Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 The i386 implementations of nearbyint functions, and x86_64 nearbyintl, contain code to mask the "inexact" exception. However, the fnstenv instruction has the effect of masking all exceptions, so this masking code has been redundant since fnstenv was added to those implementations (by commit 846d9a4a3acdb4939ca7bf6aed48f9f6f26911be; commit 71d1b0166b4ace0d804af2993b3815758b852efc added the test math/test-nearbyint-except-2.c that verifies these functions do work when called with "inexact" traps enabled); this patch removes the redundant code. Tested for x86_64 and x86. Committed. 2016-06-22 Joseph Myers * sysdeps/i386/fpu/s_nearbyint.S (__nearbyint): Do not mask "inexact" exceptions after fnstenv. * sysdeps/i386/fpu/s_nearbyintf.S (__nearbyintf): Likewise. * sysdeps/i386/fpu/s_nearbyintl.S (__nearbyintl): Likewise. * sysdeps/x86_64/fpu/s_nearbyintl.S (__nearbyintl): Likewise. diff --git a/sysdeps/i386/fpu/s_nearbyint.S b/sysdeps/i386/fpu/s_nearbyint.S index 8da8ae9..f7b79b6 100644 --- a/sysdeps/i386/fpu/s_nearbyint.S +++ b/sysdeps/i386/fpu/s_nearbyint.S @@ -11,10 +11,6 @@ ENTRY(__nearbyint) subl $32, %esp cfi_adjust_cfa_offset (32) fnstenv 4(%esp) - movl 4(%esp), %eax - orl $0x20, %eax - movl %eax, (%esp) - fldcw (%esp) frndint fldenv 4(%esp) addl $32, %esp diff --git a/sysdeps/i386/fpu/s_nearbyintf.S b/sysdeps/i386/fpu/s_nearbyintf.S index 0c51f72..92df2f8 100644 --- a/sysdeps/i386/fpu/s_nearbyintf.S +++ b/sysdeps/i386/fpu/s_nearbyintf.S @@ -11,10 +11,6 @@ ENTRY(__nearbyintf) subl $32, %esp cfi_adjust_cfa_offset (32) fnstenv 4(%esp) - movl 4(%esp), %eax - orl $0x20, %eax - movl %eax, (%esp) - fldcw (%esp) frndint fldenv 4(%esp) addl $32, %esp diff --git a/sysdeps/i386/fpu/s_nearbyintl.S b/sysdeps/i386/fpu/s_nearbyintl.S index b260ab5..3b7d1e2 100644 --- a/sysdeps/i386/fpu/s_nearbyintl.S +++ b/sysdeps/i386/fpu/s_nearbyintl.S @@ -11,10 +11,6 @@ ENTRY(__nearbyintl) subl $32, %esp cfi_adjust_cfa_offset (32) fnstenv 4(%esp) - movl 4(%esp), %eax - orl $0x20, %eax - movl %eax, (%esp) - fldcw (%esp) frndint fnstsw andl $0x1, %eax diff --git a/sysdeps/x86_64/fpu/s_nearbyintl.S b/sysdeps/x86_64/fpu/s_nearbyintl.S index 76d41bd..31b21a5 100644 --- a/sysdeps/x86_64/fpu/s_nearbyintl.S +++ b/sysdeps/x86_64/fpu/s_nearbyintl.S @@ -9,10 +9,6 @@ ENTRY(__nearbyintl) fldt 8(%rsp) fnstenv -28(%rsp) - movl -28(%rsp), %eax - orl $0x20, %eax - movl %eax, -32(%rsp) - fldcw -32(%rsp) frndint fnstsw andl $0x1, %eax