[Libre-soc-dev] change sv ld/st to allow non-zero immediates for unit-strided load/store

lkcl luke.leighton at gmail.com
Tue Oct 11 10:51:42 BST 2022

On Tue, Oct 11, 2022 at 10:28 AM Jacob Lifshay <programmerjake at gmail.com> wrote:
> this will be very common in spill code or other code with vectors stored in a struct or on stack:
> sv.ld/unitstrided *r120, -32(r1) # load from local stack var in redzone
> sv.ld/unitstrided *r32, 64(r1) # load from function arguments
> sv.ld/unitstrided *r64, 32(r3) # load from struct member that starts at offset 32

pretty much every single (contiguous) load-process-store loop
will be able to use it.



these can go from the inner loop as they'd be part of the

    60 addi src_col, src_col, 8 # Increment src, ref by 8 bytes
    61 addi ref_col, ref_col, 8

and replace these:

  48         sv.lha  *src, 0(src_col)                # Load 4 ints
from (src_ptr)
  49         sv.lha  *ref, 0(ref_col)                # Load 4 ints
from (ref_ptr)

with these:

  48         sv.lhaup  *src, 4(src_col)    # Load 4 ints from
(src_ptr) post-inc RA
  49         sv.lhaup  *ref, 4(ref_col)     # Load 4 ints from
(ref_ptr) post-inc RA

only thing is, have to disable the auto-calculation of offset-immediates
(the multiply by index) otherwise it gets weird.

> sorry this is not very detailed, it's 2:30 am here...

no problem i'm pretty blurry myself.


More information about the Libre-soc-dev mailing list