Using Long_Float in inline assembler for ARM
Hi,
Using GNAT v11.2/0-4 for ARM (Alire), the following procedure Unbiased_Rounding for Float works as expected.
function Unbiased_Rounding (X : Float) return Float is
Y : Float;
begin
Asm (โvrintn.f32 %0,%1โ,
Outputs => Floatโasm_output (โ=tโ, Y),
Inputs => Floatโasm_input (โtโ, X));
return Y;
end Unbiased_Rounding;
according to Machine Constraints (Using the GNU Compiler Collection (GCC))
the constraint t means "VFP floating-point registers s0-s31. Used for 32 bit valuesโ and the constraint w means "VFP floating-point registers d0-d31 and the appropriate subset d0-d15 based on command line options. Used for 64 bit values onlyโ
therefore we wrote our long_float version as
function Unbiased_Rounding (X : Long_Float) return Long_Float is
Y : Long_Float;
begin
Asm (โvrintn.f64 %0,%1โ,
Outputs => Long_Floatโasm_output (โ=wโ, Y),
Inputs => Long_Floatโasm_input (โwโ, X));
return Y;
end Unbiased_Rounding;
however this fails to compile.
GNAT 11.2/0-4 (Alire) complains
Error: invalid instruction shape โ `vrintn.f64 s14,s14โ
presumably because the operands are S registers rather than double precisions D registers.
Is this a bug or have we misunderstood something?
Best wishes,
Ahlan
8 posts - 4 participants