summaryrefslogtreecommitdiff
path: root/input/adjacent-adder-vector.asm
blob: 419e11c69cb73ba0db055720fecf665dcbf603d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
;;;;;;;;
;;; adds adjacent elements of a 4-element vector together,
;;; storing the result in place. Uses the vector type.

.data
        arr 1 2 3 4
        s 3
.text
        load $4 s($0)   ; set the vector-length register
        addi $5 $0 arr
        srdl $16 $5 $16
        addi $6 $5 0x1
        srdl $17 $6 $16
        addv $18 $18 $17
        srds $18 $5 $15
        nop
        nop
        nop