This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH][binutils][Arm] Float16: Fix test failures for non ELF targets.
On Thu, Aug 15, 2019 at 04:21:59PM +0000, Barnaby Wilks wrote:
> diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
> index 840aff2115642eef07356cfc6e811afee78e2134..729e4830912b70245c3ee994ffcd648a0e793f25 100644
> --- a/gas/config/tc-arm.c
> +++ b/gas/config/tc-arm.c
> @@ -1247,7 +1247,7 @@ md_atof (int type, char * litP, int * sizeP)
> }
> else
> {
> - if (ARM_CPU_HAS_FEATURE (cpu_variant, fpu_endian_pure))
> + if (ARM_CPU_HAS_FEATURE (cpu_variant, fpu_endian_pure) || prec == 1)
> for (i = prec - 1; i >= 0; i--)
> {
> md_number_to_chars (litP, (valueT) words[i], sizeof (LITTLENUM_TYPE));
Thanks, I applied a slightly different version, putting the prec == 1
test earlier and making the style consistent regarding use of braces
inside an "if".
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 3ac707ce62..51c6c87e40 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2019-08-19 Barnaby Wilks <Barnaby.Wilks@arm.com>
+
+ * config/tc-arm.c (md_atof): Add precision check. Formatting.
+
2019-08-15 Nick Clifton <nickc@redhat.com>
* po/sv.po: Updated Swedish translation.
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index e2b21ed915..c58748dfaa 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -1237,34 +1237,29 @@ md_atof (int type, char * litP, int * sizeP)
input_line_pointer = t;
*sizeP = prec * sizeof (LITTLENUM_TYPE);
- if (target_big_endian)
- {
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i], sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- }
+ if (target_big_endian || prec == 1)
+ for (i = 0; i < prec; i++)
+ {
+ md_number_to_chars (litP, (valueT) words[i], sizeof (LITTLENUM_TYPE));
+ litP += sizeof (LITTLENUM_TYPE);
+ }
+ else if (ARM_CPU_HAS_FEATURE (cpu_variant, fpu_endian_pure))
+ for (i = prec - 1; i >= 0; i--)
+ {
+ md_number_to_chars (litP, (valueT) words[i], sizeof (LITTLENUM_TYPE));
+ litP += sizeof (LITTLENUM_TYPE);
+ }
else
- {
- if (ARM_CPU_HAS_FEATURE (cpu_variant, fpu_endian_pure))
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litP, (valueT) words[i], sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- else
- /* For a 4 byte float the order of elements in `words' is 1 0.
- For an 8 byte float the order is 1 0 3 2. */
- for (i = 0; i < prec; i += 2)
- {
- md_number_to_chars (litP, (valueT) words[i + 1],
- sizeof (LITTLENUM_TYPE));
- md_number_to_chars (litP + sizeof (LITTLENUM_TYPE),
- (valueT) words[i], sizeof (LITTLENUM_TYPE));
- litP += 2 * sizeof (LITTLENUM_TYPE);
- }
- }
+ /* For a 4 byte float the order of elements in `words' is 1 0.
+ For an 8 byte float the order is 1 0 3 2. */
+ for (i = 0; i < prec; i += 2)
+ {
+ md_number_to_chars (litP, (valueT) words[i + 1],
+ sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP + sizeof (LITTLENUM_TYPE),
+ (valueT) words[i], sizeof (LITTLENUM_TYPE));
+ litP += 2 * sizeof (LITTLENUM_TYPE);
+ }
return NULL;
}
--
Alan Modra
Australia Development Lab, IBM