Merge branch 'libretro'
[pcsx_rearmed.git] / frontend / blit320.s
CommitLineData
02ee7e24 1/*
2 * (C) GraÅžvydas "notaz" Ignotas, 2011
3 *
4 * This work is licensed under the terms of any of these licenses
5 * (at your option):
6 * - GNU GPL, version 2 or later.
7 * - GNU LGPL, version 2.1 or later.
8 * See the COPYING file in the top-level directory.
9 *
10 * This code tries to make better use of pollux/arm926 store buffer
11 * by fusing words instead of using strhs.
12 */
13
14.text
15.align 2
16
17.macro lhw_str rl rt
18 lsl \rl, #16
19 lsr \rl, #16
20 orr \rl, \rt, lsl #16
21 str \rl, [r0], #4
22.endm
23
24.global blit320_640
25blit320_640:
26 stmfd sp!, {r4-r8,lr}
27 mov r12, #40
280:
29 ldmia r1!, {r2-r8,lr}
30 lhw_str r2, r3
31 lhw_str r4, r5
32 lhw_str r6, r7
33 subs r12, #1
34 lhw_str r8, lr
35 bgt 0b
36 ldmfd sp!, {r4-r8,pc}
37
38
39.global blit320_512
40blit320_512:
41 stmfd sp!, {r4-r8,lr}
42 mov r12, #32
430:
44 ldmia r1!, {r2-r8,lr}
45 lsl r2, #16
46 lsr r2, #16
47 orr r2, r3, lsl #16
48 str r2, [r0], #4 @ 0,2
49 lsr r4, #16
50 lsr r3, #16
51 orr r3, r4, lsl #16
52 str r3, [r0], #4 @ 3,5
53 lsr r5, #16
54 orr r5, r6, lsl #16
55 str r5, [r0], #4 @ 7,8
56 lsr r8, #16
57 lsr lr, #16
58 str r7, [r0], #4 @ 10,11
59 orr r8, lr, lsl #16
60 subs r12, #1
61 str r8, [r0], #4 @ 13,15
62 bgt 0b
63 ldmfd sp!, {r4-r8,pc}
64
65
66.macro unaligned_str rl rt
67 lsr \rl, #16
68 orr \rl, \rt, lsl #16
69 str \rl, [r0], #4
70.endm
71
72.global blit320_368
73blit320_368:
74 stmfd sp!, {r4-r8,lr}
75 mov r12, #23
760:
77 ldmia r1!, {r2-r8,lr}
78 unaligned_str r2, r3 @ 1,2
79 unaligned_str r3, r4 @ 3,4
80 unaligned_str r4, r5 @ 5,6
81 subs r12, #1
82 stmia r0!, {r6-r8,lr} @ 8-15
83 bgt 0b
84 ldmfd sp!, {r4-r8,pc}
85
86
87@ vim:filetype=armasm