1 /* $Id: memscan.S,v 1.4 1996/09/08 02:01:20 davem Exp $
2 * memscan.S: Optimized memscan for the Sparc.
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
7 #include <asm/cprefix.h>
9 /* In essence, this is just a fancy strlen. */
11 #define LO_MAGIC 0x01010101
12 #define HI_MAGIC 0x80808080
16 .globl C_LABEL(__memscan_zero), C_LABEL(__memscan_generic)
17 .globl C_LABEL(memscan)
18 C_LABEL(__memscan_zero):
19 /* %o0 = addr, %o1 = size */
29 sethi %hi(HI_MAGIC), %g2
32 mzero_still_not_word_aligned:
49 bne,a mzero_still_not_word_aligned
52 sethi %hi(HI_MAGIC), %g2
54 or %g2, %lo(HI_MAGIC), %o3
55 sethi %hi(LO_MAGIC), %g3
56 or %g3, %lo(LO_MAGIC), %o2
59 mzero_next_word_preloaded:
61 mzero_next_word_preloaded_next:
66 mzero_check_out_of_fuel:
75 b mzero_next_word_preloaded_next
78 /* Check every byte. */
91 bne,a mzero_byte_two_and_three
97 mzero_byte_two_and_three:
107 bne,a mzero_next_word_preloaded
118 C_LABEL(__memscan_generic):
119 /* %o0 = addr, %o1 = c, %o2 = size */