|
34 | 34 | /************************************************************************/ |
35 | 35 |
|
36 | 36 |
|
37 | | - |
38 | | -/ swap the words in a long-word. |
39 | | -.inline swapx,1 |
40 | | - movl 0(%esp),%eax |
41 | | - rol $16,%eax |
42 | | -.end |
43 | | - |
44 | | - |
45 | | -/ swap the words in a long-word |
46 | | -.inline word_swap_longword,1 |
47 | | - movl 0(%esp),%eax |
48 | | - rol $16,%eax |
49 | | -.end |
50 | | - |
51 | | -/swap the bytes in a 16-bit word |
52 | | -.inline byte_swap_word,1 |
53 | | - movl 0(%esp),%eax |
54 | | - rolw $8,%ax |
55 | | -.end |
56 | | - |
57 | | - |
58 | | -.inline word_swap_page,8 |
59 | | - movl 4(%esp),%ecx / word count into the loop counter |
60 | | - movl 0(%esp),%edx / address of the block to swap |
61 | | - movl 0(%edx),%eax |
62 | | - rolw $8,%ax |
63 | | - roll $16,%eax |
64 | | - rolw $8,%ax |
65 | | - movl %eax,0(%edx) |
66 | | - add $4,%edx |
67 | | - loop .-20 |
68 | | -.end |
69 | | - |
70 | | -.inline bit_reverse_region,16 |
71 | | -/args: (top width height rasterwidth) |
72 | | - .noopt |
73 | | - pushl %edi |
74 | | - pushl %esi |
75 | | - pushl %ebx |
76 | | - movl 12(%esp),%edx /top |
77 | | - movl %edx,%eax |
78 | | - andl $-2,%edx |
79 | | - movl %edx,12(%esp) |
80 | | - andl $1,%eax |
81 | | - shll $4,%eax |
82 | | - addl 16(%esp),%eax /width |
83 | | - movl 20(%esp),%edx /height |
84 | | -/ 24(%esp) /rasterwidth, in words |
85 | | - leal 31(%eax),%eax |
86 | | - sarl $5,%eax |
87 | | - leal (%eax,%eax),%eax |
88 | | - movl %eax,16(%esp) / word wid now in width. |
89 | | - cld / so we move up thru memory |
90 | | - leal reversedbits,%ebx / for xlateb |
91 | | - movl 12(%esp),%edi / starting init of word ptr |
92 | | - sub $0,%edx |
93 | | - jle .+63 |
94 | | -/ ..4: |
95 | | - movl %edi,%esi /so both edi & esi are at start of line to swap |
96 | | - |
97 | | - movl 16(%esp),%ecx / byte count to ecx |
98 | | - leal (%ecx,%ecx),%ecx |
99 | | -/ ..3: |
100 | | - lodsb |
101 | | - xlat |
102 | | - stosb |
103 | | - loop .-3 / ..3 |
104 | | - |
105 | | - movl 16(%esp),%ecx |
106 | | - incl %ecx |
107 | | - sarl $1,%ecx |
108 | | - movl 12(%esp),%esi / must be into esi, then edi, to |
109 | | -/ andl $-2,%edi / defeat the peephole optimizer. |
110 | | - movl %esi,%edi |
111 | | -/ ..5: |
112 | | - lodsl |
113 | | - rolw $8,%ax |
114 | | - roll $16,%eax |
115 | | - rolw $8,%ax |
116 | | - stosl |
117 | | - loop .-13 / ..5 |
118 | | - movl 12(%esp),%edi / word = word + rasterwidth |
119 | | - addl 24(%esp),%edi |
120 | | - addl 24(%esp),%edi |
121 | | - movl %edi,12(%esp) |
122 | | - decl %edx |
123 | | -/ .L60: / at this point, starting word addr is in %edi |
124 | | - jg .-59 / ..4 |
125 | | - popl %ebx |
126 | | - popl %esi |
127 | | - popl %edi |
128 | | - .optim |
129 | | -.end |
130 | | - |
131 | 37 | ///////////////////////////// |
132 | 38 | // |
133 | 39 | // Dispatch loop speedup functions for the 386i |
|
0 commit comments