summary refs log tree commit diff
path: root/lisc/test/sum.ssa
blob: 575daf64dcfc78477271dce3a5d0e9dd4650ab3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Simple test for addressing modes.

function w $sum(l %arr, w %num) {
@start
@loop
	%n1 =w phi @start %num, @loop1 %n2
	%s0 =w phi @start 0, @loop1 %s1
	%n2 =w sub %n1, 1
	%c =w csle %n1, 0
	jnz %c, @end, @loop1
@loop1
	%idx0 =l extsw %n2
	%idx1 =l mul 4, %idx0
	%idx2 =l add %idx1, %arr
	%w =w loadw %idx2
	%s1 =w add %w, %s0
	jmp @loop
@end
	ret %s0
}