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