diff options
author | Jens Arnold <amiconn@rockbox.org> | 2009-07-11 23:43:44 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2009-07-11 23:43:44 +0000 |
commit | 47d4c4739bafcb9864dc8d1c2b44903ad4f75b68 (patch) | |
tree | 7a9f510c72a0df2ddacb0f6ec393658cf676b8d4 /firmware/target/arm/samsung/yh820 | |
parent | fa59ed6ae724b3f75c8ba35efcf7ce18f21e3ed2 (diff) | |
download | rockbox-47d4c4739bafcb9864dc8d1c2b44903ad4f75b68.tar.gz rockbox-47d4c4739bafcb9864dc8d1c2b44903ad4f75b68.zip |
ARM asm LCD and ATA driver functions: Don't save r12 as it is a scratch reg. Saves a bit of stack and execution time.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21795 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/samsung/yh820')
-rw-r--r-- | firmware/target/arm/samsung/yh820/lcd-as-yh820.S | 79 |
1 files changed, 39 insertions, 40 deletions
diff --git a/firmware/target/arm/samsung/yh820/lcd-as-yh820.S b/firmware/target/arm/samsung/yh820/lcd-as-yh820.S index e466624d04..7187b83661 100644 --- a/firmware/target/arm/samsung/yh820/lcd-as-yh820.S +++ b/firmware/target/arm/samsung/yh820/lcd-as-yh820.S | |||
@@ -48,7 +48,7 @@ lcd_write_yuv420_lines: | |||
48 | @ r0 = yuv_src | 48 | @ r0 = yuv_src |
49 | @ r1 = width | 49 | @ r1 = width |
50 | @ r2 = stride | 50 | @ r2 = stride |
51 | stmfd sp!, { r4-r12 } @ save non-scratch | 51 | stmfd sp!, { r4-r10, lr } @ save non-scratch |
52 | ldmia r0, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p | 52 | ldmia r0, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p |
53 | @ r5 = yuv_src[1] = Cb_p | 53 | @ r5 = yuv_src[1] = Cb_p |
54 | @ r6 = yuv_src[2] = Cr_p | 54 | @ r6 = yuv_src[2] = Cr_p |
@@ -73,9 +73,9 @@ lcd_write_yuv420_lines: | |||
73 | add r10, r10, r8, asl #3 @ | 73 | add r10, r10, r8, asl #3 @ |
74 | add r10, r10, r8, asl #4 @ | 74 | add r10, r10, r8, asl #4 @ |
75 | @ | 75 | @ |
76 | add r11, r9, r9, asl #2 @ r9 = Cr*101 | 76 | add lr, r9, r9, asl #2 @ r9 = Cr*101 |
77 | add r11, r11, r9, asl #5 @ | 77 | add lr, lr, r9, asl #5 @ |
78 | add r9, r11, r9, asl #6 @ | 78 | add r9, lr, r9, asl #6 @ |
79 | @ | 79 | @ |
80 | add r8, r8, #2 @ r8 = bu = (Cb*128 + 128) >> 8 | 80 | add r8, r8, #2 @ r8 = bu = (Cb*128 + 128) >> 8 |
81 | mov r8, r8, asr #2 @ | 81 | mov r8, r8, asr #2 @ |
@@ -85,19 +85,19 @@ lcd_write_yuv420_lines: | |||
85 | mov r10, r10, asr #8 @ | 85 | mov r10, r10, asr #8 @ |
86 | @ compute R, G, and B | 86 | @ compute R, G, and B |
87 | add r0, r8, r7, asr #8 @ r0 = b = (Y >> 9) + bu | 87 | add r0, r8, r7, asr #8 @ r0 = b = (Y >> 9) + bu |
88 | add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv | 88 | add lr, r9, r7, asr #8 @ lr = r = (Y >> 9) + rv |
89 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv | 89 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv |
90 | @ | 90 | @ |
91 | orr r12, r0, r11 @ check if clamping is needed... | 91 | orr r12, r0, lr @ check if clamping is needed... |
92 | orr r12, r12, r7, asr #1 @ ...at all | 92 | orr r12, r12, r7, asr #1 @ ...at all |
93 | cmp r12, #31 @ | 93 | cmp r12, #31 @ |
94 | bls 15f @ no clamp @ | 94 | bls 15f @ no clamp @ |
95 | cmp r0, #31 @ clamp b | 95 | cmp r0, #31 @ clamp b |
96 | mvnhi r0, r0, asr #31 @ | 96 | mvnhi r0, r0, asr #31 @ |
97 | andhi r0, r0, #31 @ | 97 | andhi r0, r0, #31 @ |
98 | cmp r11, #31 @ clamp r | 98 | cmp lr, #31 @ clamp r |
99 | mvnhi r11, r11, asr #31 @ | 99 | mvnhi lr, lr, asr #31 @ |
100 | andhi r11, r11, #31 @ | 100 | andhi lr, lr, #31 @ |
101 | cmp r7, #63 @ clamp g | 101 | cmp r7, #63 @ clamp g |
102 | mvnhi r7, r7, asr #31 @ | 102 | mvnhi r7, r7, asr #31 @ |
103 | andhi r7, r7, #63 @ | 103 | andhi r7, r7, #63 @ |
@@ -105,14 +105,14 @@ lcd_write_yuv420_lines: | |||
105 | @ | 105 | @ |
106 | ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) | 106 | ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) |
107 | @ | 107 | @ |
108 | mov r11, r11, lsl #3 @ | 108 | mov lr, lr, lsl #3 @ |
109 | orr r11, r11, r7, lsr #3 @ r11 = (r << 3) | (g >> 3) | 109 | orr lr, lr, r7, lsr #3 @ lr = (r << 3) | (g >> 3) |
110 | orr r0, r0, r7, lsl #5 @ r0 = (g << 5) | b | 110 | orr r0, r0, r7, lsl #5 @ r0 = (g << 5) | b |
111 | 1: @ busy @ | 111 | 1: @ busy @ |
112 | ldr r7, [r3] @ r7 = LCD1_BASE | 112 | ldr r7, [r3] @ r7 = LCD1_BASE |
113 | tst r7, #LCD1_BUSY_MASK @ bridge busy? | 113 | tst r7, #LCD1_BUSY_MASK @ bridge busy? |
114 | bne 1b @ | 114 | bne 1b @ |
115 | str r11, [r3, #0x10] @ send MSB | 115 | str lr, [r3, #0x10] @ send MSB |
116 | 1: @busy @ | 116 | 1: @busy @ |
117 | ldr r7, [r3] @ r7 = LCD1_BASE | 117 | ldr r7, [r3] @ r7 = LCD1_BASE |
118 | tst r7, #LCD1_BUSY_MASK @ bridge busy? | 118 | tst r7, #LCD1_BUSY_MASK @ bridge busy? |
@@ -124,19 +124,19 @@ lcd_write_yuv420_lines: | |||
124 | add r7, r12, r7, asl #5 @ | 124 | add r7, r12, r7, asl #5 @ |
125 | @ compute R, G, and B | 125 | @ compute R, G, and B |
126 | add r0, r8, r7, asr #8 @ r0 = b = (Y >> 9) + bu | 126 | add r0, r8, r7, asr #8 @ r0 = b = (Y >> 9) + bu |
127 | add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv | 127 | add lr, r9, r7, asr #8 @ lr = r = (Y >> 9) + rv |
128 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv | 128 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv |
129 | @ | 129 | @ |
130 | orr r12, r0, r11 @ check if clamping is needed... | 130 | orr r12, r0, lr @ check if clamping is needed... |
131 | orr r12, r12, r7, asr #1 @ ...at all | 131 | orr r12, r12, r7, asr #1 @ ...at all |
132 | cmp r12, #31 @ | 132 | cmp r12, #31 @ |
133 | bls 15f @ no clamp @ | 133 | bls 15f @ no clamp @ |
134 | cmp r0, #31 @ clamp b | 134 | cmp r0, #31 @ clamp b |
135 | mvnhi r0, r0, asr #31 @ | 135 | mvnhi r0, r0, asr #31 @ |
136 | andhi r0, r0, #31 @ | 136 | andhi r0, r0, #31 @ |
137 | cmp r11, #31 @ clamp r | 137 | cmp lr, #31 @ clamp r |
138 | mvnhi r11, r11, asr #31 @ | 138 | mvnhi lr, lr, asr #31 @ |
139 | andhi r11, r11, #31 @ | 139 | andhi lr, lr, #31 @ |
140 | cmp r7, #63 @ clamp g | 140 | cmp r7, #63 @ clamp g |
141 | mvnhi r7, r7, asr #31 @ | 141 | mvnhi r7, r7, asr #31 @ |
142 | andhi r7, r7, #63 @ | 142 | andhi r7, r7, #63 @ |
@@ -144,14 +144,14 @@ lcd_write_yuv420_lines: | |||
144 | @ | 144 | @ |
145 | ldrb r12, [r4], #1 @ r12 = Y' = *(Y'_p++) | 145 | ldrb r12, [r4], #1 @ r12 = Y' = *(Y'_p++) |
146 | @ | 146 | @ |
147 | mov r11, r11, lsl #3 @ | 147 | mov lr, lr, lsl #3 @ |
148 | orr r11, r11, r7, lsr #3 @ r11 = (r << 3) | (g >> 3) | 148 | orr lr, lr, r7, lsr #3 @ lr = (r << 3) | (g >> 3) |
149 | orr r0, r0, r7, lsl #5 @ r0 = (g << 5) | b | 149 | orr r0, r0, r7, lsl #5 @ r0 = (g << 5) | b |
150 | 1: @ busy @ | 150 | 1: @ busy @ |
151 | ldr r7, [r3] @ r7 = LCD1_BASE | 151 | ldr r7, [r3] @ r7 = LCD1_BASE |
152 | tst r7, #LCD1_BUSY_MASK @ bridge busy? | 152 | tst r7, #LCD1_BUSY_MASK @ bridge busy? |
153 | bne 1b @ | 153 | bne 1b @ |
154 | str r11, [r3, #0x10] @ send MSB | 154 | str lr, [r3, #0x10] @ send MSB |
155 | 1: @ busy @ | 155 | 1: @ busy @ |
156 | ldr r7, [r3] @ r7 = LCD1_BASE | 156 | ldr r7, [r3] @ r7 = LCD1_BASE |
157 | tst r7, #LCD1_BUSY_MASK @ bridge busy? | 157 | tst r7, #LCD1_BUSY_MASK @ bridge busy? |
@@ -163,19 +163,19 @@ lcd_write_yuv420_lines: | |||
163 | add r7, r12, r7, asl #5 @ | 163 | add r7, r12, r7, asl #5 @ |
164 | @ compute R, G, and B | 164 | @ compute R, G, and B |
165 | add r0, r8, r7, asr #8 @ r0 = b = (Y >> 9) + bu | 165 | add r0, r8, r7, asr #8 @ r0 = b = (Y >> 9) + bu |
166 | add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv | 166 | add lr, r9, r7, asr #8 @ lr = r = (Y >> 9) + rv |
167 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv | 167 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv |
168 | @ | 168 | @ |
169 | orr r12, r0, r11 @ check if clamping is needed... | 169 | orr r12, r0, lr @ check if clamping is needed... |
170 | orr r12, r12, r7, asr #1 @ ...at all | 170 | orr r12, r12, r7, asr #1 @ ...at all |
171 | cmp r12, #31 @ | 171 | cmp r12, #31 @ |
172 | bls 15f @ no clamp @ | 172 | bls 15f @ no clamp @ |
173 | cmp r0, #31 @ clamp b | 173 | cmp r0, #31 @ clamp b |
174 | mvnhi r0, r0, asr #31 @ | 174 | mvnhi r0, r0, asr #31 @ |
175 | andhi r0, r0, #31 @ | 175 | andhi r0, r0, #31 @ |
176 | cmp r11, #31 @ clamp r | 176 | cmp lr, #31 @ clamp r |
177 | mvnhi r11, r11, asr #31 @ | 177 | mvnhi lr, lr, asr #31 @ |
178 | andhi r11, r11, #31 @ | 178 | andhi lr, lr, #31 @ |
179 | cmp r7, #63 @ clamp g | 179 | cmp r7, #63 @ clamp g |
180 | mvnhi r7, r7, asr #31 @ | 180 | mvnhi r7, r7, asr #31 @ |
181 | andhi r7, r7, #63 @ | 181 | andhi r7, r7, #63 @ |
@@ -184,14 +184,14 @@ lcd_write_yuv420_lines: | |||
184 | ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) | 184 | ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) |
185 | @ | 185 | @ |
186 | @ | 186 | @ |
187 | mov r11, r11, lsl #3 @ | 187 | mov lr, lr, lsl #3 @ |
188 | orr r11, r11, r7, lsr #3 @ r11 = (r << 3) | (g >> 3) | 188 | orr lr, lr, r7, lsr #3 @ lr = (r << 3) | (g >> 3) |
189 | orr r0, r0, r7, lsl #5 @ r0 = (g << 5) | b | 189 | orr r0, r0, r7, lsl #5 @ r0 = (g << 5) | b |
190 | 1: @ busy @ | 190 | 1: @ busy @ |
191 | ldr r7, [r3] @ r7 = LCD1_BASE | 191 | ldr r7, [r3] @ r7 = LCD1_BASE |
192 | tst r7, #LCD1_BUSY_MASK @ bridge busy? | 192 | tst r7, #LCD1_BUSY_MASK @ bridge busy? |
193 | bne 1b @ | 193 | bne 1b @ |
194 | str r11, [r3, #0x10] @ send MSB | 194 | str lr, [r3, #0x10] @ send MSB |
195 | 1: @ busy @ | 195 | 1: @ busy @ |
196 | ldr r7, [r3] @ r7 = LCD1_BASE | 196 | ldr r7, [r3] @ r7 = LCD1_BASE |
197 | tst r7, #LCD1_BUSY_MASK @ bridge busy? | 197 | tst r7, #LCD1_BUSY_MASK @ bridge busy? |
@@ -203,32 +203,32 @@ lcd_write_yuv420_lines: | |||
203 | add r7, r12, r7, asl #5 @ | 203 | add r7, r12, r7, asl #5 @ |
204 | @ compute R, G, and B | 204 | @ compute R, G, and B |
205 | add r0, r8, r7, asr #8 @ r0 = b = (Y >> 9) + bu | 205 | add r0, r8, r7, asr #8 @ r0 = b = (Y >> 9) + bu |
206 | add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv | 206 | add lr, r9, r7, asr #8 @ lr = r = (Y >> 9) + rv |
207 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv | 207 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv |
208 | @ | 208 | @ |
209 | orr r12, r0, r11 @ check if clamping is needed... | 209 | orr r12, r0, lr @ check if clamping is needed... |
210 | orr r12, r12, r7, asr #1 @ ...at all | 210 | orr r12, r12, r7, asr #1 @ ...at all |
211 | cmp r12, #31 @ | 211 | cmp r12, #31 @ |
212 | bls 15f @ no clamp @ | 212 | bls 15f @ no clamp @ |
213 | cmp r0, #31 @ clamp b | 213 | cmp r0, #31 @ clamp b |
214 | mvnhi r0, r0, asr #31 @ | 214 | mvnhi r0, r0, asr #31 @ |
215 | andhi r0, r0, #31 @ | 215 | andhi r0, r0, #31 @ |
216 | cmp r11, #31 @ clamp r | 216 | cmp lr, #31 @ clamp r |
217 | mvnhi r11, r11, asr #31 @ | 217 | mvnhi lr, lr, asr #31 @ |
218 | andhi r11, r11, #31 @ | 218 | andhi lr, lr, #31 @ |
219 | cmp r7, #63 @ clamp g | 219 | cmp r7, #63 @ clamp g |
220 | mvnhi r7, r7, asr #31 @ | 220 | mvnhi r7, r7, asr #31 @ |
221 | andhi r7, r7, #63 @ | 221 | andhi r7, r7, #63 @ |
222 | 15: @ no clamp @ | 222 | 15: @ no clamp @ |
223 | @ | 223 | @ |
224 | mov r11, r11, lsl #3 @ | 224 | mov lr, lr, lsl #3 @ |
225 | orr r11, r11, r7, lsr #3 @ r11 = (r << 3) | (g >> 3) | 225 | orr lr, lr, r7, lsr #3 @ lr = (r << 3) | (g >> 3) |
226 | orr r0, r0, r7, lsl #5 @ r0 = (g << 5) | b | 226 | orr r0, r0, r7, lsl #5 @ r0 = (g << 5) | b |
227 | 1: @ busy @ | 227 | 1: @ busy @ |
228 | ldr r7, [r3] @ r7 = LCD1_BASE | 228 | ldr r7, [r3] @ r7 = LCD1_BASE |
229 | tst r7, #LCD1_BUSY_MASK @ bridge busy? | 229 | tst r7, #LCD1_BUSY_MASK @ bridge busy? |
230 | bne 1b @ | 230 | bne 1b @ |
231 | str r11, [r3, #0x10] @ send MSB | 231 | str lr, [r3, #0x10] @ send MSB |
232 | 1: @ busy @ | 232 | 1: @ busy @ |
233 | ldr r7, [r3] @ r7 = LCD1_BASE | 233 | ldr r7, [r3] @ r7 = LCD1_BASE |
234 | tst r7, #LCD1_BUSY_MASK @ bridge busy? | 234 | tst r7, #LCD1_BUSY_MASK @ bridge busy? |
@@ -238,8 +238,7 @@ lcd_write_yuv420_lines: | |||
238 | subs r1, r1, #2 @ subtract block from width | 238 | subs r1, r1, #2 @ subtract block from width |
239 | bgt 10b @ loop line @ | 239 | bgt 10b @ loop line @ |
240 | @ | 240 | @ |
241 | ldmfd sp!, { r4-r12 } @ restore registers and return | 241 | ldmfd sp!, { r4-r10, pc } @ restore registers and return |
242 | bx lr @ | ||
243 | .ltorg @ dump constant pool | 242 | .ltorg @ dump constant pool |
244 | .size lcd_write_yuv420_lines, .-lcd_write_yuv420_lines | 243 | .size lcd_write_yuv420_lines, .-lcd_write_yuv420_lines |
245 | 244 | ||
@@ -279,7 +278,7 @@ lcd_write_yuv420_lines_odither: | |||
279 | @ r2 = stride | 278 | @ r2 = stride |
280 | @ r3 = x_screen | 279 | @ r3 = x_screen |
281 | @ [sp] = y_screen | 280 | @ [sp] = y_screen |
282 | stmfd sp!, { r4-r12, lr } @ save non-scratch | 281 | stmfd sp!, { r4-r11, lr } @ save non-scratch |
283 | ldmia r0, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p | 282 | ldmia r0, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p |
284 | @ r5 = yuv_src[1] = Cb_p | 283 | @ r5 = yuv_src[1] = Cb_p |
285 | @ r6 = yuv_src[2] = Cr_p | 284 | @ r6 = yuv_src[2] = Cr_p |
@@ -546,6 +545,6 @@ lcd_write_yuv420_lines_odither: | |||
546 | subs r1, r1, #2 @ subtract block from width | 545 | subs r1, r1, #2 @ subtract block from width |
547 | bgt 10b @ loop line @ | 546 | bgt 10b @ loop line @ |
548 | @ | 547 | @ |
549 | ldmfd sp!, { r4-r12, pc } @ restore registers and return | 548 | ldmfd sp!, { r4-r11, pc } @ restore registers and return |
550 | .ltorg @ dump constant pool | 549 | .ltorg @ dump constant pool |
551 | .size lcd_write_yuv420_lines_odither, .-lcd_write_yuv420_lines_odither | 550 | .size lcd_write_yuv420_lines_odither, .-lcd_write_yuv420_lines_odither |