Skip to content

Commit

Permalink
[AArch64][SVE 10/32] Move range check out of parse_aarch64_imm_float
Browse files Browse the repository at this point in the history
Since some SVE constants are no longer explicitly tied to the 8-bit
FP immediate format, it seems better to move the range checks out of
parse_aarch64_imm_float and into the callers.

gas/
	* config/tc-aarch64.c (parse_aarch64_imm_float): Remove range check.
	(parse_operands): Check the range of 8-bit FP immediates here instead.
  • Loading branch information
rsandifo-arm committed Sep 21, 2016
1 parent 6a9deab commit 874d7e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 5 additions & 0 deletions gas/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2016-09-21 Richard Sandiford <[email protected]>

* config/tc-aarch64.c (parse_aarch64_imm_float): Remove range check.
(parse_operands): Check the range of 8-bit FP immediates here instead.

2016-09-21 Richard Sandiford <[email protected]>

* config/tc-aarch64.c (parse_aarch64_imm_float): Report a specific
Expand Down
14 changes: 6 additions & 8 deletions gas/config/tc-aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -2148,7 +2148,8 @@ can_convert_double_to_float (uint64_t imm, uint32_t *fpword)
hexadecimal representation is involved). REG_TYPE says which register
names should be treated as registers rather than as symbolic immediates.
N.B. 0.0 is accepted by this function. */
This routine accepts any IEEE float; it is up to the callers to reject
invalid ones. */

static bfd_boolean
parse_aarch64_imm_float (char **ccp, int *immed, bfd_boolean dp_p,
Expand Down Expand Up @@ -2224,12 +2225,9 @@ parse_aarch64_imm_float (char **ccp, int *immed, bfd_boolean dp_p,
}
}

if (aarch64_imm_float_p (fpword) || fpword == 0)
{
*immed = fpword;
*ccp = str;
return TRUE;
}
*immed = fpword;
*ccp = str;
return TRUE;

invalid_fp:
set_fatal_syntax_error (_("invalid floating-point constant"));
Expand Down Expand Up @@ -5296,7 +5294,7 @@ parse_operands (char *str, const aarch64_opcode *opcode)
= (aarch64_get_qualifier_esize (inst.base.operands[0].qualifier)
== 8);
if (!parse_aarch64_imm_float (&str, &qfloat, dp_p, imm_reg_type)
|| qfloat == 0)
|| !aarch64_imm_float_p (qfloat))
{
if (!error_p ())
set_fatal_syntax_error (_("invalid floating-point"
Expand Down

0 comments on commit 874d7e6

Please sign in to comment.