summaryrefslogtreecommitdiff
path: root/input/adjacent-adder.asm
blob: 975e58101524eec8631d284c8df29757cc776d50 (plain)
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
;;;;;;;;
;;; adds adjacent elements of a 4-element vector together,
;;; storing the result in place.

.data
	arr 1 2 3 4
	s   3
	i   0

.text
	load $5 s($0)
	addi $10 $0 arr
	load $6 i($0)
        jrl CMP
L:
	add $9 $10 $6
        load $7 0($9)
        load $8 1($9)
        add $7 $7 $8

        store $7 0($9)
        addi $6 $6 0x1
CMP:
        cmp $5 $6
        bgt L