Mercurial > sdl-ios-xcode
comparison src/audio/SDL_mixer_MMX_VC.c @ 1049:b4117292e587
Mixer: Visual C MMX asm code now aligns loops to 16 bytes.
This patch came from Stephane Marchesin's codefork, but I don't know who
wrote it originally.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sun, 17 Apr 2005 10:27:00 +0000 |
parents | 72ef7ce609ef |
children | ef03e8789d59 |
comparison
equal
deleted
inserted
replaced
1048:a78acdd4967e | 1049:b4117292e587 |
---|---|
17 | 17 |
18 void SDL_MixAudio_MMX_S16_VC(char* dst,char* src,unsigned int nSize,int volume) | 18 void SDL_MixAudio_MMX_S16_VC(char* dst,char* src,unsigned int nSize,int volume) |
19 { | 19 { |
20 __asm | 20 __asm |
21 { | 21 { |
22 align 16 | |
23 | 22 |
24 push edi | 23 push edi |
25 push esi | 24 push esi |
26 push ebx | 25 push ebx |
27 | 26 |
40 psllq mm0, 16 //$16,%%mm0 | 39 psllq mm0, 16 //$16,%%mm0 |
41 por mm0, mm1 //%%mm1,%%mm0 | 40 por mm0, mm1 //%%mm1,%%mm0 |
42 psllq mm0, 16 //$16,%%mm0 | 41 psllq mm0, 16 //$16,%%mm0 |
43 por mm0, mm1 //%%mm1,%%mm0 // mm0 = vol|vol|vol|vol | 42 por mm0, mm1 //%%mm1,%%mm0 // mm0 = vol|vol|vol|vol |
44 | 43 |
44 align 16 | |
45 mixloopS16: | 45 mixloopS16: |
46 movq mm1, [esi] //(%%esi),%%mm1\n" // mm1 = a|b|c|d | 46 movq mm1, [esi] //(%%esi),%%mm1\n" // mm1 = a|b|c|d |
47 movq mm2, mm1 //%%mm1,%%mm2\n" // mm2 = a|b|c|d | 47 movq mm2, mm1 //%%mm1,%%mm2\n" // mm2 = a|b|c|d |
48 movq mm4, [esi + 8] //8(%%esi),%%mm4\n" // mm4 = e|f|g|h | 48 movq mm4, [esi + 8] //8(%%esi),%%mm4\n" // mm4 = e|f|g|h |
49 // pre charger le buffer dst dans mm7 | 49 // pre charger le buffer dst dans mm7 |
96 | 96 |
97 void SDL_MixAudio_MMX_S8_VC(char* dst,char* src,unsigned int nSize,int volume) | 97 void SDL_MixAudio_MMX_S8_VC(char* dst,char* src,unsigned int nSize,int volume) |
98 { | 98 { |
99 _asm | 99 _asm |
100 { | 100 { |
101 align 16 | |
102 | 101 |
103 push edi | 102 push edi |
104 push esi | 103 push esi |
105 push ebx | 104 push ebx |
106 | 105 |
120 mov ebx, nSize //%2,%%ebx // ebx = size | 119 mov ebx, nSize //%2,%%ebx // ebx = size |
121 shr ebx, 3 //$3,%%ebx // process 8 bytes per iteration = 8 samples | 120 shr ebx, 3 //$3,%%ebx // process 8 bytes per iteration = 8 samples |
122 cmp ebx, 0 //$0,%%ebx | 121 cmp ebx, 0 //$0,%%ebx |
123 je endS8 | 122 je endS8 |
124 | 123 |
124 align 16 | |
125 mixloopS8: | 125 mixloopS8: |
126 pxor mm2, mm2 //%%mm2,%%mm2 // mm2 = 0 | 126 pxor mm2, mm2 //%%mm2,%%mm2 // mm2 = 0 |
127 movq mm1, [esi] //(%%esi),%%mm1 // mm1 = a|b|c|d|e|f|g|h | 127 movq mm1, [esi] //(%%esi),%%mm1 // mm1 = a|b|c|d|e|f|g|h |
128 movq mm3, mm1 //%%mm1,%%mm3 // mm3 = a|b|c|d|e|f|g|h | 128 movq mm3, mm1 //%%mm1,%%mm3 // mm3 = a|b|c|d|e|f|g|h |
129 // on va faire le "sign extension" en faisant un cmp avec 0 qui retourne 1 si <0, 0 si >0 | 129 // on va faire le "sign extension" en faisant un cmp avec 0 qui retourne 1 si <0, 0 si >0 |