annotate src/hermes/mmxp2_32.asm @ 2134:180fa05e98e2

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