(no commit message)
authorlkcl <lkcl@web>
Fri, 14 Apr 2023 15:31:18 +0000 (16:31 +0100)
committerIkiWiki <ikiwiki.info>
Fri, 14 Apr 2023 15:31:18 +0000 (16:31 +0100)
simple_v_extension/daxpy_example.mdwn

index 9a43ef314e3de1398faada4be93fd4baaf011f42..48a3c7aeed6e03cd450f786e6ba029f0c25883aa 100644 (file)
       c.bnez   a0, loop       # repeat if n != 0
       c.ret                   # return
 ```
+
+# SVE Version
+
+```
+    1  // x0 = &x[0], x1 = &y[0], x2 = &a, x3 = &n
+    2  daxpy_:
+    3  ldrswx3, [x3]                     // x3=*n
+    4  movx4, #0                         // x4=i=0
+    5  whilelt p0.d, x4, x3              // p0=while(i++<n)
+    6  ld1rdz0.d, p0/z, [x2]             // p0:z0=bcast(*a)
+    7  .loop:
+    8  ld1d z1.d, p0/z, [x0, x4, lsl #3] // p0:z1=x[i]
+    9  ld1d z2.d, p0/z, [x1, x4, lsl #3] // p0:z2=y[i]
+    10 fmla z2.d, p0/m, z1.d, z0.d       // p0?z2+=x[i]*a
+    11 st1d z2.d, p0, [x1, x4, lsl #3]   // p0?y[i]=z2
+    12 incd x4                           // i+=(VL/64)
+    13 .latch:
+    14 whilelt p0.d, x4, x3             // p0=while(i++<n)
+    15 b.first .loop                    // more to do?
+    16 ret
+```