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.
26 P0 = R0 ; /* P0 = address */
27 P2 = R2 ; /* P2 = count */
28 R3 = R0 + R2; /* end */
30 IF CC JUMP .Ltoo_small;
31 R1 = R1.B (Z); /* R1 = fill char */
33 R2 = R0 & R2; /* addr bottom two bits */
34 CC = R2 == 0; /* AZ set if zero. */
35 IF !CC JUMP .Lforce_align ; /* Jump if addr not aligned. */
38 P1 = P2 >> 2; /* count = n/4 */
39 R2 = R1 << 8; /* create quad filler */
40 R2.L = R2.L + R1.L(NS);
41 R2.H = R2.L + R1.H(NS);
44 LSETUP (.Lquad_loop , .Lquad_loop) LC0=P1;
49 IF !CC JUMP .Lbytes_left;
53 R2 = R3; /* end point */
54 R3 = P0; /* current position */
55 R2 = R2 - R3; /* bytes left */
59 CC = P2 == 0; /* Check zero count */
60 IF CC JUMP .Lfinished; /* Unusual */
63 LSETUP (.Lbyte_loop , .Lbyte_loop) LC0=P2;
71 CC = BITTST (R0, 0); /* odd byte */
75 R0 = P0; /* Recover return address */
79 CC = R2 <= 2; /* 2 bytes */
80 P2 -= P1; /* reduce count */
81 IF !CC JUMP .Laligned;