2
* $Xorg: stipsparc.s,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $
3
* $XdotOrg: xserver/xorg/cfb/stipsparc.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/stipsparc.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 ... */
46
# define FourBits(dest,bits) and bits, 0xf, dest
53
# define FourBits(dest,bits) srl bits, 28, dest
57
* cfbStippleStack(addr, stipple, value, stride, Count, Shift)
58
* 4 5 6 7 16(sp) 20(sp)
60
* Apply successive 32-bit stipples starting at addr, addr+stride, ...
62
* Used for text rendering, but only when no data could be lost
63
* when the stipple is shifted left by Shift bits
80
#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */
81
#define CASE_MASK 0x1e0 /* first case mask */
83
#define ForEachLine LY1
86
#define ForEachBits LY4
89
#if defined(SVR4) || defined(__ELF__)
91
#define _cfbStippleStack cfbStippleStackTE
93
#define _cfbStippleStack cfbStippleStack
97
#define _cfbStippleStack _cfbStippleStackTE
102
.globl _cfbStippleStack
110
mov %o7,sbase /* sbase = 1b(1:) */
111
add sbase, CaseBegin-1b, sbase
112
#else /* !SHAREDCODE */
113
sethi %hi(CaseBegin),sbase /* load up switch table */
114
or sbase,%lo(CaseBegin),sbase
115
#endif /* SHAREDCODE */
116
mov 4,lshift /* compute offset within */
117
sub lshift, shift, lshift /* stipple of remaining bits */
119
inc CASE_SIZE, shift /* first shift for LSB */
121
inc 28-CASE_SIZE, shift /* first shift for MSB */
123
/* do ... while (--count > 0); */
125
ld [stipple],bits /* get stipple bits */
126
mov addr,atemp /* set up for this line */
128
/* Terminal emulator fonts are expanded and have many 0 rows */
130
bz NextLine /* skip out early on 0 */
132
add addr, stride, addr /* step for the loop */
133
BitsR bits, shift, stemp /* get first bits */
134
and stemp, CASE_MASK, stemp /* compute first jump */
135
BitsL bits, lshift, bits /* set remaining bits */
136
jmp sbase+stemp /* ... */
142
FourBits(stemp, bits) /* compute jump for */
143
sll stemp, CASE_SIZE, stemp /* these four bits */
144
BitsL bits, 4, bits /* step for remaining bits */
145
jmp sbase+stemp /* jump */
148
bnz,a ForEachBits1 /* 0 */
158
bnz ForEachBits /* 1 */
159
stb value, [atemp+BO(0)]
167
bnz ForEachBits /* 2 */
168
stb value, [atemp+BO(1)]
176
bnz ForEachBits /* 3 */
177
sth value, [atemp+HO(0)]
185
bnz ForEachBits /* 4 */
186
stb value, [atemp+BO(2)]
194
stb value, [atemp+BO(0)] /* 5 */
196
stb value, [atemp+BO(2)]
203
stb value, [atemp+BO(1)] /* 6 */
205
stb value, [atemp+BO(2)]
212
sth value, [atemp+HO(0)] /* 7 */
214
stb value, [atemp+BO(2)]
221
bnz ForEachBits /* 8 */
222
stb value, [atemp+BO(3)]
230
stb value, [atemp+BO(0)] /* 9 */
232
stb value, [atemp+BO(3)]
239
stb value, [atemp+BO(1)] /* a */
241
stb value, [atemp+BO(3)]
248
sth value, [atemp+HO(0)] /* b */
250
stb value, [atemp+BO(3)]
257
bnz ForEachBits /* c */
258
sth value, [atemp+HO(2)]
266
stb value, [atemp+BO(0)] /* d */
268
sth value, [atemp+HO(2)]
275
stb value, [atemp+BO(1)] /* e */
277
sth value, [atemp+HO(2)]
284
bnz ForEachBits /* f */
285
st value, [atemp+WO(0)]