On Tue, Nov 26, 2013 at 10:18 AM, Eric Botcazou <ebotca...@adacore.com> wrote: >> you are correct - this was an incorrect change. I believe that the >> patch below would be correct, but it is impossible to test it because (i >> believe) that gcc no longer works if the host_bits_per_wide_int is 32. >> I could be wrong about this but if i am correct, what do you want me to do? > > While you're right that most mainstream architectures now require a 64-bit > HWI, not all of them do according to config.gcc, so I don't think that this > path is entirely dead yet. I'll carry out the testing once we agree on the > final change. > > The checks were written that way in UI_From_gnu to be efficient, so can't we > find something more efficient than wi::gtu_p <wi::lrshift> ? We need to > return No_Uint on Input not representing a 64-bit signed integer, can't this > be done by testing the number of HWIs in Input and its sign bit if its type is > unsigned?
I suppose a generic wi::fits_[su]i (wi, <number-of-bits>) could be implemented, similar to how we have int_fits_type_p (not sure if the current wide-int implementation of that is most effective, but it falls back to double-int-ish template <typename T> bool wi::fits_to_tree_p (const T &x, const_tree type) { if (TYPE_SIGN (type) == UNSIGNED) return eq_p (x, zext (x, TYPE_PRECISION (type))); else return eq_p (x, sext (x, TYPE_PRECISION (type))); } which looks more efficient than shifting. Richard. > -- > Eric Botcazou