From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: status of armhf asm with VFP instructions
Date: Fri, 16 Oct 2015 01:58:09 +0200 [thread overview]
Message-ID: <20151015235809.GY10551@port70.net> (raw)
In-Reply-To: <20151015231606.GX10551@port70.net>
[-- Attachment #1: Type: text/plain, Size: 481 bytes --]
* Szabolcs Nagy <nsz@port70.net> [2015-10-16 01:16:07 +0200]:
> * Rich Felker <dalias@libc.org> [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.
[-- Attachment #2: 0001-fix-armhf-asm-to-use-.fpu-vfp-and-UAL-mnemonics.patch --]
[-- Type: text/x-diff, Size: 3509 bytes --]
From 542d4003a60320ac0446b156681c59cbc19dd6a1 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
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
next prev parent reply other threads:[~2015-10-15 23:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-15 22:33 Szabolcs Nagy
2015-10-15 22:44 ` Rich Felker
2015-10-15 23:16 ` Szabolcs Nagy
2015-10-15 23:58 ` Szabolcs Nagy [this message]
2015-10-19 6:12 ` Rich Felker
2015-10-16 0:00 ` Rich Felker
2015-10-16 0:33 ` Szabolcs Nagy
2015-10-16 1:03 ` Rich Felker
2015-10-16 3:23 ` Rich Felker
2015-10-16 6:42 ` Khem Raj
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=20151015235809.GY10551@port70.net \
--to=nsz@port70.net \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).