https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110717

--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #13)
> So.  Before expand we have
> 
>   _6 = (__int128) x_3(D);
>   x.0_1 = _6 << 59;
>   _2 = x.0_1 >> 59;


Jakub is trying to emulate this using shifts but this is better using bitfields
just to get the truncation:


#ifdef __SIZEOF_INT128__
#define type __int128
#else
#define type long long
#endif

struct f
{
#ifdef __SIZEOF_INT128__
  __int128 t:(128-59);
#else
  long long t:(64-27);
#endif
};

unsigned type
foo (unsigned type x)
{
  struct f t;
  t.t = x;
  return t.t;
}

Reply via email to