[PATCH][ARM][gas] Make gas accept vcmp[e].f{32,64} <reg>, #0.0

Kyrill Tkachov kyrylo.tkachov@arm.com
Thu Aug 7 08:45:00 GMT 2014


On 05/08/14 15:14, Will Newton wrote:
> On 5 August 2014 14:11, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
>> On 04/08/14 11:08, Will Newton wrote:
>>> On 4 August 2014 10:34, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
>>>
>>> Hi Kyrill,
>>>
>>>> The ARM ARM says that the VFP compare with zero instructions (vcmp,
>>>> vcmpe)
>>>> accept the zero in the form of a #0.0 immediate. However, gas currently
>>>> only
>>>> accepts #0. This patch fixes that and some simple tests are added.
>>>>
>>>> The new parse_ifimm_zerofunction is rather simple and is modelled on the
>>>> parse_qfloat_immediate below it and didn't blow up in my testing.
>>>>
>>>>
>>>> make check on gas passes and a gcc testsuite run doesn't show any
>>>> problems.
>>>>
>>>> Ok for trunk?
>>>>
>>>> Thanks,
>>>> Kyrill
>>>>
>>>> [gas/]
>>>> 2014-06-24  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>>>
>>>>       * config/tc-arm.c (parse_ifimm_zero): New function.
>>>>       (enum operand_parse_code): Add OP_RSVD_FI0 value.
>>>>       (parse_operands): Handle OP_RSVD_FI0.
>>>>       (asm_opcode_insns): Use RSVD_FI0 for second operand of vcmp, vcmpe.
>>>>
>>>> [gas/testsuite/]
>>>> 2014-06-24  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>>>
>>>>       * gas/arm/ual-vcmp.s: New file.
>>>>       * gas/arm/ual-vcmp.d: Likewise.
>>> Would it be possible to use my_get_expression or a similar parser for
>>> this?
>> Hi Will,
>>
>> Thanks for the suggestion, but I'm struggling to figure out what
>> my_get_expression is supposed to be doing. Is it supposed to be taking a
>> string and parsing it into an expressionS?
>> I'm not very well versed in gas internal data types...
> Yes, that's pretty much it. I think an integer will be type O_constant
> with the value in X_add_number and a floating point value O_big with a
> value in generic_floating_point_number. The expr.c code is not pretty
> but it should be possible to make it do something approaching what's
> reguired...

Hi Will,

After a bit of investigation, it seems that atof_generic is what I need. 
It can handle any form of floating point zero, as well as plain old "0".

 From what I understand from looking around gas the global variable generic_floating_point_number is supposed to be used to store the various parts of a floating point representation and the way it's checked for 0.0 in config/atof-ieee.c is by comparing the .low and .leader components.

  I've also added a *-bad.s testcase to make sure we reject non-zero immediates.

make check on gas passes.

How does this look?

Thanks,
Kyrill

[gas/]
2014-08-07  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* config/tc-arm.c (parse_ifimm_zero): New function.
	(enum operand_parse_code): Add OP_RSVD_FI0 value.
	(parse_operands): Handle OP_RSVD_FI0.
	(asm_opcode_insns): Use RSVD_FI0 for second operand of vcmp, vcmpe.

[gas/testsuite/]
2014-08-07  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* gas/arm/ual-vcmp.s: New file.
	* gas/arm/ual-vcmp.d: Likewise.
	* gas/arm/vcmp-zero-bad.s: Likewise.
	* gas/arm/vcmp-zero-bad.d: Likewise.
	* gas/arm/vcmp-zero-bad.l: Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arm-gas-vcmp-0.patch
Type: text/x-patch
Size: 6450 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20140807/770b78ca/attachment.bin>


More information about the Binutils mailing list