public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Claudio Bantaloukas <claudio.bantaloukas@arm.com>
To: <claudio.bantaloukas@arm.com>, <binutils@sourceware.org>,
	<Victor.DoNascimento@arm.com>
Cc: <nd@arm.com>
Subject: [PATCH] aarch64: Add support for the fpmr system register
Date: Fri, 26 Apr 2024 15:00:26 +0000	[thread overview]
Message-ID: <20240426150026.1415320-1-claudio.bantaloukas@arm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]


AArch64 defines a read-write system register called fpmr.
This floating point mode register controls behaviours of the FP8 instructions.
This patch adds support for reading and writing along with relevant tests.
Regression tested on the aarch64-none-elf and aarch64-none-linux-gnu targets
and no regressions were found.

---

Hi,

Is this Ok for master? I do not have commit rights, if OK, can someone commit on my behalf please?

Thanks,
Claudio Bantaloukas

 .../gas/aarch64/sysreg/fp8-feature-enables-fpmr.d    | 12 ++++++++++++
 .../gas/aarch64/sysreg/fpmr-unsupported-by-default.d |  4 ++++
 .../gas/aarch64/sysreg/fpmr-unsupported-by-default.l |  3 +++
 gas/testsuite/gas/aarch64/sysreg/fpmr.s              |  4 ++++
 opcodes/aarch64-sys-regs.def                         |  1 +
 5 files changed, 24 insertions(+)
 create mode 100644 gas/testsuite/gas/aarch64/sysreg/fp8-feature-enables-fpmr.d
 create mode 100644 gas/testsuite/gas/aarch64/sysreg/fpmr-unsupported-by-default.d
 create mode 100644 gas/testsuite/gas/aarch64/sysreg/fpmr-unsupported-by-default.l
 create mode 100644 gas/testsuite/gas/aarch64/sysreg/fpmr.s


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-aarch64-Add-support-for-the-fpmr-system-register.patch --]
[-- Type: text/x-patch; name="0001-aarch64-Add-support-for-the-fpmr-system-register.patch", Size: 2435 bytes --]

diff --git a/gas/testsuite/gas/aarch64/sysreg/fp8-feature-enables-fpmr.d b/gas/testsuite/gas/aarch64/sysreg/fp8-feature-enables-fpmr.d
new file mode 100644
index 00000000000..edef376de87
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/sysreg/fp8-feature-enables-fpmr.d
@@ -0,0 +1,12 @@
+#name: Test that fpmr register is gated and available via the fp8 feature
+#source: fpmr.s
+#as: -march=armv9.2-a+fp8
+#objdump: -dr
+
+.*:     file format .*
+
+Disassembly of section \.text:
+
+0+ <.*>:
+   0:	d53b4440 	mrs	x0, fpmr
+   4:	d51b4440 	msr	fpmr, x0
diff --git a/gas/testsuite/gas/aarch64/sysreg/fpmr-unsupported-by-default.d b/gas/testsuite/gas/aarch64/sysreg/fpmr-unsupported-by-default.d
new file mode 100644
index 00000000000..c0b30c2e149
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/sysreg/fpmr-unsupported-by-default.d
@@ -0,0 +1,4 @@
+#name: Test that fpmr register is not supported by default
+#source: fpmr.s
+#as: -march=armv9.2-a
+#error_output: fpmr-unsupported-by-default.l
diff --git a/gas/testsuite/gas/aarch64/sysreg/fpmr-unsupported-by-default.l b/gas/testsuite/gas/aarch64/sysreg/fpmr-unsupported-by-default.l
new file mode 100644
index 00000000000..43de01860c4
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/sysreg/fpmr-unsupported-by-default.l
@@ -0,0 +1,3 @@
+[^:]*: Assembler messages:
+.*: Error: selected processor does not support system register name 'fpmr'
+.*: Error: selected processor does not support system register name 'fpmr'
diff --git a/gas/testsuite/gas/aarch64/sysreg/fpmr.s b/gas/testsuite/gas/aarch64/sysreg/fpmr.s
new file mode 100644
index 00000000000..302847daaba
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/sysreg/fpmr.s
@@ -0,0 +1,4 @@
+	.text
+
+  mrs x0, fpmr
+  msr fpmr, x0
diff --git a/opcodes/aarch64-sys-regs.def b/opcodes/aarch64-sys-regs.def
index 8b65673a5d6..fabcea1fc7d 100644
--- a/opcodes/aarch64-sys-regs.def
+++ b/opcodes/aarch64-sys-regs.def
@@ -423,6 +423,7 @@
   SYSREG ("far_el3",		CPENC (3,6,6,0,0),	0,			AARCH64_NO_FEATURES)
   SYSREG ("fpcr",		CPENC (3,3,4,4,0),	0,			AARCH64_NO_FEATURES)
   SYSREG ("fpexc32_el2",	CPENC (3,4,5,3,0),	0,			AARCH64_NO_FEATURES)
+  SYSREG ("fpmr",		CPENC (3,3,4,4,2),	F_ARCHEXT,		AARCH64_FEATURE (FP8))
   SYSREG ("fpsr",		CPENC (3,3,4,4,1),	0,			AARCH64_NO_FEATURES)
   SYSREG ("gcspr_el0",		CPENC (3,3,2,5,1),    	F_ARCHEXT,		AARCH64_FEATURE (GCS))
   SYSREG ("gcspr_el1",		CPENC (3,0,2,5,1),    	F_ARCHEXT,		AARCH64_FEATURE (GCS))

             reply	other threads:[~2024-04-26 15:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26 15:00 Claudio Bantaloukas [this message]
2024-04-30  9:33 ` Victor Do Nascimento

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=20240426150026.1415320-1-claudio.bantaloukas@arm.com \
    --to=claudio.bantaloukas@arm.com \
    --cc=Victor.DoNascimento@arm.com \
    --cc=binutils@sourceware.org \
    --cc=nd@arm.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.
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).