Richard Biener <richard.guent...@gmail.com> writes: > On Mon, May 17, 2021 at 3:18 PM Joern Wolfgang Rennecke > <joern.renne...@riscy-ip.com> wrote: >> >> Attached is the updated version of the patch. >> Bootstrapped and regtested on x86_64-pc-linux-gnu. >> >> OK to apply? > > + machine_mode m = mode_for_size ((prec + 1) / 2, MODE_INT, 1).require > (); > + int half_prec = GET_MODE_PRECISION (as_a <scalar_int_mode> (m)); > + if (m != TYPE_MODE (type)) > > so I'd rather see it as > > opt_machine_mode m = mode_for_size ((prec + 1) / 2, MODE_INT, 1); > int half_prec = 8; > if (m.exists () > && m.require () != TYPE_MODE (type)) > { > half_prec = GET_MODE_PRECISION (as_a <scalar_int_mode> (m)); > half_type = build_nonstandard_integer_type (half_prec, 1); > } > > to avoid .require () on a possibly non-existent mode. Maybe there's a more > clever way to formulate the mode comparison. CCed Richard for this.
No, that looks good. We should probably have a mode_for_size wrapper specifically for MODE_INT, but the challenge is to find a name that wouldn't be confused with int_mode_for_size. Thanks, Richard