On Wed, Nov 19, 2014 at 10:38:57AM -0800, Mike Stump wrote: > On Nov 19, 2014, at 4:24 AM, Richard Biener <rguent...@suse.de> wrote: > > On Wed, 19 Nov 2014, Jakub Jelinek wrote: > >> For TARGET_SUPPORTS_WIDE_INT == 0 should be hopefully ok. Not sure > >> about TARGET_SUPPORTS_WIDE_INT != 0, can it express any generic_wide_int, > >> or > >> is it still bound to wide_int (i.e. MAX_BITSIZE_MODE_ANY_INT rounded up) > >> precision? Mike? > > > > It can represent any - well, the RTX at least. Code then using > > "simple" wide_int may wreck then though. > > So, my worry is this… once you start in on adding support here or there > for int modes wider than the largest supported int mode, you create a > never ending maintenance nightmare with complex rules that one will never > be able to keep straight. There needs to be a single line or two, that > explains the rules that we all agree to, then it will always be clear what > the rule is. The largest supported int mode is: x, has a nice, simple, > easy to explain aspect to it.
Well, at least for TARGET_SUPPORTS_WIDE_INT == 0 my patch would always create CONST_INTs or CONST_DOUBLEs, which all fit into MAX_BITSIZE_MODE_ANY_INT bits, CONST_INTs are modeless, so in what wider mode you use them doesn't matter. For TARGET_SUPPORTS_WIDE_INT != 0 we could certainly cap it similarly, if wi::min_precision (r, SIGNED) > MAX_BITSIZE_MODE_ANY_INT we could return NULL_RTX. Though, following patch is just fine for me too, I don't think it will make a significant difference: --- gcc/simplify-rtx.c 2014-11-19 15:39:24.073113107 +0100 +++ gcc/simplify-rtx.c 2014-11-19 22:55:44.201464253 +0100 @@ -5504,6 +5504,8 @@ simplify_immed_subreg (machine_mode oute HOST_WIDE_INT tmp[MAX_BITSIZE_MODE_ANY_INT / HOST_BITS_PER_WIDE_INT]; wide_int r; + if (GET_MODE_PRECISION (outer_submode) > MAX_BITSIZE_MODE_ANY_INT) + return NULL_RTX; for (u = 0; u < units; u++) { unsigned HOST_WIDE_INT buf = 0; @@ -5515,10 +5517,13 @@ simplify_immed_subreg (machine_mode oute tmp[u] = buf; base += HOST_BITS_PER_WIDE_INT; } - gcc_assert (GET_MODE_PRECISION (outer_submode) - <= MAX_BITSIZE_MODE_ANY_INT); r = wide_int::from_array (tmp, units, GET_MODE_PRECISION (outer_submode)); +#if TARGET_SUPPORTS_WIDE_INT == 0 + /* Make sure r will fit into CONST_INT or CONST_DOUBLE. */ + if (wi::min_precision (r, SIGNED) > HOST_BITS_PER_DOUBLE_INT) + return NULL_RTX; +#endif elems[elem] = immed_wide_int_const (r, outer_submode); } break; Jakub