aboutsummaryrefslogtreecommitdiff
path: root/gcc/genmodes.cc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-03-29 12:52:57 +0200
committerMarc Poulhiès <poulhies@adacore.com>2023-05-26 09:29:19 +0200
commit18a72d68c9daf72a5690be652fd1b0eb217035a2 (patch)
treed007b549010909ef0f5ac6d41ad927f53fc137d0 /gcc/genmodes.cc
parent3e62561d5ffbb07fa97a4dddfd729fceb7cfce75 (diff)
downloadgcc-18a72d68c9daf72a5690be652fd1b0eb217035a2.zip
gcc-18a72d68c9daf72a5690be652fd1b0eb217035a2.tar.gz
gcc-18a72d68c9daf72a5690be652fd1b0eb217035a2.tar.bz2
ada: Use truncation for dynamic conversions from floating point to fixed point
This changes the implementation of dynamic conversions from floating-point to ordinary fixed-point types, from rounding (to the nearest number) to truncation (toward zero), so as to make them consistent with both static conversions between these types and also the value of the Machine_Rounds attribute, which is False for all fixed-point types with GNAT. The rounding is still available under the debug switch -gnatd.N for the sake of backward compatibility with the previous implementation. gcc/ada/ * debug.adb (d.N): Document new usage. * exp_ch4.adb (Expand_N_Type_Conversion): Copy the Float_Truncate flag when rewriting a floating-point to fixed-point conversion as a floating-point to integer conversion. * exp_fixd.adb: Add with and use clauses for Debug. (Expand_Convert_Fixed_To_Fixed): Generate a truncation in all cases except if the result is explicitly rounded. (Expand_Convert_Integer_To_Fixed): Likewise. (Expand_Convert_Float_To_Fixed): Generate a truncation for all kind of fixed-point types, except if the result is explicitly rounded, or -gnatd.N is specified and the type is an ordinary fixed-point type. * sinfo.ads (Float_Truncate): Document usage for floating-point to fixed-point conversions.
Diffstat (limited to 'gcc/genmodes.cc')
0 files changed, 0 insertions, 0 deletions