2
* $Xorg: stipsparc.s,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $
4
Copyright 1990, 1998 The Open Group
6
Permission to use, copy, modify, distribute, and sell this software and its
7
documentation for any purpose is hereby granted without fee, provided that
8
the above copyright notice appear in all copies and that both that
9
copyright notice and this permission notice appear in supporting
12
The above copyright notice and this permission notice shall be included in
13
all copies or substantial portions of the Software.
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
Except as contained in this notice, the name of The Open Group shall not be
23
used in advertising or otherwise to promote the sale, use or other dealings
24
in this Software without prior written authorization from The Open Group.
26
* Author: Keith Packard, MIT X Consortium
28
/* $XFree86: xc/programs/Xserver/cfb/stipsparc.s,v 1.5 2001/12/14 19:59:26 dawes Exp $ */
31
* SPARC assembly code for optimized text rendering.
33
* Other stippling could be done in assembly, but the payoff is
34
* not nearly as large. Mostly because large areas are heavily
38
/* not that I expect to ever see an LSB SPARC, but ... */
45
# define FourBits(dest,bits) and bits, 0xf, dest
52
# define FourBits(dest,bits) srl bits, 28, dest
56
* cfbStippleStack(addr, stipple, value, stride, Count, Shift)
57
* 4 5 6 7 16(sp) 20(sp)
59
* Apply successive 32-bit stipples starting at addr, addr+stride, ...
61
* Used for text rendering, but only when no data could be lost
62
* when the stipple is shifted left by Shift bits
79
#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */
80
#define CASE_MASK 0x1e0 /* first case mask */
82
#define ForEachLine LY1
85
#define ForEachBits LY4
88
#if defined(SVR4) || defined(__ELF__)
90
#define _cfbStippleStack cfbStippleStackTE
92
#define _cfbStippleStack cfbStippleStack
96
#define _cfbStippleStack _cfbStippleStackTE
101
.globl _cfbStippleStack
104
sethi %hi(CaseBegin),sbase /* load up switch table */
105
or sbase,%lo(CaseBegin),sbase
107
mov 4,lshift /* compute offset within */
108
sub lshift, shift, lshift /* stipple of remaining bits */
110
inc CASE_SIZE, shift /* first shift for LSB */
112
inc 28-CASE_SIZE, shift /* first shift for MSB */
114
/* do ... while (--count > 0); */
116
ld [stipple],bits /* get stipple bits */
117
mov addr,atemp /* set up for this line */
119
/* Terminal emulator fonts are expanded and have many 0 rows */
121
bz NextLine /* skip out early on 0 */
123
add addr, stride, addr /* step for the loop */
124
BitsR bits, shift, stemp /* get first bits */
125
and stemp, CASE_MASK, stemp /* compute first jump */
126
BitsL bits, lshift, bits /* set remaining bits */
127
jmp sbase+stemp /* ... */
133
FourBits(stemp, bits) /* compute jump for */
134
sll stemp, CASE_SIZE, stemp /* these four bits */
135
BitsL bits, 4, bits /* step for remaining bits */
136
jmp sbase+stemp /* jump */
139
bnz,a ForEachBits1 /* 0 */
149
bnz ForEachBits /* 1 */
150
stb value, [atemp+BO(0)]
158
bnz ForEachBits /* 2 */
159
stb value, [atemp+BO(1)]
167
bnz ForEachBits /* 3 */
168
sth value, [atemp+HO(0)]
176
bnz ForEachBits /* 4 */
177
stb value, [atemp+BO(2)]
185
stb value, [atemp+BO(0)] /* 5 */
187
stb value, [atemp+BO(2)]
194
stb value, [atemp+BO(1)] /* 6 */
196
stb value, [atemp+BO(2)]
203
sth value, [atemp+HO(0)] /* 7 */
205
stb value, [atemp+BO(2)]
212
bnz ForEachBits /* 8 */
213
stb value, [atemp+BO(3)]
221
stb value, [atemp+BO(0)] /* 9 */
223
stb value, [atemp+BO(3)]
230
stb value, [atemp+BO(1)] /* a */
232
stb value, [atemp+BO(3)]
239
sth value, [atemp+HO(0)] /* b */
241
stb value, [atemp+BO(3)]
248
bnz ForEachBits /* c */
249
sth value, [atemp+HO(2)]
257
stb value, [atemp+BO(0)] /* d */
259
sth value, [atemp+HO(2)]
266
stb value, [atemp+BO(1)] /* e */
268
sth value, [atemp+HO(2)]
275
bnz ForEachBits /* f */
276
st value, [atemp+WO(0)]