2 * Copyright 2004-2009 Analog Devices Inc.
4 * Licensed under the ADI BSD license or the GPL-2 (or later)
7 #include <linux/linkage.h>
11 #ifdef CONFIG_MEMSET_L1
18 * C Library function MEMSET
19 * R0 = address (leave unchanged to form result)
22 * Favours word aligned data.
23 * The strncpy assumes that I0 and I1 are not used in this function
27 P0 = R0 ; /* P0 = address */
28 P2 = R2 ; /* P2 = count */
29 R3 = R0 + R2; /* end */
31 IF CC JUMP .Ltoo_small;
32 R1 = R1.B (Z); /* R1 = fill char */
34 R2 = R0 & R2; /* addr bottom two bits */
35 CC = R2 == 0; /* AZ set if zero. */
36 IF !CC JUMP .Lforce_align ; /* Jump if addr not aligned. */
39 P1 = P2 >> 2; /* count = n/4 */
40 R2 = R1 << 8; /* create quad filler */
41 R2.L = R2.L + R1.L(NS);
42 R2.H = R2.L + R1.H(NS);
45 LSETUP (.Lquad_loop , .Lquad_loop) LC0=P1;
50 IF !CC JUMP .Lbytes_left;
54 R2 = R3; /* end point */
55 R3 = P0; /* current position */
56 R2 = R2 - R3; /* bytes left */
60 CC = P2 == 0; /* Check zero count */
61 IF CC JUMP .Lfinished; /* Unusual */
64 LSETUP (.Lbyte_loop , .Lbyte_loop) LC0=P2;
72 CC = BITTST (R0, 0); /* odd byte */
76 R0 = P0; /* Recover return address */
80 CC = R2 <= 2; /* 2 bytes */
81 P2 -= P1; /* reduce count */
82 IF !CC JUMP .Laligned;