annotate src/hermes/mmxp2_32.asm @ 1861:b42823412c3b

Fixed bug #232 ------- Comment #2 From Matthias Geissert 2006-05-24 07:54 [reply] ------- See http://dri.sourceforge.net/doc/DRIuserguide.html, section 11.5. There is written that you need to use RTLD_GLOBAL, since, otherwise, nested open of dynamic libraries doesn't work. However, This is necassary in this case, since libGL opens the hardware-specific driver/library. I hope this helps you.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 20 Jun 2006 03:52:41 +0000
parents 88c2d6aed428
children 393092a3ebf6
rev   line source
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
1 ;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
2 ; pII-optimised MMX format converters for HERMES
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
3 ; Copyright (c) 1998 Christian Nentwich (c.nentwich@cs.ucl.ac.uk)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
4 ; and (c) 1999 Jonathan Matthew (jmatthew@uq.net.au)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
5 ; This source code is licensed under the GNU LGPL
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
6 ;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
7 ; Please refer to the file COPYING.LIB contained in the distribution for
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
8 ; licensing conditions
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
9 ;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
10 ; COPYRIGHT NOTICE
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
11 ;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
12 ; This file partly contains code that is (c) Intel Corporation, specifically
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
13 ; the mode detection routine, and the converter to 15 bit (8 pixel
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
14 ; conversion routine from the mmx programming tutorial pages).
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
15 ;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
16 ;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
17 ; These routines aren't exactly pII optimised - it's just that as they
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
18 ; are, they're terrible on p5 MMXs, but less so on pIIs. Someone needs to
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
19 ; optimise them for p5 MMXs..
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
20
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
21 BITS 32
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
22
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
23
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
24 GLOBAL _ConvertMMXpII32_24RGB888
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
25 GLOBAL _ConvertMMXpII32_16RGB565
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
26 GLOBAL _ConvertMMXpII32_16BGR565
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
27 GLOBAL _ConvertMMXpII32_16RGB555
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
28 GLOBAL _ConvertMMXpII32_16BGR555
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
29
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
30 EXTERN _mmxreturn
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
31
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
32 ;; Macros for conversion routines
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
33
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
34 %macro _push_immq_mask 1
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
35 push dword %1
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
36 push dword %1
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
37 %endmacro
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
38
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
39 %macro load_immq 2
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
40 _push_immq_mask %2
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
41 movq %1, [esp]
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
42 %endmacro
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
43
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
44 %macro pand_immq 2
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
45 _push_immq_mask %2
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
46 pand %1, [esp]
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
47 %endmacro
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
48
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
49 %define CLEANUP_IMMQ_LOADS(num) \
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
50 add esp, byte 8 * num
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
51
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
52 %define mmx32_rgb888_mask 00ffffffh
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
53 %define mmx32_rgb565_b 000000f8h
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
54 %define mmx32_rgb565_g 0000fc00h
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
55 %define mmx32_rgb565_r 00f80000h
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
56
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
57 %define mmx32_rgb555_rb 00f800f8h
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
58 %define mmx32_rgb555_g 0000f800h
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
59 %define mmx32_rgb555_mul 20000008h
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
60 %define mmx32_bgr555_mul 00082000h
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
61
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
62 SECTION .text
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
63
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
64 _ConvertMMXpII32_24RGB888:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
65
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
66 ; set up mm6 as the mask, mm7 as zero
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
67 load_immq mm6, mmx32_rgb888_mask
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
68 CLEANUP_IMMQ_LOADS(1)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
69 pxor mm7, mm7
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
70
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
71 mov edx, ecx ; save ecx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
72 and ecx, 0fffffffch ; clear lower two bits
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
73 jnz .L1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
74 jmp .L2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
75
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
76 .L1:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
77
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
78 movq mm0, [esi] ; A R G B a r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
79 pand mm0, mm6 ; 0 R G B 0 r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
80 movq mm1, [esi+8] ; A R G B a r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
81 pand mm1, mm6 ; 0 R G B 0 r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
82
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
83 movq mm2, mm0 ; 0 R G B 0 r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
84 punpckhdq mm2, mm7 ; 0 0 0 0 0 R G B
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
85 punpckldq mm0, mm7 ; 0 0 0 0 0 r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
86 psllq mm2, 24 ; 0 0 R G B 0 0 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
87 por mm0, mm2 ; 0 0 R G B r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
88
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
89 movq mm3, mm1 ; 0 R G B 0 r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
90 psllq mm3, 48 ; g b 0 0 0 0 0 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
91 por mm0, mm3 ; g b R G B r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
92
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
93 movq mm4, mm1 ; 0 R G B 0 r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
94 punpckhdq mm4, mm7 ; 0 0 0 0 0 R G B
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
95 punpckldq mm1, mm7 ; 0 0 0 0 0 r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
96 psrlq mm1, 16 ; 0 0 0 R G B 0 r
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
97 psllq mm4, 8 ; 0 0 0 0 R G B 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
98 por mm1, mm4 ; 0 0 0 0 R G B r
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
99
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
100 movq [edi], mm0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
101 add esi, BYTE 16
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
102 movd [edi+8], mm1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
103 add edi, BYTE 12
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
104 sub ecx, BYTE 4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
105 jnz .L1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
106
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
107 .L2:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
108 mov ecx, edx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
109 and ecx, BYTE 3
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
110 jz .L4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
111 .L3:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
112 mov al, [esi]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
113 mov bl, [esi+1]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
114 mov dl, [esi+2]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
115 mov [edi], al
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
116 mov [edi+1], bl
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
117 mov [edi+2], dl
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
118 add esi, BYTE 4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
119 add edi, BYTE 3
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
120 dec ecx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
121 jnz .L3
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
122 .L4:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
123 jmp _mmxreturn
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
124
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
125
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
126
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
127 _ConvertMMXpII32_16RGB565:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
128
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
129 ; set up masks
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
130 load_immq mm5, mmx32_rgb565_b
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
131 load_immq mm6, mmx32_rgb565_g
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
132 load_immq mm7, mmx32_rgb565_r
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
133 CLEANUP_IMMQ_LOADS(3)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
134
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
135 mov edx, ecx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
136 shr ecx, 2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
137 jnz .L1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
138 jmp .L2 ; not necessary at the moment, but doesn't hurt (much)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
139
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
140 .L1:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
141 movq mm0, [esi] ; argb
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
142 movq mm1, mm0 ; argb
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
143 pand mm0, mm6 ; 00g0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
144 movq mm3, mm1 ; argb
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
145 pand mm1, mm5 ; 000b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
146 pand mm3, mm7 ; 0r00
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
147 pslld mm1, 2 ; 0 0 000000bb bbb00000
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
148 por mm0, mm1 ; 0 0 ggggggbb bbb00000
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
149 psrld mm0, 5 ; 0 0 00000ggg gggbbbbb
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
150
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
151 movq mm4, [esi+8] ; argb
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
152 movq mm2, mm4 ; argb
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
153 pand mm4, mm6 ; 00g0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
154 movq mm1, mm2 ; argb
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
155 pand mm2, mm5 ; 000b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
156 pand mm1, mm7 ; 0r00
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
157 pslld mm2, 2 ; 0 0 000000bb bbb00000
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
158 por mm4, mm2 ; 0 0 ggggggbb bbb00000
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
159 psrld mm4, 5 ; 0 0 00000ggg gggbbbbb
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
160
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
161 packuswb mm3, mm1 ; R 0 r 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
162 packssdw mm0, mm4 ; as above.. ish
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
163 por mm0, mm3 ; done.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
164 movq [edi], mm0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
165
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
166 add esi, 16
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
167 add edi, 8
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
168 dec ecx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
169 jnz .L1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
170
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
171 .L2:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
172 mov ecx, edx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
173 and ecx, BYTE 3
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
174 jz .L4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
175 .L3:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
176 mov al, [esi]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
177 mov bh, [esi+1]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
178 mov ah, [esi+2]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
179 shr al, 3
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
180 and eax, 0F81Fh ; BYTE?
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
181 shr ebx, 5
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
182 and ebx, 07E0h ; BYTE?
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
183 add eax, ebx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
184 mov [edi], al
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
185 mov [edi+1], ah
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
186 add esi, BYTE 4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
187 add edi, BYTE 2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
188 dec ecx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
189 jnz .L3
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
190
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
191 .L4:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
192 jmp _mmxreturn
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
193
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
194
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
195 _ConvertMMXpII32_16BGR565:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
196
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
197 load_immq mm5, mmx32_rgb565_r
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
198 load_immq mm6, mmx32_rgb565_g
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
199 load_immq mm7, mmx32_rgb565_b
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
200 CLEANUP_IMMQ_LOADS(3)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
201
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
202 mov edx, ecx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
203 shr ecx, 2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
204 jnz .L1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
205 jmp .L2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
206
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
207 .L1:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
208 movq mm0, [esi] ; a r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
209 movq mm1, mm0 ; a r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
210 pand mm0, mm6 ; 0 0 g 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
211 movq mm3, mm1 ; a r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
212 pand mm1, mm5 ; 0 r 0 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
213 pand mm3, mm7 ; 0 0 0 b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
214
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
215 psllq mm3, 16 ; 0 b 0 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
216 psrld mm1, 14 ; 0 0 000000rr rrr00000
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
217 por mm0, mm1 ; 0 0 ggggggrr rrr00000
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
218 psrld mm0, 5 ; 0 0 00000ggg gggrrrrr
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
219
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
220 movq mm4, [esi+8] ; a r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
221 movq mm2, mm4 ; a r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
222 pand mm4, mm6 ; 0 0 g 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
223 movq mm1, mm2 ; a r g b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
224 pand mm2, mm5 ; 0 r 0 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
225 pand mm1, mm7 ; 0 0 0 b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
226
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
227 psllq mm1, 16 ; 0 b 0 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
228 psrld mm2, 14 ; 0 0 000000rr rrr00000
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
229 por mm4, mm2 ; 0 0 ggggggrr rrr00000
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
230 psrld mm4, 5 ; 0 0 00000ggg gggrrrrr
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
231
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
232 packuswb mm3, mm1 ; BBBBB000 00000000 bbbbb000 00000000
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
233 packssdw mm0, mm4 ; 00000GGG GGGRRRRR 00000GGG GGGRRRRR
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
234 por mm0, mm3 ; BBBBBGGG GGGRRRRR bbbbbggg gggrrrrr
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
235 movq [edi], mm0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
236
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
237 add esi, BYTE 16
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
238 add edi, BYTE 8
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
239 dec ecx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
240 jnz .L1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
241
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
242 .L2:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
243 and edx, BYTE 3
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
244 jz .L4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
245 .L3:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
246 mov al, [esi+2]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
247 mov bh, [esi+1]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
248 mov ah, [esi]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
249 shr al, 3
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
250 and eax, 0F81Fh ; BYTE ?
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
251 shr ebx, 5
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
252 and ebx, 07E0h ; BYTE ?
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
253 add eax, ebx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
254 mov [edi], al
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
255 mov [edi+1], ah
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
256 add esi, BYTE 4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
257 add edi, BYTE 2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
258 dec edx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
259 jnz .L3
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
260
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
261 .L4:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
262 jmp _mmxreturn
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
263
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
264 _ConvertMMXpII32_16BGR555:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
265
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
266 ; the 16BGR555 converter is identical to the RGB555 one,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
267 ; except it uses a different multiplier for the pmaddwd
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
268 ; instruction. cool huh.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
269
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
270 load_immq mm7, mmx32_bgr555_mul
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
271 jmp _convert_bgr555_cheat
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
272
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
273 ; This is the same as the Intel version.. they obviously went to
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
274 ; much more trouble to expand/coil the loop than I did, so theirs
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
275 ; would almost certainly be faster, even if only a little.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
276 ; I did rename 'mmx32_rgb555_add' to 'mmx32_rgb555_mul', which is
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
277 ; (I think) a more accurate name..
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
278 _ConvertMMXpII32_16RGB555:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
279
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
280 load_immq mm7, mmx32_rgb555_mul
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
281 _convert_bgr555_cheat:
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
282 load_immq mm6, mmx32_rgb555_g
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
283 CLEANUP_IMMQ_LOADS(2)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
284
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
285 mov edx,ecx ; Save ecx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
286
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
287 and ecx,BYTE 0fffffff8h ; clear lower three bits
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
288 jnz .L_OK
289
77b6110c797d Fixed "short jump out of range" error in MMX code
Sam Lantinga <slouken@libsdl.org>
parents: 0
diff changeset
289 jmp near .L2
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
290
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
291 .L_OK:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
292
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
293 movq mm2,[esi+8]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
294
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
295 movq mm0,[esi]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
296 movq mm3,mm2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
297
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
298 pand_immq mm3, mmx32_rgb555_rb
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
299 movq mm1,mm0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
300
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
301 pand_immq mm1, mmx32_rgb555_rb
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
302 pmaddwd mm3,mm7
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
303
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
304 CLEANUP_IMMQ_LOADS(2)
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
305
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
306 pmaddwd mm1,mm7
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
307 pand mm2,mm6
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
308
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
309 .L1:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
310 movq mm4,[esi+24]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
311 pand mm0,mm6
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
312
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
313 movq mm5,[esi+16]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
314 por mm3,mm2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
315
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
316 psrld mm3,6
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
317 por mm1,mm0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
318
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
319 movq mm0,mm4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
320 psrld mm1,6
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
321
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
322 pand_immq mm0, mmx32_rgb555_rb
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
323 packssdw mm1,mm3
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
324
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
325 movq mm3,mm5
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
326 pmaddwd mm0,mm7
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
327
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
328 pand_immq mm3, mmx32_rgb555_rb
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
329 pand mm4,mm6
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
330
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
331 movq [edi],mm1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
332 pmaddwd mm3,mm7
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
333
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
334 add esi,BYTE 32
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
335 por mm4,mm0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
336
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
337 pand mm5,mm6
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
338 psrld mm4,6
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
339
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
340 movq mm2,[esi+8]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
341 por mm5,mm3
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
342
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
343 movq mm0,[esi]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
344 psrld mm5,6
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
345
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
346 movq mm3,mm2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
347 movq mm1,mm0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
348
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
349 pand_immq mm3, mmx32_rgb555_rb
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
350 packssdw mm5,mm4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
351
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
352 pand_immq mm1, mmx32_rgb555_rb
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
353 pand mm2,mm6
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
354
1230
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
355 CLEANUP_IMMQ_LOADS(4)
88c2d6aed428 From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents: 1199
diff changeset
356
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
357 movq [edi+8],mm5
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
358 pmaddwd mm3,mm7
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
359
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
360 pmaddwd mm1,mm7
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
361 add edi,BYTE 16
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
362
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
363 sub ecx,BYTE 8
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
364 jz .L2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
365 jmp .L1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
366
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
367
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
368 .L2:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
369 mov ecx,edx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
370
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
371 and ecx,BYTE 7
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
372 jz .L4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
373
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
374 .L3:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
375 mov ebx,[esi]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
376 add esi,BYTE 4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
377
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
378 mov eax,ebx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
379 mov edx,ebx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
380
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
381 shr eax,3
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
382 shr edx,6
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
383
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
384 and eax,BYTE 0000000000011111b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
385 and edx, 0000001111100000b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
386
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
387 shr ebx,9
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
388
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
389 or eax,edx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
390
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
391 and ebx, 0111110000000000b
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
392
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
393 or eax,ebx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
394
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
395 mov [edi],ax
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
396 add edi,BYTE 2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
397
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
398 dec ecx
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
399 jnz .L3
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
400
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
401 .L4:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
402 jmp _mmxreturn
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
403
1199
2d6dc7de1145 From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents: 1166
diff changeset
404 %ifidn __OUTPUT_FORMAT__,elf
2d6dc7de1145 From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents: 1166
diff changeset
405 section .note.GNU-stack noalloc noexec nowrite progbits
2d6dc7de1145 From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents: 1166
diff changeset
406 %endif