From 1e62cf38107051ffcf04955a1ea3a629927d254b Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 5 Sep 2019 09:03:50 +0100 Subject: [PATCH] use Compressed in DAXPY --- simple_v_extension/daxpy_example.mdwn | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/simple_v_extension/daxpy_example.mdwn b/simple_v_extension/daxpy_example.mdwn index 3e26b25d4..b6bc63139 100644 --- a/simple_v_extension/daxpy_example.mdwn +++ b/simple_v_extension/daxpy_example.mdwn @@ -9,15 +9,14 @@ # 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} VBLK.REG[1] = {type: F, isvec: 1, regkey: a7, regidx: a7, elwidth: dflt} - VBLK.MVL = 4 loop: - setvl t0, a0 # vl = t0 = min(a0, MVL)) - 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 - bnez a0, loop # repeat if n != 0 + VBLK.SETVL t0, a0, #4 # MVL=4, vl = t0 = min(a0, MVL)) + ld a3, a1 # load 4 registers a3-6 from x + c.slli t1, t0, 3 # t1 = vl * 8 (in bytes) + c.ld a7, a2 # load 4 registers a7-10 from y + c.add a1, a1, t1 # increment pointer to x by vl*8 + fmadd a7, a3, fa0, a7 # v1 += v0 * fa0 (y = a * x + y) + c.sub a0, a0, t0 # n -= vl (t0) + c.st a7, a2 # store 4 registers a7-10 to y + c.add a2, a2, t1 # increment pointer to y by vl*8 + c.bnez a0, loop # repeat if n != 0 -- 2.30.2