Hi,
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 https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
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
subtype T is Long_Float;
function Unbiased_Rounding (X : T) return T is
Y : T;
begin
Asm (“vrintn.f64 %P0,%P1”,
Outputs => T’asm_output (“=w”, Y),
Inputs => T’asm_input (“w”, X));
return Y;
end Unbiased_Rounding;
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 379 |
Nodes: | 16 (2 / 14) |
Uptime: | 44:32:08 |
Calls: | 8,141 |
Calls today: | 4 |
Files: | 13,085 |
Messages: | 5,858,054 |