โŒ About FreshRSS

Normal view

There are new articles available, click to refresh the page.
Before yesterdayNews from the Ada programming language world

Using Long_Float in inline assembler for ARM

By: AhlanM
19 November 2023 at 12:33

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

Read full topic

โŒ
โŒ