On Thu, Jun 19, 2025 at 07:13:07PM +0800, Yang Yujie wrote:
> On Thu, Jun 19, 2025 at 12:32:57PM GMT, Jakub Jelinek wrote:
> > As mentioned in another mail, please follow what aarch64 is doing here (at
> > least unless you explain how it violates your psABI):
> >   if (n <= 8)
> >     info->limb_mode = QImode;
> >   else if (n <= 16)
> >     info->limb_mode = HImode;
> >   else if (n <= 32)
> >     info->limb_mode = SImode;
> >   else if (n <= 64)
> >     info->limb_mode = DImode;
> >   else if (n <= 128)
> >     info->limb_mode = TImode;
> >   else
> >     info->limb_mode = DImode;
> > 
> >   if (n > 128)
> >     info->abi_limb_mode = TImode;
> >   else
> >     info->abi_limb_mode = info->limb_mode;
>  
> If you have a large bigint like _BitInt(191), which takes up an odd number of
> 64-bit chunks, I am not sure if lowering with TImode would leave the top 
> (unused)
> limb alone.  In LoongArch psABI that limb is considered undefined and
> any operations on it should be optimized away.

I know about that from earlier discussions, but the above code doesn't
change anything on that.  191 is limb_mode DImode, abi_limb_mode TImode like
before.  The only thing that changes is the [65, 128] case, in that case
there is no such thing as partial undefined limb and it is much better to
use normal TImode arithmetics and perhaps libcalls for those cases instead
of lowering it.

        Jakub

Reply via email to