Pull video into test branch
[linux-drm-fsl-dcu.git] / arch / avr32 / lib / io-writesb.S
1 /*
2  * Copyright (C) 2004-2006 Atmel Corporation
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  */
8
9         .text
10 .Lnot_word_aligned:
11 1:      ld.ub   r8, r11++
12         sub     r10, 1
13         st.b    r12[0], r8
14         reteq   r12
15         tst     r11, r9
16         brne    1b
17
18         /* fall through */
19
20         .global __raw_writesb
21         .type   __raw_writesb,@function
22 __raw_writesb:
23         cp.w    r10, 0
24         mov     r9, 3
25         reteq   r12
26
27         tst     r11, r9
28         brne    .Lnot_word_aligned
29
30         sub     r10, 4
31         brlt    2f
32
33 1:      ld.w    r8, r11++
34         bfextu  r9, r8, 24, 8
35         st.b    r12[0], r9
36         bfextu  r9, r8, 16, 8
37         st.b    r12[0], r9
38         bfextu  r9, r8, 8, 8
39         st.b    r12[0], r9
40         st.b    r12[0], r8
41         sub     r10, 4
42         brge    1b
43
44 2:      sub     r10, -4
45         reteq   r12
46
47 3:      ld.ub   r8, r11++
48         sub     r10, 1
49         st.b    r12[0], r8
50         brne    3b
51
52         retal   r12