|
|
1.1 root 1: /* These are optimized x86 assembly versions of pfield_linetoscr.
2: * Feel free to send me Sparc/PPC/Alpha versions of this... :)
3: * [it's not necessarily a win to code these in assembler, though - Paul
4: * Liss says this code is slower than the generic C stuff in custom.c on
5: * a PPro]
6: */
7:
8: #include "config.h"
9:
10: /*#define X86_PPRO_OPT*/
11: #ifdef X86_PPRO_OPT
12: #define PARTIAL_REG(a,b) a
13: #define BYTE_MOVE movzbl
14: #define WORD_MOVE movzwl
15: #define CLEAR_FOR_BYTE_MOVE(a)
16: #else
17: #define PARTIAL_REG(a,b) b
18: #define BYTE_MOVE movb
19: #define WORD_MOVE movw
20: #define CLEAR_FOR_BYTE_MOVE(a) xorl a,a
21: #endif
22:
23: #ifndef USE_UNDERSCORE
24: #define SYM(NAME) NAME
25: #define FUNCTION_ALIGN .align 16
26: #define FUNCTYPE(NAME) .type NAME,@function
27: #else
28: #define SYM(NAME) _##NAME
29: #define FUNCTION_ALIGN .align 4
30: #define FUNCTYPE(NAME)
31: #endif
32:
33: .text
34:
35: .globl DitherLine
36: #ifndef USE_UNDERSCORE
37: .type DitherLine,@function
38: #endif
39: FUNCTION_ALIGN
40: DitherLine:
41: pushl %ebp
42: pushl %edi
43: pushl %esi
44: pushl %ebx
45: movl 20(%esp),%edi
46: xorl %ebx,%ebx
47: movw 36(%esp),%bx
48: movl 32(%esp),%edx
49: andl $3,%edx
50: sall $15,%edx
51: movl 28(%esp),%eax
52: andl $3,%eax
53: sall $12,%eax
54: leal SYM(cidx)(%edx,%eax),%ebp
55: xorb %dl,%dl
56: movl $8,%ecx
57: testl %ebx,%ebx
58: je .Li_end
59: cmpl $8,40(%esp)
60: je .Li_fast
61:
62: movl 24(%esp),%esi
63: .Li_loop:
64: movzwl (%esi),%eax
65: movzbl (%eax,%ebp),%eax
66: subl 40(%esp),%ecx
67: sall %cl,%eax
68: orb %al,%dl
69: testl %ecx,%ecx
70: jne .Li_1
71: movb %dl,(%edi)
72: incl %edi
73: movl $8,%ecx
74: xorb %dl,%dl
75: .Li_1:
76: movzwl 2(%esi),%eax
77: movzbl 4096(%ebp,%eax),%eax
78: subl 40(%esp),%ecx
79: sall %cl,%eax
80: orb %al,%dl
81: testl %ecx,%ecx
82: jne .Li_2
83: movb %dl,(%edi)
84: incl %edi
85: movl $8,%ecx
86: xorb %dl,%dl
87: .Li_2:
88: movzwl 4(%esi),%eax
89: movzbl 8192(%ebp,%eax),%eax
90: subl 40(%esp),%ecx
91: sall %cl,%eax
92: orb %al,%dl
93: testl %ecx,%ecx
94: jne .Li_3
95: movb %dl,(%edi)
96: incl %edi
97: movl $8,%ecx
98: xorb %dl,%dl
99: .Li_3:
100: movzwl 6(%esi),%eax
101: movzbl 12288(%ebp,%eax),%eax
102: addl $8,%esi
103: subl 40(%esp),%ecx
104: sall %cl,%eax
105: orb %al,%dl
106: testl %ecx,%ecx
107: jne .Li_4
108: movb %dl,(%edi)
109: incl %edi
110: movl $8,%ecx
111: xorb %dl,%dl
112: .Li_4:
113: subl $4,%ebx
114: jne .Li_loop
115: jmp .Li_end
116:
117: /* Fast 8-bit version */
118: .Li_fast:
119: movl 24(%esp),%esi
120: xorl %edx,%edx
121: xorl %ecx,%ecx
122: FUNCTION_ALIGN
123: .Li_fast_loop:
1.1.1.2 root 124: movw (%esi),%dx
1.1 root 125: movw 2(%esi),%cx
126: movb (%edx,%ebp),%al
127: movw 4(%esi),%dx
128: movb 4096(%ebp,%ecx),%ah
129:
130: movw 6(%esi),%cx
131: sall $16,%eax
132: movb 8192(%ebp,%edx),%al
133:
134: movb 12288(%ebp,%ecx),%ah
135:
136: roll $16,%eax
137: movl %eax,(%edi)
138: addl $4,%edi
139: addl $8,%esi
140:
141: subl $4,%ebx
142: jne .Li_fast_loop
143:
144: .Li_end:
145: popl %ebx
146: popl %esi
147: popl %edi
148: popl %ebp
149: ret
150: #if 0
151: .globl compiler_do_rts
152: /* Entry: EDX == regs.regs + 15 */
153: compiler_do_rts:
154: movl (%edx),%esi
155: addl address_space,%esi
156: movl jsr_num,%ecx
157: movl (%esi),%esi
158: orl %ecx,%ecx
1.1.1.3 root 159: bswap %esi
1.1 root 160: jz cdrts_noway
161: decl %ecx
162: cmpl jsr_rets(,%ecx,4),%esi
163: jne cdrts_noway
164: movl jsr_hash(,%ecx,4),%ebx
165: movl (%ebx),%ebx
166: orl %ebx,%ebx
167: jz cdrts_noway
168: addl $4,(%edx)
169: movl %ecx,jsr_num
170: jmp %ebx
171: cdrts_noway:
172: ret
173: #endif
174: #if 0
175: .globl longget_stub
176: longget_stub:
177: pushl %ecx
178: pushl %eax
179: pushl %edx
180: call SYM(longget)
181: popl %ecx
182: movl %eax,%ecx
183: popl %eax
184: ret
185:
186: .globl wordget_stub
187: wordget_stub:
188: pushl %ecx
189: pushl %eax
190: pushl %edx
191: call SYM(wordget)
192: popl %ecx
193: movl %eax,%ecx
194: popl %eax
195: ret
196:
197: .globl byteget_stub
198: byteget_stub:
199: pushl %ecx
200: pushl %eax
201: pushl %edx
202: call SYM(byteget)
203: popl %ecx
204: movl %eax,%ecx
205: popl %eax
206: ret
207:
208: .globl longput_stub
209: longput_stub:
210: pushl %ecx
211: pushl %eax
212: pushl %ebx
213: pushl %edx
214: call SYM(longput)
215: movl %eax,%ecx
216: addl $8,%esp
217: popl %eax
218: ret
219:
220: .globl wordput_stub
221: wordput_stub:
222: pushl %ecx
223: pushl %eax
224: pushl %ebx
225: pushl %edx
226: call SYM(wordput)
227: movl %eax,%ecx
228: addl $8,%esp
229: popl %eax
230: ret
231:
232: .globl byteput_stub
233: byteput_stub:
234: pushl %ecx
235: pushl %eax
236: pushl %ebx
237: pushl %edx
238: call SYM(byteput)
239: movl %eax,%ecx
240: addl $8,%esp
241: popl %eax
242: ret
243: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.