2
* $Xorg: stipsprc32.s,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $
3
* $XdotOrg: xserver/xorg/cfb/stipsprc32.s,v 1.3 2004/04/26 02:39:58 alanc Exp $
5
Copyright 1990, 1998 The Open Group
7
Permission to use, copy, modify, distribute, and sell this software and its
8
documentation for any purpose is hereby granted without fee, provided that
9
the above copyright notice appear in all copies and that both that
10
copyright notice and this permission notice appear in supporting
13
The above copyright notice and this permission notice shall be included in
14
all copies or substantial portions of the Software.
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
Except as contained in this notice, the name of The Open Group shall not be
24
used in advertising or otherwise to promote the sale, use or other dealings
25
in this Software without prior written authorization from The Open Group.
27
* Author: Keith Packard, MIT X Consortium
29
/* $XFree86: xc/programs/Xserver/cfb/stipsprc32.s,v 1.4 2001/01/17 22:36:38 dawes Exp $ */
32
* SPARC assembly code for optimized text rendering.
34
* Other stippling could be done in assembly, but the payoff is
35
* not nearly as large. Mostly because large areas are heavily
39
/* not that I expect to ever see an LSB SPARC, but ... */
44
# define FourBits(dest,bits) and bits, 0xf, dest
49
# define FourBits(dest,bits) srl bits, 28, dest
53
* cfb32StippleStack(addr, stipple, value, stride, Count, Shift)
54
* 4 5 6 7 16(sp) 20(sp)
56
* Apply successive 32-bit stipples starting at addr, addr+stride, ...
58
* Used for text rendering, but only when no data could be lost
59
* when the stipple is shifted left by Shift bits
76
#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */
77
#define CASE_MASK 0x1e0 /* first case mask */
79
#define ForEachLine LY1
82
#define ForEachBits LY4
85
#if defined(SVR4) || defined(__ELF__)
87
#define _cfb32StippleStack cfb32StippleStackTE
89
#define _cfb32StippleStack cfb32StippleStack
93
#define _cfb32StippleStack _cfb32StippleStackTE
99
.globl _cfb32StippleStack
107
mov %o7,sbase /* sbase = 1b(1:) */
108
add sbase, CaseBegin-1b, sbase
109
#else /* !SHAREDCODE */
110
sethi %hi(CaseBegin),sbase /* load up switch table */
111
or sbase,%lo(CaseBegin),sbase
112
#endif /* !SHAREDCODE */
113
mov 4,lshift /* compute offset within */
114
sub lshift, shift, lshift /* stipple of remaining bits */
116
inc CASE_SIZE, shift /* first shift for LSB */
118
inc 28-CASE_SIZE, shift /* first shift for MSB */
120
/* do ... while (--count > 0); */
122
ld [stipple],bits /* get stipple bits */
123
mov addr,atemp /* set up for this line */
125
/* Terminal emulator fonts are expanded and have many 0 rows */
127
bz NextLine /* skip out early on 0 */
129
add addr, stride, addr /* step for the loop */
130
BitsR bits, shift, stemp /* get first bits */
131
and stemp, CASE_MASK, stemp /* compute first jump */
132
BitsL bits, lshift, bits /* set remaining bits */
133
jmp sbase+stemp /* ... */
139
FourBits(stemp, bits) /* compute jump for */
140
sll stemp, CASE_SIZE, stemp /* these four bits */
141
BitsL bits, 4, bits /* step for remaining bits */
142
jmp sbase+stemp /* jump */
145
bnz,a ForEachBits1 /* 0 */
156
bnz ForEachBits /* 1 */
157
st value, [atemp+WO(12)]
165
bnz ForEachBits /* 2 */
166
st value, [atemp+WO(8)]
174
st value, [atemp+WO(8)] /* 3 */
176
st value, [atemp+WO(12)]
183
bnz ForEachBits /* 4 */
184
st value, [atemp+WO(4)]
192
st value, [atemp+WO(4)] /* 5 */
194
st value, [atemp+WO(12)]
201
st value, [atemp+WO(4)] /* 6 */
203
st value, [atemp+WO(8)]
210
st value, [atemp+WO(4)] /* 7 */
211
st value, [atemp+WO(8)]
213
st value, [atemp+WO(12)]
219
bnz ForEachBits /* 8 */
220
st value, [atemp+WO(0)]
228
st value, [atemp+WO(0)] /* 9 */
230
st value, [atemp+WO(12)]
237
st value, [atemp+WO(0)] /* a */
239
st value, [atemp+WO(8)]
246
st value, [atemp+WO(0)] /* b */
247
st value, [atemp+WO(8)]
249
st value, [atemp+WO(12)]
255
st value, [atemp+WO(0)] /* c */
257
st value, [atemp+WO(4)]
264
st value, [atemp+WO(0)] /* d */
265
st value, [atemp+WO(4)]
267
st value, [atemp+WO(12)]
273
st value, [atemp+WO(0)] /* e */
274
st value, [atemp+WO(4)]
276
st value, [atemp+WO(8)]
282
st value, [atemp+WO(0)] /* f */
283
st value, [atemp+WO(4)]
284
st value, [atemp+WO(8)]
286
st value, [atemp+WO(12)]