annotate src/hermes/mmxp2_32.asm @ 3847:3d247fe1c234 SDL-1.2

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