1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| | .text
.global __memset_vect
.type __memset_vect,%function
.option push
.option arch, +v
/* void *__memset_vect(void *s, int c, size_t n)
* a0 = s (dest), a1 = c (fill byte), a2 = n (size)
* Returns a0.
*/
__memset_vect:
mv t0, a0 /* running dst; keep a0 as return */
beqz a2, .Ldone_vect /* n == 0 then return */
/* Broadcast fill byte once. */
vsetvli t1, zero, e8, m8, ta, ma
vmv.v.x v0, a1
.Lbulk_vect:
vsetvli t1, a2, e8, m8, ta, ma /* t1 = vl (bytes) */
vse8.v v0, (t0)
add t0, t0, t1
sub a2, a2, t1
bnez a2, .Lbulk_vect
/* fallthrough */
.Ldone_vect:
ret
.size __memset_vect, .-__memset_vect
.option pop
|