This change relaxes the conditions under which the implementation of ordinary fixed-point types uses only underlying integer instructions.
These conditions are on the Small of the ordinary fixed-point types, which must now be a rational number whose factors are of a magnitude bounded relatively to the size of the mantissa. The algorithms of Image and Value are not modified, only that of Fore is genezalized in a straightforward way. Two new attributes are added to the compiler, Small_Denominator and Small_Numerator, in order for the Text_IO.Fixed_IO package to benefit from the enhancement. Tested on x86_64-pc-linux-gnu, committed on trunk 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.
patch.diff.gz
Description: application/gzip