ack/mach/powerpc/libem/cms.s
George Koehler c578c495bb Edit PowerPC assembly for .and, .cms, .ior, .xor, .zer
Remove one addi instruction from some loops.  These loops had
increased 2 pointers, they now increase 1 index.  I must initialize
the index, so I add "li r6, 0" before each loop.

Change .zer to use subf instead of neg, add.

Change .xor to take the size on the real stack, as .and and .or have
done since 81c677d.
2017-02-11 18:00:56 -05:00

30 lines
612 B
ArmAsm

.sect .text
! Compare sets a, b.
! Stack: ( b a -- )
! With r3 = size of each set
! Yields r3 = 0 if equal, nonzero if not equal
.define .cms
.cms:
srwi r7, r3, 2
mtspr ctr, r7 ! ctr = size / 4
mr r4, sp ! r4 = ptr to set a
add r5, sp, r3 ! r5 = ptr to set b
li r6, 0 ! r6 = index
add r9, r5, r3 ! r9 = future sp
1:
lwzx r7, r4, r6
lwzx r8, r5, r6
cmpw cr0, r7, r8 ! compare words in sets
addi r6, r6, 4
bne cr0, 2f ! branch if not equal
bdnz 1b ! loop ctr times
li r3, 0 ! equal: return 0
b 3f
2:
li r3, 1 ! not equal: return 1
3:
mr sp, r9 ! remove sets from stack
blr