[Ada] Use right implementation type for nonbinary-modulus ops
If the flag Opt.Expand_Nonbinary_Modular_Ops is set (which occurs if
-gnateg is specified) then we implement predefined operations for a
modular type whose modulus is not a power of two by converting the
operands to some other type (either a signed integer type or a modular
type with a power-of-two modulus), doing the operation in that
representation, and converting back. If the bounds of the chosen type
are too narrow, then problems with intermediate overflow can result. But
there are performance advantages to choosing narrower bounds (and to
prefering an unsigned choice over a signed choice of the same size) when
multiple safe choices are available.
gcc/ada/
* exp_ch4.adb (Expand_Nonbinary_Modular_Op.Expand_Modular_Op):
Reimplement choice of which predefined type to use for the
implementation of a predefined operation of a modular type with
a non-power-of-two modulus.