From: lkcl Date: Fri, 14 Apr 2023 13:17:40 +0000 (+0100) Subject: (no commit message) X-Git-Tag: opf_rfc_ls008_v1~23 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=80b9058f9e248eeb673d36bc9c2f57a3aedca32b;p=libreriscv.git --- diff --git a/simple_v_extension/daxpy_example.mdwn b/simple_v_extension/daxpy_example.mdwn index b48bae362..64f3dc9d9 100644 --- a/simple_v_extension/daxpy_example.mdwn +++ b/simple_v_extension/daxpy_example.mdwn @@ -1,3 +1,4 @@ +``` # c code void daxpy(size_t n, double a, const double x[], double y[]) { @@ -6,6 +7,23 @@ } } + + # SVP64 Power ISA version + # r5: n + # r5: x + # r6: y + # fp1: a + mtctr 5 # move n to CTR + addi r10,r6,0 # copy y-ptr into r10 +.L2 + setvl MAXVL=32,VL=CTR # could do more + sv.lfdup/els *32,8(6) # load from x + sv.lfdup/els *64,8(7) # load from y + sv.fmadd *64,*64,1,*32 # fmadd + stfdup/els *64,8(10) # store y-copy + sv.bc/ctr .L2 # decrement VL by CTR + blr # return + # SV Version # a0 is n, a1 is ptr to x[0], a2 is ptr to y[0], fa0 is a (scalar) VBLK.REG[0] = {type: F, isvec: 1, regkey: a3, regidx: a3, elwidth: dflt} @@ -39,3 +57,4 @@ c.add a2, a2, t1 # increment pointer to y by vl*8 c.bnez a0, loop # repeat if n != 0 c.ret # return +```