aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/vec-memcpy/vec-memcpy.S
blob: 0fa2aa76fe8ff4cea631a56113f093cce9ae6b38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
   .text
    .balign 4
    .global vec_memcpy
    # void *vec_memcpy(void* dest, const void* src, size_t n)
    # a0=dest, a1=src, a2=n
    #
  vec_memcpy:
      mv a3, a0 # Copy destination
  loop:
    vsetvli t0, a2, e8, m8, ta, ma   # Vectors of 8b
    vle8.v v0, (a1)               # Load bytes
      add a1, a1, t0              # Bump pointer
      sub a2, a2, t0              # Decrement count
    vse8.v v0, (a3)               # Store bytes
      add a3, a3, t0              # Bump pointer
      bnez a2, loop               # Any more?
      ret                         # Return