/* Chars that mean this number is a floating point constant.
As in 0f12.456 or 0d1.2345e12. */
-const char FLT_CHARS[] = "rRsSfFdDxXpPhH";
+const char FLT_CHARS[] = "rRsSfFdDxXpPhHbB";
/* Indicate ELF attributes are explicitly set. */
static bool explicit_attr = false;
{"attribute", s_riscv_attribute, 0},
{"variant_cc", s_variant_cc, 0},
{"float16", float_cons, 'h'},
+ {"bfloat16", float_cons, 'b'},
{ NULL, NULL, 0 },
};
@code{Tag_RISCV_unaligned_access}, @code{Tag_RISCV_priv_spec},
@code{Tag_RISCV_priv_spec_minor}, @code{Tag_RISCV_priv_spec_revision}.
+@cindex @code{.bfloat16} directive, RISC-V
+@item .bfloat16 @var{value}
+Floating point constructors for the bfloat16 type, example usage:
+
+@smallexample
+ .bfloat16 12.0
+ .bfloat16 NaN
+ .bfloat16 0b:ffc1
+@end smallexample
+
@end table
@node RISC-V-Modifiers
--- /dev/null
+# source: bfloat16.s
+# objdump: -sj .data
+# as: -mbig-endian
+
+.*:[ ]+file format .*
+
+Contents of section \.data:
+ 0000 41403dfc 000042f7 8000c2f7 7fff7f80.*
+ 0010 ff807f7f ff7f0080 80800001 8001007f.*
+ 0020 807f3f80 bf804000 c000ffc1 ff81.*
--- /dev/null
+# source: bfloat16.s
+# objdump: -sj .data
+# as: -mlittle-endian
+
+.*:[ ]+file format .*
+
+Contents of section \.data:
+ 0000 4041fc3d 0000f742 0080f7c2 ff7f807f.*
+ 0010 80ff7f7f 7fff8000 80800100 01807f00.*
+ 0020 7f80803f 80bf0040 00c0c1ff 81ff.*
--- /dev/null
+ .data
+ .bfloat16 12.0
+ .bfloat16 0.123
+ .bfloat16 +0.0
+ .bfloat16 123.4
+ .bfloat16 -0.0
+ .bfloat16 -123.4
+ .bfloat16 NaN
+ .bfloat16 Inf
+ .bfloat16 -Inf
+ .bfloat16 3.390e+38
+ .bfloat16 -3.390e+38
+ .bfloat16 1.175e-38
+ .bfloat16 -1.175e-38
+ .bfloat16 9.194e-41
+ .bfloat16 -9.194e-41
+ .bfloat16 1.167e-38
+ .bfloat16 -1.167e-38
+ .bfloat16 1.0, -1, 2.0, -2
+ .bfloat16 0b:ffc1
+ .bfloat16 0B:ff81