Subject: memsetl (improved)

From: Matthew Wilcox <[email-masked]>
Date: Mon, 20 Apr 1998 11:19:10 +0100 (BST)

I've left this one embedded in its BASIC testbed, to ensure no transcription
errors this time :-)
17 instructions and the removal of a fair bit of cruft.

REM memsetl
:
DIM code &200
start=&20000
FOR i% = 0 TO 2 STEP 2
P%=code
[ OPT i%
  MOV     r0, #start
  LDR     r1, data
  LDR     r2, len

  B       memsetl

..data
  EQUD    &12345678
..len
  EQUD    0
]
P% = (P% + 16) AND NOT 15
[ OPT i%

..memsetl
                stmfd   r13!, {r14}
                mov     r14, r1
                subs    r2, r2, #16
                blt     mod_4

                mov     r3, r1
                mov     r12, r1
                tst     r2, #16
                addeq   r2, r2, #16

..loop_32
                stmneia r0!, {r1, r3, r12, r14}
                stmia   r0!, {r1, r3, r12, r14}
                subs    r2, r2, #32
                bgt     loop_32
..mod_4
                tst     r2, #8
                stmneia r0!, {r1, r14}
                tst     r2, #4
                strne   r1, [r0]

                ldmfd   r13!, {pc}

]
NEXT i%
:
FOR i% = 0 TO 128 STEP 4
!len = i%
start!i% = &c0ffee00
CALL code
IF start!i% <> &c0ffee00 PRINT "bug in "+STR$i%+" at end"
IF i% = 0 NEXT
FOR j% = 0 TO i%-4 STEP 4
IF start!j% <> &12345678 PRINT "bug in "+STR$i%+" at "+STR$j%
start!j% = &00decaff
NEXT j%
NEXT i%
END

-- 
Set Alias$Case Set Alias$[ |||| |MSet Alias$Otherwise Set Alias$[ \ Matthew
"" |MSet Alias$When If %0=%%0 Then Set Alias$[ "" ||MIf %0=%%0    \ Wilcox
Then Set Alias$Otherwise Set Alias$[ |||||||||||||||| ||MIf       \
%0=%%0 Then Set Alias$When Set Alias$[ ||||||||||||||||
unsubscribe: body of `unsubscribe linux-arm' to [email-masked]