1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
|
Index: Mesa-6.4.2/src/mesa/x86/mmx_blend.S
===================================================================
--- Mesa-6.4.2.orig/src/mesa/x86/mmx_blend.S
+++ Mesa-6.4.2/src/mesa/x86/mmx_blend.S
@@ -1,4 +1,4 @@
-
+ ;
/*
* Written by Jos� Fonseca <j_r_fonseca@yahoo.co.uk>
*/
@@ -240,7 +240,9 @@ TWO(PUNPCKHDQ ( MA2, MA2 ))
ONE(MOVD ( MSS, REGIND(rgba) )) /* | | | | sa1 | sb1 | sg1 | sr1 */ ;\
TWO(MOVQ ( MSS, REGIND(rgba) )) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */
-
+/* Kevin F. Quinn <kevquinn@gentoo.org> 2 July 2006
+ * Replace data segment constants with text-segment
+ * constants (via pushl/movq)
SEG_DATA
ALIGNDATA8
@@ -249,6 +251,11 @@ const_0080:
const_80:
D_LONG 0x80808080, 0x80808080
+*/
+#define const_0080_l 0x00800080
+#define const_0080_h 0x00800080
+#define const_80_l 0x80808080
+#define const_80_h 0x80808080
SEG_TEXT
@@ -302,8 +309,16 @@ TWO(MOVQ ( MM1, REGIND(rgba) ))
#define TAG(x) CONCAT(x,_min)
#define LLTAG(x) LLBL2(x,_min)
+/* Kevin F. Quinn 2nd July 2006
+ * Replace data segment constants with text-segment instructions
+#define INIT \
+ MOVQ ( CONTENT(const_80), MM7 )
+ */
#define INIT \
- MOVQ ( CONTENT(const_80), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/
+ PUSH_L ( CONST(const_80_h) ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/ ;\
+ PUSH_L ( CONST(const_80_l) ) ;\
+ MOVQ ( REGIND(ESP), MM7 ) ;\
+ ADD_L ( CONST(8), ESP)
#define MAIN( rgba, dest ) \
GMB_LOAD( rgba, dest, MM1, MM2 ) ;\
@@ -326,8 +341,16 @@ TWO(MOVQ ( MM1, REGIND(rgba) ))
#define TAG(x) CONCAT(x,_max)
#define LLTAG(x) LLBL2(x,_max)
+/* Kevin F. Quinn 2nd July 2006
+ * Replace data segment constants with text-segment instructions
#define INIT \
- MOVQ ( CONTENT(const_80), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/
+ MOVQ ( CONTENT(const_80), MM7 )
+ */
+#define INIT \
+ PUSH_L ( CONST(const_80_l) ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/ ;\
+ PUSH_L ( CONST(const_80_h) ) ;\
+ MOVQ ( REGIND(ESP), MM7 ) ;\
+ ADD_L ( CONST(8), ESP)
#define MAIN( rgba, dest ) \
GMB_LOAD( rgba, dest, MM1, MM2 ) ;\
@@ -350,9 +373,17 @@ TWO(MOVQ ( MM1, REGIND(rgba) ))
#define TAG(x) CONCAT(x,_modulate)
#define LLTAG(x) LLBL2(x,_modulate)
+/* Kevin F. Quinn 2nd July 2006
+ * Replace data segment constants with text-segment instructions
+#define INIT \
+ MOVQ ( CONTENT(const_0080), MM7 )
+ */
#define INIT \
PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ ;\
- MOVQ ( CONTENT(const_0080), MM7 ) /* 0x0080 | 0x0080 | 0x0080 | 0x0080 */
+ PUSH_L ( CONST(const_0080_l) ) /* 0x0080 | 0x0080 | 0x0080 | 0x0080 */ ;\
+ PUSH_L ( CONST(const_0080_h) ) ;\
+ MOVQ ( REGIND(ESP), MM7 ) ;\
+ ADD_L ( CONST(8), ESP)
#define MAIN( rgba, dest ) \
GMB_LOAD( rgba, dest, MM1, MM2 ) ;\
Index: Mesa-6.4.2/src/mesa/x86/read_rgba_span_x86.S
===================================================================
--- Mesa-6.4.2.orig/src/mesa/x86/read_rgba_span_x86.S
+++ Mesa-6.4.2/src/mesa/x86/read_rgba_span_x86.S
@@ -32,6 +32,8 @@
.file "read_rgba_span_x86.S"
#if !defined(__DJGPP__) && !defined(__MINGW32__) /* this one cries for assyntax.h */
+/* Kevin F. Quinn 2nd July 2006
+ * Replace data segment constants with text-segment instructions
.section .rodata
.align 16
.type mask, @object
@@ -45,6 +47,19 @@ mask:
.long 0x00ff0000
.long 0x00ff0000
.long 0x00ff0000
+ */
+#define LOAD_MASK(mvins,m1,m2) \
+ pushl $0xff00ff00 ;\
+ pushl $0xff00ff00 ;\
+ pushl $0xff00ff00 ;\
+ pushl $0xff00ff00 ;\
+ mvins (%esp), m1 ;\
+ pushl $0x00ff0000 ;\
+ pushl $0x00ff0000 ;\
+ pushl $0x00ff0000 ;\
+ pushl $0x00ff0000 ;\
+ mvins (%esp), m2 ;\
+ addl $32, %esp
/* I implemented these as macros because the appear in quite a few places,
@@ -84,8 +99,12 @@ _generic_read_RGBA_span_BGRA8888_REV_MMX
#ifdef USE_INNER_EMMS
emms
#endif
+/* Kevin F. Quinn 2nd July 2006
+ * Replace data segment constants with text-segment instructions
movq mask, %mm1
movq mask+16, %mm2
+ */
+ LOAD_MASK(movq,%mm1,%mm2)
movl 8(%esp), %ebx /* source pointer */
movl 16(%esp), %edx /* number of pixels to copy */
@@ -182,8 +201,12 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE
#ifdef USE_INNER_EMMS
emms
#endif
+/* Kevin F. Quinn 2nd July 2006
+ * Replace data segment constants with text-segment instructions
movq mask, %mm1
movq mask+16, %mm2
+ */
+ LOAD_MASK(movq,%mm1,%mm2)
movl 16(%esp), %ebx /* source pointer */
movl 24(%esp), %edx /* number of pixels to copy */
@@ -341,8 +364,12 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE
pushl %esi
pushl %ebx
+/* Kevin F. Quinn 2nd July 2006
+ * Replace data segment constants with text-segment instructions
movdqa mask, %xmm1
movdqa mask+16, %xmm2
+ */
+ LOAD_MASK(movdqa,%xmm1,%xmm2)
movl 12(%esp), %ebx /* source pointer */
movl 20(%esp), %edx /* number of pixels to copy */
@@ -464,6 +491,10 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE
+/* Kevin F. Quinn 2nd July 2006
+ * Replace data segment constants with text-segment instructions
+ */
+#if 0
.section .rodata
.align 16
@@ -510,6 +541,26 @@ scale:
alpha: .long 0x00000000
.long 0x00ff0000
+#endif
+
+#define MASK_565_L 0x07e0f800
+#define MASK_565_H 0x0000001f
+#define SCALE_ADJUST 5
+#if SCALE_ADJUST == 5
+#define PRESCALE_L 0x00100001
+#define PRESCALE_H 0x00000200
+#define SCALE_L 0x40C620E8
+#define SCALE_H 0x0000839d
+#elif SCALE_ADJUST == 0
+#define PRESCALE_L 0x00200001
+#define PRESCALE_H 0x00000800
+#define SCALE_L 0x01040108
+#define SCALE_H 0x00000108
+#else
+#error SCALE_ADJUST must either be 5 or 0.
+#endif
+#define ALPHA_L 0x00000000
+#define ALPHA_H 0x00ff0000
/**
* MMX optimized version of the RGB565 to RGBA copy routine.
@@ -530,9 +581,25 @@ _generic_read_RGBA_span_RGB565_MMX:
movl 8(%esp), %edx /* destination pointer */
movl 12(%esp), %ecx /* number of pixels to copy */
+/* Kevin F. Quinn 2nd July 2006
+ * Replace data segment constants with text-segment instructions
movq mask_565, %mm5
movq prescale, %mm6
movq scale, %mm7
+ */
+ pushl MASK_565_H
+ pushl MASK_565_L
+ movq (%esp), %mm5
+ pushl PRESCALE_H
+ pushl PRESCALE_L
+ movq (%esp), %mm6
+ pushl SCALE_H
+ pushl SCALE_L
+ movq (%esp), %mm7
+ pushl ALPHA_H
+ pushl ALPHA_L
+ movq (%esp), %mm3
+ addl $32,%esp
sarl $2, %ecx
jle .L01 /* Bail early if the count is negative. */
@@ -581,8 +648,13 @@ _generic_read_RGBA_span_RGB565_MMX:
/* Always set the alpha value to 0xff.
*/
+/* Kevin F. Quinn 2nd July 2006
+ * Replace data segment constants with text-segment instructions
por alpha, %mm0
por alpha, %mm2
+ */
+ por %mm3, %mm0
+ por %mm3, %mm2
/* Pack the 16-bit values to 8-bit values and store the converted
@@ -609,8 +681,13 @@ _generic_read_RGBA_span_RGB565_MMX:
pmulhuw %mm7, %mm0
pmulhuw %mm7, %mm2
+/* Kevin F. Quinn 2nd July 2006
+ * Replace data segment constants with text-segment instructions
por alpha, %mm0
por alpha, %mm2
+ */
+ por %mm3, %mm0
+ por %mm3, %mm2
packuswb %mm2, %mm0
@@ -647,8 +724,13 @@ _generic_read_RGBA_span_RGB565_MMX:
pmulhuw %mm7, %mm0
pmulhuw %mm7, %mm2
+/* Kevin F. Quinn 2nd July 2006
+ * Replace data segment constants with text-segment instructions
por alpha, %mm0
por alpha, %mm2
+ */
+ por %mm3, %mm0
+ por %mm3, %mm2
packuswb %mm2, %mm0
@@ -675,7 +757,11 @@ _generic_read_RGBA_span_RGB565_MMX:
#endif
pmulhuw %mm7, %mm0
+/* Kevin F. Quinn 2nd July 2006
+ * Replace data segment constants with text-segment instructions
por alpha, %mm0
+ */
+ por %mm3, %mm0
packuswb %mm0, %mm0
|