[libre-riscv-dev] MAXVECTORLENGTH could be longer

Luke Kenneth Casson Leighton lkcl at lkcl.net
Wed Oct 17 09:19:28 BST 2018


sent a message on the isa-dev list, to check what RVV would do if
VL=0.  it literally skips the entirety of any vectorised operations.

not being able to set VL==0 will require an extra jump / compare.  one
way to do it, below, another is to have a "beqz a0, end".


     CSRvect1 = {type: F, key: a3, val: a3, elwidth: dflt}
     CSRvect2 = {type: F, key: a7, val: a7, elwidth: dflt}
     CSRRWI MVL, 3          # sets MVL == **4** (not 3)
     j zerotest             # in case loop counter a0 already 0
    loop:
     CSRRW VL, t0, a0       # vl = t0 = min(mvl, a0)
     ld     a3, a1          # load 4 registers a3-6 from x
     slli   t1, t0, 3       # t1 = vl * 8 (in bytes)
     ld     a7, a2          # load 4 registers a7-10 from y
     add    a1, a1, t1      # increment pointer to x by vl*8
     fmadd a7, a3, fa0, a7 # v1 += v0 * fa0 (y = a * x + y)
     sub    a0, a0, t0      # n -= vl (t0)
     st     a7, a2          # store 4 registers a7-10 to y
     add    a2, a2, t1      # increment pointer to y by vl*8
    zerotest:
     bnez   a0, loop        # repeat if n != 0
    end:



More information about the libre-riscv-dev mailing list