Merge branch 'intelfb-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied...
[linux-2.6] / arch / avr32 / lib / io-readsw.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 .Lnot_word_aligned:
10         /*
11          * Bad alignment will cause a hardware exception, which is as
12          * good as anything. No need for us to check for proper alignment.
13          */
14         ld.uh   r8, r12[0]
15         sub     r10, 1
16         st.h    r11++, r8
17
18         /* fall through */
19
20         .global __raw_readsw
21         .type   __raw_readsw,@function
22 __raw_readsw:
23         cp.w    r10, 0
24         reteq   r12
25         mov     r9, 3
26         tst     r11, r9
27         brne    .Lnot_word_aligned
28
29         sub     r10, 2
30         brlt    2f
31
32 1:      ldins.h r8:t, r12[0]
33         ldins.h r8:b, r12[0]
34         st.w    r11++, r8
35         sub     r10, 2
36         brge    1b
37
38 2:      sub     r10, -2
39         reteq   r12
40
41         ld.uh   r8, r12[0]
42         st.h    r11++, r8
43         retal   r12