[Ada] Expand integer-only implementation of ordinary fixed-point types
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 10 Nov 2020 11:14:56 +0000 (12:14 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 30 Nov 2020 14:16:19 +0000 (09:16 -0500)
commit2bf891fa752e18b872d6c06d541aed1ae0b94580
tree6a8fff173b3bcbfd5f3745318cd7d21dcf321d06
parenta18d46a4b6cd2b3c6f6506d09a3bd547b20293bf
[Ada] Expand integer-only implementation of ordinary fixed-point types

gcc/ada/

* doc/gnat_rm/implementation_defined_attributes.rst (Pool_Address):
Fix pasto.
(Small_Denominator): New entry.
(Small_Numerator): Likewise.
* doc/gnat_rm/implementation_defined_characteristics.rst (3.5.9):
Relax conditions on 128-bit smalls and integer-only implementation.
* gnat_rm.texi: Regenerate.
* exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Fore>:
Relax conditions on integer implementation for ordinary fixed-point
types and pass a third parameter to the routine.
<Attribute_Small_Denominator>: Raise Program_Error.
<Attribute_Small_Numerator>: Likewise.
* exp_fixd.adb (Expand_Convert_Fixed_To_Fixed): Use a scaled divide
if the numerator and denominator of the small ratio are sufficiently
small integers.
(Expand_Convert_Fixed_To_Integer): Use a scaled divide if numerator
and denominator of the small value are sufficiently small integers.
(Expand_Convert_Integer_To_Fixed): Likewise.
* exp_imgv.adb (Expand_Image_Attribute): Relax the conditions on the
integer implementation for ordinary fixed-point types.
(Expand_Value_Attribute): Likewise.
* freeze.adb (Freeze_Fixed_Point_Type): Relax conditions on 128-bit
smalls.
* sem_attr.adb (Analyze_Attribute) <Attribute_Small_Denominator>:
Check no arguments, fixed-point and set type to Universal_Integer.
<Attribute_Small_Numerator>: Likewise.
(Eval_Attribute) <Attribute_Small_Denominator>: Fold statically.
<Attribute_Small_Numerator>: Likewise.
* snames.ads-tmpl (Name_Small_Denominator): New attribute name.
(Name_Small_Numerator): Likewise.
(Attribute_Id): Add Attribute_Small_{Denominator,Numerator}.
* libgnat/a-tifiio.adb (Exact): Delete.
(Need_64): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-tifiio__128.adb (Exact): Delete.
(Need_64): Likewise.
(Need_128): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(OK_Get_128): Likewise.
(OK_Put_128): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-wtfiio.adb (Exact): Delete.
(Need_64): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-wtfiio__128.adb (Exact): Delete.
(Need_64): Likewise.
(Need_128): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(OK_Get_128): Likewise.
(OK_Put_128): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-ztfiio.adb (Exact): Delete.
(Need_64): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-ztfiio__128.adb (Exact): Delete.
(Need_64): Likewise.
(Need_128): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(OK_Get_128): Likewise.
(OK_Put_128): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/s-fore_f.ads (Fore_Fixed): Adjust signature.
* libgnat/s-fore_f.adb (Fore_Fixed): Reimplement.
* libgnat/s-fofi32.ads (Fore_Fixed32): Adjust signature.
* libgnat/s-fofi64.ads (Fore_Fixed64): Likewise.
* libgnat/s-fofi128.ads (Fore_Fixed128): Likewise.
* libgnat/s-imagef.ads: Adjust description.
* libgnat/s-imagef.adb (Maxdigs): Move around.
(Set_Image_Integer): Remove assertion.
* libgnat/s-valuef.ads: Adjust description.
* libgnat/s-valuef.adb (Integer_To_Fixed): Minor tweak.
24 files changed:
gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst
gcc/ada/doc/gnat_rm/implementation_defined_characteristics.rst
gcc/ada/exp_attr.adb
gcc/ada/exp_fixd.adb
gcc/ada/exp_imgv.adb
gcc/ada/freeze.adb
gcc/ada/gnat_rm.texi
gcc/ada/libgnat/a-tifiio.adb
gcc/ada/libgnat/a-tifiio__128.adb
gcc/ada/libgnat/a-wtfiio.adb
gcc/ada/libgnat/a-wtfiio__128.adb
gcc/ada/libgnat/a-ztfiio.adb
gcc/ada/libgnat/a-ztfiio__128.adb
gcc/ada/libgnat/s-fofi128.ads
gcc/ada/libgnat/s-fofi32.ads
gcc/ada/libgnat/s-fofi64.ads
gcc/ada/libgnat/s-fore_f.adb
gcc/ada/libgnat/s-fore_f.ads
gcc/ada/libgnat/s-imagef.adb
gcc/ada/libgnat/s-imagef.ads
gcc/ada/libgnat/s-valuef.adb
gcc/ada/libgnat/s-valuef.ads
gcc/ada/sem_attr.adb
gcc/ada/snames.ads-tmpl