aarch64: Add support for the fpmr system register

Message ID 20240426150026.1415320-1-claudio.bantaloukas@arm.com
State New
Headers
Series aarch64: Add support for the fpmr system register |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Testing failed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Testing passed

Commit Message

Claudio Bantaloukas April 26, 2024, 3 p.m. UTC
  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
  

Comments

Victor Do Nascimento April 30, 2024, 9:33 a.m. UTC | #1
Hi Claudio,

Patch looks good.  Any CI failures at this stage are to be expected, 
given how this patch is dependent on the upstreaming of my own FP8 patches.

Hopefully, once we have the relevant approval for this patch, we can 
push all FP8-related changes at once.  The idea behind pushing 
everything together comes from the fact that any FP8 work makes little 
sense without the necessary fpmr system-register enablement - which 
you've added here.

Thanks for doing this!
V.

On 4/26/24 16:00, Claudio Bantaloukas wrote:
> 
> 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-r.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
>
  
Victor Do Nascimento May 16, 2024, 12:30 p.m. UTC | #2
Quick update Claudio,

As the FP8 command-line flags have now been upstreamed, I suspect your 
patch will now build correctly against the master branch of Binutils. 
I'm hoping this will unblock the approval of your patch.

Cheers!

On 4/26/24 16:00, Claudio Bantaloukas wrote:
> 
> 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
>
  
Richard Earnshaw (lists) May 17, 2024, 4:22 p.m. UTC | #3
On 26/04/2024 16:00, Claudio Bantaloukas wrote:
> 
> 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
> 

This is OK.  But could you please add to the commit message something related to the fact that we've chosen to gate this with FEAT_FP8 rather than FEAT_FPMR as the latter only adds this register and FP8 requires this feature.

R.
  

Patch

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))