4 * Copyright 2004-2007 Analog Devices Inc.
5 * Enter bugs at http://blackfin.uclinux.org/
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see the file COPYING, or write
19 * to the Free Software Foundation, Inc.,
20 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 * C Library function MEMCMP
30 * Favours word aligned data.
36 P0 = R0; /* P0 = s1 address */
37 P3 = R1; /* P3 = s2 Address */
38 P2 = R2 ; /* P2 = count */
40 IF CC JUMP .Ltoo_small;
42 R1 = R1 | R0; /* OR addresses together */
43 R1 <<= 30; /* check bottom two bits */
44 CC = AZ; /* AZ set if zero. */
45 IF !CC JUMP .Lbytes ; /* Jump if addrs not aligned. */
47 P1 = P2 >> 2; /* count = n/4 */
49 R2 = R2 & R3; /* remainder */
50 P2 = R2; /* set remainder */
52 LSETUP (.Lquad_loop_s , .Lquad_loop_e) LC0=P1;
58 IF !CC JUMP .Lquad_different;
64 CC = P2 == 0; /* Check zero count*/
65 IF CC JUMP .Lfinished; /* very unlikely*/
68 LSETUP (.Lbyte_loop_s , .Lbyte_loop_e) LC0=P2;
70 R1 = B[P3++](Z); /* *s2 */
71 R0 = B[P0++](Z); /* *s1 */
73 IF !CC JUMP .Ldifferent;
83 /* We've read two quads which don't match.
84 * Can't just compare them, because we're
85 * a little-endian machine, so the MSBs of
86 * the regs occur at later addresses in the
88 * Arrange to re-read those two quads again,
91 P0 += -4; /* back up to the start of the */
92 P3 = I0; /* quads, and increase the*/
93 P2 += 4; /* remainder count*/