2 * File: arch/blackfin/lib/memset.S
10 * Copyright 2004-2006 Analog Devices Inc.
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 #include <linux/linkage.h>
34 #ifdef CONFIG_MEMSET_L1
41 * C Library function MEMSET
42 * R0 = address (leave unchanged to form result)
45 * Favours word aligned data.
49 P0 = R0 ; /* P0 = address */
50 P2 = R2 ; /* P2 = count */
51 R3 = R0 + R2; /* end */
53 IF CC JUMP .Ltoo_small;
54 R1 = R1.B (Z); /* R1 = fill char */
56 R2 = R0 & R2; /* addr bottom two bits */
57 CC = R2 == 0; /* AZ set if zero. */
58 IF !CC JUMP .Lforce_align ; /* Jump if addr not aligned. */
61 P1 = P2 >> 2; /* count = n/4 */
62 R2 = R1 << 8; /* create quad filler */
63 R2.L = R2.L + R1.L(NS);
64 R2.H = R2.L + R1.H(NS);
67 LSETUP (.Lquad_loop , .Lquad_loop) LC0=P1;
72 IF !CC JUMP .Lbytes_left;
76 R2 = R3; /* end point */
77 R3 = P0; /* current position */
78 R2 = R2 - R3; /* bytes left */
82 CC = P2 == 0; /* Check zero count */
83 IF CC JUMP .Lfinished; /* Unusual */
86 LSETUP (.Lbyte_loop , .Lbyte_loop) LC0=P2;
94 CC = BITTST (R0, 0); /* odd byte */
98 R0 = P0; /* Recover return address */
102 CC = R2 <= 2; /* 2 bytes */
103 P2 -= P1; /* reduce count */
104 IF !CC JUMP .Laligned;