2 * $XConsortium: stipsprc32.s,v 1.3 94/04/17 20:29:10 rws Exp $
4 Copyright (c) 1990 X Consortium
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
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 X CONSORTIUM 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 X Consortium 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 X Consortium.
27 * Author: Keith Packard, MIT X Consortium
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 ... */
43 # define FourBits(dest,bits) and bits, 0xf, dest
48 # define FourBits(dest,bits) srl bits, 28, dest
52 * cfb32StippleStack(addr, stipple, value, stride, Count, Shift)
53 * 4 5 6 7 16(sp) 20(sp)
55 * Apply successive 32-bit stipples starting at addr, addr+stride, ...
57 * Used for text rendering, but only when no data could be lost
58 * when the stipple is shifted left by Shift bits
75 #define CASE_SIZE 5 /* case blocks are 2^5 bytes each */
76 #define CASE_MASK 0x1e0 /* first case mask */
78 #define ForEachLine LY1
81 #define ForEachBits LY4
84 #if defined(SVR4) || (defined(linux) && (defined(sparc) || defined(__sparc__)))
86 #define _cfb32StippleStack cfb32StippleStackTE
88 #define _cfb32StippleStack cfb32StippleStack
92 #define _cfb32StippleStack _cfb32StippleStackTE
98 .globl _cfb32StippleStack
101 sethi %hi(CaseBegin),sbase /* load up switch table */
102 or sbase,%lo(CaseBegin),sbase
104 mov 4,lshift /* compute offset within */
105 sub lshift, shift, lshift /* stipple of remaining bits */
107 inc CASE_SIZE, shift /* first shift for LSB */
109 inc 28-CASE_SIZE, shift /* first shift for MSB */
111 /* do ... while (--count > 0); */
113 ld [stipple],bits /* get stipple bits */
114 mov addr,atemp /* set up for this line */
116 /* Terminal emulator fonts are expanded and have many 0 rows */
118 bz NextLine /* skip out early on 0 */
120 add addr, stride, addr /* step for the loop */
121 BitsR bits, shift, stemp /* get first bits */
122 and stemp, CASE_MASK, stemp /* compute first jump */
123 BitsL bits, lshift, bits /* set remaining bits */
124 jmp sbase+stemp /* ... */
130 FourBits(stemp, bits) /* compute jump for */
131 sll stemp, CASE_SIZE, stemp /* these four bits */
132 BitsL bits, 4, bits /* step for remaining bits */
133 jmp sbase+stemp /* jump */
136 bnz,a ForEachBits1 /* 0 */
147 bnz ForEachBits /* 1 */
148 st value, [atemp+WO(12)]
156 bnz ForEachBits /* 2 */
157 st value, [atemp+WO(8)]
165 st value, [atemp+WO(8)] /* 3 */
167 st value, [atemp+WO(12)]
174 bnz ForEachBits /* 4 */
175 st value, [atemp+WO(4)]
183 st value, [atemp+WO(4)] /* 5 */
185 st value, [atemp+WO(12)]
192 st value, [atemp+WO(4)] /* 6 */
194 st value, [atemp+WO(8)]
201 st value, [atemp+WO(4)] /* 7 */
202 st value, [atemp+WO(8)]
204 st value, [atemp+WO(12)]
210 bnz ForEachBits /* 8 */
211 st value, [atemp+WO(0)]
219 st value, [atemp+WO(0)] /* 9 */
221 st value, [atemp+WO(12)]
228 st value, [atemp+WO(0)] /* a */
230 st value, [atemp+WO(8)]
237 st value, [atemp+WO(0)] /* b */
238 st value, [atemp+WO(8)]
240 st value, [atemp+WO(12)]
246 st value, [atemp+WO(0)] /* c */
248 st value, [atemp+WO(4)]
255 st value, [atemp+WO(0)] /* d */
256 st value, [atemp+WO(4)]
258 st value, [atemp+WO(12)]
264 st value, [atemp+WO(0)] /* e */
265 st value, [atemp+WO(4)]
267 st value, [atemp+WO(8)]
273 st value, [atemp+WO(0)] /* f */
274 st value, [atemp+WO(4)]
275 st value, [atemp+WO(8)]
277 st value, [atemp+WO(12)]