git: 0764680cf8fd - stable/13 - Fix arm64 build after llvm 18.1.3 upgrade (take 2)

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 20 Apr 2024 10:34:47 UTC
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=0764680cf8fdcd53b781a54c1a697bddedb075da

commit 0764680cf8fdcd53b781a54c1a697bddedb075da
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-04-07 09:23:06 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-04-20 10:29:09 +0000

    Fix arm64 build after llvm 18.1.3 upgrade (take 2)
    
    Instead of compiling the whole sys/arm64/arm64/vfp.c file without
    -mgeneral-regs-only, which might have unwanted side effects, add
    ".arch_extension fp" / ".arch_extension nofp" pairs to the inline
    assembly.
    
    PR:             276104
    Suggested by:   andrew
    MFC after:      1 month
    
    (cherry picked from commit 61e482f2fcd53bbc7fd3d4cc8b7df79d5d57d75c)
---
 sys/arm64/arm64/vfp.c | 4 ++++
 sys/conf/files.arm64  | 3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/arm64/arm64/vfp.c b/sys/arm64/arm64/vfp.c
index 9cdeb751f81a..01f52dad271e 100644
--- a/sys/arm64/arm64/vfp.c
+++ b/sys/arm64/arm64/vfp.c
@@ -105,6 +105,7 @@ vfp_store(struct vfpstate *state)
 
 	vfp_state = state->vfp_regs;
 	__asm __volatile(
+	    ".arch_extension fp\n"
 	    "mrs	%0, fpcr		\n"
 	    "mrs	%1, fpsr		\n"
 	    "stp	q0,  q1,  [%2, #16 *  0]\n"
@@ -123,6 +124,7 @@ vfp_store(struct vfpstate *state)
 	    "stp	q26, q27, [%2, #16 * 26]\n"
 	    "stp	q28, q29, [%2, #16 * 28]\n"
 	    "stp	q30, q31, [%2, #16 * 30]\n"
+	    ".arch_extension nofp\n"
 	    : "=&r"(fpcr), "=&r"(fpsr) : "r"(vfp_state));
 
 	state->vfp_fpcr = fpcr;
@@ -140,6 +142,7 @@ vfp_restore(struct vfpstate *state)
 	fpsr = state->vfp_fpsr;
 
 	__asm __volatile(
+	    ".arch_extension fp\n"
 	    "ldp	q0,  q1,  [%2, #16 *  0]\n"
 	    "ldp	q2,  q3,  [%2, #16 *  2]\n"
 	    "ldp	q4,  q5,  [%2, #16 *  4]\n"
@@ -158,6 +161,7 @@ vfp_restore(struct vfpstate *state)
 	    "ldp	q30, q31, [%2, #16 * 30]\n"
 	    "msr	fpcr, %0		\n"
 	    "msr	fpsr, %1		\n"
+	    ".arch_extension nofp\n"
 	    : : "r"(fpcr), "r"(fpsr), "r"(vfp_state));
 }
 
diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64
index f72f5718ac19..bb593a8f9a01 100644
--- a/sys/conf/files.arm64
+++ b/sys/conf/files.arm64
@@ -76,8 +76,7 @@ arm64/arm64/uio_machdep.c			standard
 arm64/arm64/uma_machdep.c			standard
 arm64/arm64/undefined.c				standard
 arm64/arm64/unwind.c				optional ddb | kdtrace_hooks | stack
-arm64/arm64/vfp.c				standard \
-	compile-with "${NORMAL_C:N-mgeneral-regs-only}"
+arm64/arm64/vfp.c				standard
 arm64/arm64/vm_machdep.c			standard
 
 arm64/coresight/coresight.c			standard