From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8678 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: status of armhf asm with VFP instructions Date: Fri, 16 Oct 2015 01:58:09 +0200 Message-ID: <20151015235809.GY10551@port70.net> References: <20151015223320.GW10551@port70.net> <20151015224425.GA8645@brightrain.aerifal.cx> <20151015231606.GX10551@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="WlEyl6ow+jlIgNUh" X-Trace: ger.gmane.org 1444953515 27366 80.91.229.3 (15 Oct 2015 23:58:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 15 Oct 2015 23:58:35 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8690-gllmg-musl=m.gmane.org@lists.openwall.com Fri Oct 16 01:58:35 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZmsPg-0005XQ-IE for gllmg-musl@m.gmane.org; Fri, 16 Oct 2015 01:58:24 +0200 Original-Received: (qmail 5893 invoked by uid 550); 15 Oct 2015 23:58:21 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 5867 invoked from network); 15 Oct 2015 23:58:21 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <20151015231606.GX10551@port70.net> User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:8678 Archived-At: --WlEyl6ow+jlIgNUh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * Szabolcs Nagy [2015-10-16 01:16:07 +0200]: > * Rich Felker [2015-10-15 18:44:25 -0400]: > > It seems we're already using the new forms vsqrt and vabs in > > src/math/armhf/*.s. So using vmrs/vmsr presumably will not break > > support for any toolchains that work now. > > > > vmrs/vmsr can break on old binutils versions (2.18 - 2.20) and > 2.20 is not that ancient.. is that ok? > attached the old armhf patch with updated commit message. --WlEyl6ow+jlIgNUh Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-fix-armhf-asm-to-use-.fpu-vfp-and-UAL-mnemonics.patch" >From 542d4003a60320ac0446b156681c59cbc19dd6a1 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Tue, 21 Jul 2015 20:00:03 +0000 Subject: [PATCH] fix armhf asm to use .fpu vfp and UAL mnemonics (1) Some armhf gcc toolchains (built with --with-float=hard but without --with-fpu=vfp*) do not pass -mfpu=vfp to the assembler and then binutils rejects the UAL mnemonics for VFP unless there is an .fpu vfp directive in the asm source. (2) binutils <= 2.17 does not support UAL VFP syntax, and vmrs/vmsr insns are only recognised in binutils >= 2.21. (3) clang builtin assembler does not support the old mnemonics (except a few with warnings). Added .fpu vfp directive to all armhf asm which use VFP instructions to solve (1) (only backward compatible VFPv1 instructions are used), dropped support for binutils < 2.21 and replaced mcr/mrc with vmsr/vmrs. The generated code should not be changed by this commit. --- src/fenv/armhf/fenv.s | 22 ++++++++++++---------- src/math/armhf/fabs.s | 1 + src/math/armhf/fabsf.s | 1 + src/math/armhf/sqrt.s | 1 + src/math/armhf/sqrtf.s | 1 + 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/fenv/armhf/fenv.s b/src/fenv/armhf/fenv.s index 387234b..2621422 100644 --- a/src/fenv/armhf/fenv.s +++ b/src/fenv/armhf/fenv.s @@ -1,17 +1,19 @@ +.fpu vfp + .global fegetround .type fegetround,%function fegetround: - mrc p10, 7, r0, cr1, cr0, 0 + vmrs r0, fpscr and r0, r0, #0xc00000 bx lr .global __fesetround .type __fesetround,%function __fesetround: - mrc p10, 7, r3, cr1, cr0, 0 + vmrs r3, fpscr bic r3, r3, #0xc00000 orr r3, r3, r0 - mcr p10, 7, r3, cr1, cr0, 0 + vmsr fpscr, r3 mov r0, #0 bx lr @@ -19,7 +21,7 @@ __fesetround: .type fetestexcept,%function fetestexcept: and r0, r0, #0x1f - mrc p10, 7, r3, cr1, cr0, 0 + vmrs r3, fpscr and r0, r0, r3 bx lr @@ -27,9 +29,9 @@ fetestexcept: .type feclearexcept,%function feclearexcept: and r0, r0, #0x1f - mrc p10, 7, r3, cr1, cr0, 0 + vmrs r3, fpscr bic r3, r3, r0 - mcr p10, 7, r3, cr1, cr0, 0 + vmsr fpscr, r3 mov r0, #0 bx lr @@ -37,16 +39,16 @@ feclearexcept: .type feraiseexcept,%function feraiseexcept: and r0, r0, #0x1f - mrc p10, 7, r3, cr1, cr0, 0 + vmrs r3, fpscr orr r3, r3, r0 - mcr p10, 7, r3, cr1, cr0, 0 + vmsr fpscr, r3 mov r0, #0 bx lr .global fegetenv .type fegetenv,%function fegetenv: - mrc p10, 7, r3, cr1, cr0, 0 + vmrs r3, fpscr str r3, [r0] mov r0, #0 bx lr @@ -57,6 +59,6 @@ fesetenv: cmn r0, #1 moveq r3, #0 ldrne r3, [r0] - mcr p10, 7, r3, cr1, cr0, 0 + vmsr fpscr, r3 mov r0, #0 bx lr diff --git a/src/math/armhf/fabs.s b/src/math/armhf/fabs.s index 2bdebff..8a705e1 100644 --- a/src/math/armhf/fabs.s +++ b/src/math/armhf/fabs.s @@ -1,3 +1,4 @@ +.fpu vfp .text .global fabs .type fabs,%function diff --git a/src/math/armhf/fabsf.s b/src/math/armhf/fabsf.s index 35c720f..2c7beb6 100644 --- a/src/math/armhf/fabsf.s +++ b/src/math/armhf/fabsf.s @@ -1,3 +1,4 @@ +.fpu vfp .text .global fabsf .type fabsf,%function diff --git a/src/math/armhf/sqrt.s b/src/math/armhf/sqrt.s index 99fe64b..90f74a9 100644 --- a/src/math/armhf/sqrt.s +++ b/src/math/armhf/sqrt.s @@ -1,3 +1,4 @@ +.fpu vfp .text .global sqrt .type sqrt,%function diff --git a/src/math/armhf/sqrtf.s b/src/math/armhf/sqrtf.s index 9ea519f..91d8ad6 100644 --- a/src/math/armhf/sqrtf.s +++ b/src/math/armhf/sqrtf.s @@ -1,3 +1,4 @@ +.fpu vfp .text .global sqrtf .type sqrtf,%function -- 2.4.1 --WlEyl6ow+jlIgNUh--