public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] riscv: Use run-time endianess for floating point literals
@ 2023-06-14 11:53 Andreas Schwab
  2023-06-16  0:25 ` Nelson Chu
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2023-06-14 11:53 UTC (permalink / raw)
  To: binutils

gas/
	PR binutils/30551
	* config/tc-riscv.c (md_atof): Use target_big_endian instead of
	TARGET_BYTES_BIG_ENDIAN.
	* testsuite/gas/riscv/float-be.d: New file.
	* testsuite/gas/riscv/float-le.d: New file.
	* testsuite/gas/riscv/float.s: New file.
---
 gas/config/tc-riscv.c              | 2 +-
 gas/testsuite/gas/riscv/float-be.d | 8 ++++++++
 gas/testsuite/gas/riscv/float-le.d | 8 ++++++++
 gas/testsuite/gas/riscv/float.s    | 3 +++
 4 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 gas/testsuite/gas/riscv/float-be.d
 create mode 100644 gas/testsuite/gas/riscv/float-le.d
 create mode 100644 gas/testsuite/gas/riscv/float.s

diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 7684fa7e06d..e915b82eafa 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -3693,7 +3693,7 @@ md_assemble (char *str)
 const char *
 md_atof (int type, char *litP, int *sizeP)
 {
-  return ieee_md_atof (type, litP, sizeP, TARGET_BYTES_BIG_ENDIAN);
+  return ieee_md_atof (type, litP, sizeP, target_big_endian);
 }
 
 void
diff --git a/gas/testsuite/gas/riscv/float-be.d b/gas/testsuite/gas/riscv/float-be.d
new file mode 100644
index 00000000000..ca6b23636ff
--- /dev/null
+++ b/gas/testsuite/gas/riscv/float-be.d
@@ -0,0 +1,8 @@
+# source: float.s
+# objdump: -sj .data
+# as: -mbig-endian
+
+.*:[ 	]+file format .*bigriscv
+
+Contents of section \.data:
+ 0000 3f8ccccd 40019999 9999999a.*
diff --git a/gas/testsuite/gas/riscv/float-le.d b/gas/testsuite/gas/riscv/float-le.d
new file mode 100644
index 00000000000..306abf6ece8
--- /dev/null
+++ b/gas/testsuite/gas/riscv/float-le.d
@@ -0,0 +1,8 @@
+# source: float.s
+# objdump: -sj .data
+# as: -mlittle-endian
+
+.*:[ 	]+file format .*littleriscv
+
+Contents of section \.data:
+ 0000 cdcc8c3f 9a999999 99990140.*
diff --git a/gas/testsuite/gas/riscv/float.s b/gas/testsuite/gas/riscv/float.s
new file mode 100644
index 00000000000..ddc0969595f
--- /dev/null
+++ b/gas/testsuite/gas/riscv/float.s
@@ -0,0 +1,3 @@
+	.data
+	.float	1.1
+	.double	2.2
-- 
2.41.0


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] riscv: Use run-time endianess for floating point literals
  2023-06-14 11:53 [PATCH] riscv: Use run-time endianess for floating point literals Andreas Schwab
@ 2023-06-16  0:25 ` Nelson Chu
  0 siblings, 0 replies; 2+ messages in thread
From: Nelson Chu @ 2023-06-16  0:25 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: binutils

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

Ok, looks good, thanks.

Nelson

On Wed, Jun 14, 2023 at 7:54 PM Andreas Schwab via Binutils <
binutils@sourceware.org> wrote:

> gas/
>         PR binutils/30551
>         * config/tc-riscv.c (md_atof): Use target_big_endian instead of
>         TARGET_BYTES_BIG_ENDIAN.
>         * testsuite/gas/riscv/float-be.d: New file.
>         * testsuite/gas/riscv/float-le.d: New file.
>         * testsuite/gas/riscv/float.s: New file.
> ---
>  gas/config/tc-riscv.c              | 2 +-
>  gas/testsuite/gas/riscv/float-be.d | 8 ++++++++
>  gas/testsuite/gas/riscv/float-le.d | 8 ++++++++
>  gas/testsuite/gas/riscv/float.s    | 3 +++
>  4 files changed, 20 insertions(+), 1 deletion(-)
>  create mode 100644 gas/testsuite/gas/riscv/float-be.d
>  create mode 100644 gas/testsuite/gas/riscv/float-le.d
>  create mode 100644 gas/testsuite/gas/riscv/float.s
>
> diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
> index 7684fa7e06d..e915b82eafa 100644
> --- a/gas/config/tc-riscv.c
> +++ b/gas/config/tc-riscv.c
> @@ -3693,7 +3693,7 @@ md_assemble (char *str)
>  const char *
>  md_atof (int type, char *litP, int *sizeP)
>  {
> -  return ieee_md_atof (type, litP, sizeP, TARGET_BYTES_BIG_ENDIAN);
> +  return ieee_md_atof (type, litP, sizeP, target_big_endian);
>  }
>
>  void
> diff --git a/gas/testsuite/gas/riscv/float-be.d
> b/gas/testsuite/gas/riscv/float-be.d
> new file mode 100644
> index 00000000000..ca6b23636ff
> --- /dev/null
> +++ b/gas/testsuite/gas/riscv/float-be.d
> @@ -0,0 +1,8 @@
> +# source: float.s
> +# objdump: -sj .data
> +# as: -mbig-endian
> +
> +.*:[   ]+file format .*bigriscv
> +
> +Contents of section \.data:
> + 0000 3f8ccccd 40019999 9999999a.*
> diff --git a/gas/testsuite/gas/riscv/float-le.d
> b/gas/testsuite/gas/riscv/float-le.d
> new file mode 100644
> index 00000000000..306abf6ece8
> --- /dev/null
> +++ b/gas/testsuite/gas/riscv/float-le.d
> @@ -0,0 +1,8 @@
> +# source: float.s
> +# objdump: -sj .data
> +# as: -mlittle-endian
> +
> +.*:[   ]+file format .*littleriscv
> +
> +Contents of section \.data:
> + 0000 cdcc8c3f 9a999999 99990140.*
> diff --git a/gas/testsuite/gas/riscv/float.s
> b/gas/testsuite/gas/riscv/float.s
> new file mode 100644
> index 00000000000..ddc0969595f
> --- /dev/null
> +++ b/gas/testsuite/gas/riscv/float.s
> @@ -0,0 +1,3 @@
> +       .data
> +       .float  1.1
> +       .double 2.2
> --
> 2.41.0
>
>
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-16  0:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-14 11:53 [PATCH] riscv: Use run-time endianess for floating point literals Andreas Schwab
2023-06-16  0:25 ` Nelson Chu

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