lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unaligned load/store opcodes


From: Paulo César Pereira de Andrade
Subject: Re: Unaligned load/store opcodes
Date: Wed, 5 Apr 2023 13:08:20 -0300

Em qui., 23 de mar. de 2023 às 08:07, Paul Cercueil
<paul@crapouillou.net> escreveu:
>
> Hi Paulo,

  Hi Paul,

> I think Lightning would benefit from having support for 16/32/64-bit
> I/O to unaligned addresses. That's something I would actually use.
>
> Something like:
> ldur_s / ldur_us / ldur_i / ldur_ui / ldur_l
> stur_s / stur_i / stur_l
>
> I don't think we need ldx/stx variants.

  Please check the new instructions (not yet properly documented):

unldr r0 r1 i0 -- r0 = *(signed_i0_size*)r1
unldi r0 i1 -- r0 = *(signed_i1_size*)i0
unldr_u r0 r1 i0 -- r0 = *(unsigned_i0_size*)r1
unldi_u r0 i1 -- r0 = *(unsigned_i1_size*)i0
unstr r0 r1 i0 -- *(i0_size_integer*)r0 = r1
unsti i0 r0 i1 -- *(i1_size_integer*)r0 = r0

valid size values are 1 to wordsize. This means it can help for integers
with a size other than 1, 2, 4 or 8.

unldr_x r0 r1 i0 -- r0 = *(i0_size_float*)r1
unldi_x r0 i0 i1 -- r0 = *(i1_size_float*)i0
unstr_x r0 r1 i0 -- *(i0_size_float*)r0 = r1
unstr_x i0 r0 i1 -- *(i1_size_float*)i0 = r0

valid size values are 4 and 8. There is no plan, but it is possible to
add support for soft floats of a size other than 4 or 8. 1 and 2 byte
floats could be very useful as a way to use less memory for low
precision data, but if ever added, it would be only for load/store,
otherwise, would need a conversion to a higher sized value.

> What do you think?

  It should be in a functional state, but some optimizations can still be
done, or some redesign might be done as well.

> Cheers,
> -Paul

Thanks!
Paulo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]