1 TEXT memset(SB),$0 2 3/* 4 * performance: 5 * (tba) 6 */ 7 8MOVW R7, 0(FP) 9 MOVW n+8(FP), R9 /* R9 is count */ 10 MOVW p+0(FP), R10 /* R10 is pointer */ 11 MOVW c+4(FP), R11 /* R11 is char */ 12 ADD R9,R10, R12 /* R12 is end pointer */ 13 14/* 15 * if not at least 4 chars, 16 * dont even mess around. 17 * 3 chars to guarantee any 18 * rounding up to a word 19 * boundary and 4 characters 20 * to get at least maybe one 21 * full word store. 22 */ 23 SUBCC $4,R9, R0 24 BL out 25 26/* 27 * turn R11 into a word of characters 28 */ 29 AND $0xff, R11 30 SLL $8,R11, R7 31 OR R7, R11 32 SLL $16,R11, R7 33 OR R7, R11 34 35/* 36 * store one byte at a time until pointer 37 * is alligned on a word boundary 38 */ 39l1: 40 ANDCC $3,R10, R0 41 BE l2 42 MOVB R11, 0(R10) 43 ADD $1, R10 44 JMP l1 45 46/* 47 * turn R9 into end pointer-15 48 * store 16 at a time while theres room 49 */ 50l2: 51 ADD $-15,R12, R9 52 SUBCC R10,R9, R0 53 BLEU l4 54l3: 55 MOVW R11, 0(R10) 56 MOVW R11, 4(R10) 57 ADD $16, R10 58 SUBCC R10,R9, R0 59 MOVW R11, -8(R10) 60 MOVW R11, -4(R10) 61 BGU l3 62 63/* 64 * turn R9 into end pointer-3 65 * store 4 at a time while theres room 66 */ 67l4: 68 ADD $-3,R12, R9 69l5: 70 SUBCC R10,R9, R0 71 BLEU out 72 MOVW R11, 0(R10) 73 ADD $4, R10 74 JMP l5 75 76/* 77 * last loop, store byte at a time 78 */ 79out: 80 SUBCC R10,R12, R0 81 BLEU ret 82 MOVB R11, 0(R10) 83 ADD $1, R10 84 JMP out 85 86ret: 87 MOVW s1+0(FP), R7 88 RETURN 89