Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

The arguments for vsetvli instruction #1

Open
zhuweipu opened this issue Mar 23, 2021 · 1 comment
Open

The arguments for vsetvli instruction #1

zhuweipu opened this issue Mar 23, 2021 · 1 comment

Comments

@zhuweipu
Copy link

Hello, I am confused about the arguments for vsetvli instruction in the vector test loop.

vsetvli t0, a2, e8,m1 uses a2 as the AVL to set vl register, but a2 = src2, a3 is actually the number of vector elements.

Is there anything wrong?

# void add_data_vec_8(int8_t *dest_data, int8_t *src1, int8_t *src2, int data_num);
# a0=dest, a1=src1, a2=src2, a3=n
#
add_data_vec_8:
    // mv      a3, a0          # Copy destination
.loop_8:
    vsetvli t0, a2, e8,m1   # Vectors of 8b
    vle8.v  v0, (a1)        # Load bytes
    add     a1, a1, t0  	# Bump pointer
    vle8.v  v1, (a2)        # Load bytes
    add     a2, a2, t0  	# Bump pointer
    sub     a3, a3, t0  	# Decrement count
    vadd.vv v2, v1, v0      # Vector Add
    vse8.v  v2, (a0)    	# Store bytes
    add     a0, a0, t0  	# Bump pointer
    bnez    a3, .loop_8    	# Any more?
    ret                 	# Return
@msyksphinz-self
Copy link
Owner

Oh yes you're right. I fixed but sorry I didn't test my fix at all.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants