riscv: Use run-time endianess for floating point literals
authorAndreas Schwab <schwab@suse.de>
Tue, 13 Jun 2023 12:49:38 +0000 (14:49 +0200)
committerAndreas Schwab <schwab@suse.de>
Mon, 19 Jun 2023 07:15:14 +0000 (09:15 +0200)
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
gas/testsuite/gas/riscv/float-be.d [new file with mode: 0644]
gas/testsuite/gas/riscv/float-le.d [new file with mode: 0644]
gas/testsuite/gas/riscv/float.s [new file with mode: 0644]

index 7684fa7e06d5e5815318e2a8eba277fd96ffac85..e915b82eafae5cf7e13c204ebda0756d79860d18 100644 (file)
@@ -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 (file)
index 0000000..ca6b236
--- /dev/null
@@ -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 (file)
index 0000000..306abf6
--- /dev/null
@@ -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 (file)
index 0000000..ddc0969
--- /dev/null
@@ -0,0 +1,3 @@
+       .data
+       .float  1.1
+       .double 2.2