public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] riscv: Use run-time endianess for floating point literals
Date: Mon, 19 Jun 2023 07:15:39 +0000 (GMT)	[thread overview]
Message-ID: <20230619071539.B62E83858D3C@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=71a75b51a62b5cbc12c68b9c4d1dcae0f8a59263

commit 71a75b51a62b5cbc12c68b9c4d1dcae0f8a59263
Author: Andreas Schwab <schwab@suse.de>
Date:   Tue Jun 13 14:49:38 2023 +0200

    riscv: Use run-time endianess for floating point literals
    
    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.

Diff:
---
 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(-)

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

                 reply	other threads:[~2023-06-19  7:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230619071539.B62E83858D3C@sourceware.org \
    --to=schwab@sourceware.org \
    --cc=bfd-cvs@sourceware.org \
    /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).