2 * memscan.S: Optimized memscan for the Sparc.
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
7 #include <asm/export.h>
9 /* In essence, this is just a fancy strlen. */
11 #define LO_MAGIC 0x01010101
12 #define HI_MAGIC 0x80808080
16 .globl __memscan_zero, __memscan_generic
18 EXPORT_SYMBOL(__memscan_zero)
19 EXPORT_SYMBOL(__memscan_generic)
21 /* %o0 = addr, %o1 = size */
31 sethi %hi(HI_MAGIC), %g2
34 mzero_still_not_word_aligned:
51 bne,a mzero_still_not_word_aligned
54 sethi %hi(HI_MAGIC), %g2
56 or %g2, %lo(HI_MAGIC), %o3
57 sethi %hi(LO_MAGIC), %g3
58 or %g3, %lo(LO_MAGIC), %o2
61 mzero_next_word_preloaded:
63 mzero_next_word_preloaded_next:
68 mzero_check_out_of_fuel:
77 b mzero_next_word_preloaded_next
80 /* Check every byte. */
93 bne,a mzero_byte_two_and_three
99 mzero_byte_two_and_three:
109 bne,a mzero_next_word_preloaded
121 /* %o0 = addr, %o1 = c, %o2 = size */