jidctflt-3dn.asm 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. ;
  2. ; jidctflt.asm - floating-point IDCT (3DNow! & MMX)
  3. ;
  4. ; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
  5. ;
  6. ; Based on the x86 SIMD extension for IJG JPEG library
  7. ; Copyright (C) 1999-2006, MIYASAKA Masaru.
  8. ; For conditions of distribution and use, see copyright notice in jsimdext.inc
  9. ;
  10. ; This file should be assembled with NASM (Netwide Assembler),
  11. ; can *not* be assembled with Microsoft's MASM or any compatible
  12. ; assembler (including Borland's Turbo Assembler).
  13. ; NASM is available from http://nasm.sourceforge.net/ or
  14. ; http://sourceforge.net/project/showfiles.php?group_id=6208
  15. ;
  16. ; This file contains a floating-point implementation of the inverse DCT
  17. ; (Discrete Cosine Transform). The following code is based directly on
  18. ; the IJG's original jidctflt.c; see the jidctflt.c for more details.
  19. ;
  20. ; [TAB8]
  21. %include "jsimdext.inc"
  22. %include "jdct.inc"
  23. ; --------------------------------------------------------------------------
  24. SECTION SEG_CONST
  25. alignz 16
  26. global EXTN(jconst_idct_float_3dnow)
  27. EXTN(jconst_idct_float_3dnow):
  28. PD_1_414 times 2 dd 1.414213562373095048801689
  29. PD_1_847 times 2 dd 1.847759065022573512256366
  30. PD_1_082 times 2 dd 1.082392200292393968799446
  31. PD_2_613 times 2 dd 2.613125929752753055713286
  32. PD_RNDINT_MAGIC times 2 dd 100663296.0 ; (float)(0x00C00000 << 3)
  33. PB_CENTERJSAMP times 8 db CENTERJSAMPLE
  34. alignz 16
  35. ; --------------------------------------------------------------------------
  36. SECTION SEG_TEXT
  37. BITS 32
  38. ;
  39. ; Perform dequantization and inverse DCT on one block of coefficients.
  40. ;
  41. ; GLOBAL(void)
  42. ; jsimd_idct_float_3dnow (void *dct_table, JCOEFPTR coef_block,
  43. ; JSAMPARRAY output_buf, JDIMENSION output_col)
  44. ;
  45. %define dct_table(b) (b)+8 ; void *dct_table
  46. %define coef_block(b) (b)+12 ; JCOEFPTR coef_block
  47. %define output_buf(b) (b)+16 ; JSAMPARRAY output_buf
  48. %define output_col(b) (b)+20 ; JDIMENSION output_col
  49. %define original_ebp ebp+0
  50. %define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM]
  51. %define WK_NUM 2
  52. %define workspace wk(0)-DCTSIZE2*SIZEOF_FAST_FLOAT
  53. ; FAST_FLOAT workspace[DCTSIZE2]
  54. align 16
  55. global EXTN(jsimd_idct_float_3dnow)
  56. EXTN(jsimd_idct_float_3dnow):
  57. push ebp
  58. mov eax,esp ; eax = original ebp
  59. sub esp, byte 4
  60. and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits
  61. mov [esp],eax
  62. mov ebp,esp ; ebp = aligned ebp
  63. lea esp, [workspace]
  64. push ebx
  65. ; push ecx ; need not be preserved
  66. ; push edx ; need not be preserved
  67. push esi
  68. push edi
  69. get_GOT ebx ; get GOT address
  70. ; ---- Pass 1: process columns from input, store into work array.
  71. ; mov eax, [original_ebp]
  72. mov edx, POINTER [dct_table(eax)] ; quantptr
  73. mov esi, JCOEFPTR [coef_block(eax)] ; inptr
  74. lea edi, [workspace] ; FAST_FLOAT *wsptr
  75. mov ecx, DCTSIZE/2 ; ctr
  76. alignx 16,7
  77. .columnloop:
  78. %ifndef NO_ZERO_COLUMN_TEST_FLOAT_3DNOW
  79. mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)]
  80. or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)]
  81. jnz short .columnDCT
  82. pushpic ebx ; save GOT address
  83. mov ebx, DWORD [DWBLOCK(3,0,esi,SIZEOF_JCOEF)]
  84. mov eax, DWORD [DWBLOCK(4,0,esi,SIZEOF_JCOEF)]
  85. or ebx, DWORD [DWBLOCK(5,0,esi,SIZEOF_JCOEF)]
  86. or eax, DWORD [DWBLOCK(6,0,esi,SIZEOF_JCOEF)]
  87. or ebx, DWORD [DWBLOCK(7,0,esi,SIZEOF_JCOEF)]
  88. or eax,ebx
  89. poppic ebx ; restore GOT address
  90. jnz short .columnDCT
  91. ; -- AC terms all zero
  92. movd mm0, DWORD [DWBLOCK(0,0,esi,SIZEOF_JCOEF)]
  93. punpcklwd mm0,mm0
  94. psrad mm0,(DWORD_BIT-WORD_BIT)
  95. pi2fd mm0,mm0
  96. pfmul mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
  97. movq mm1,mm0
  98. punpckldq mm0,mm0
  99. punpckhdq mm1,mm1
  100. movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], mm0
  101. movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], mm0
  102. movq MMWORD [MMBLOCK(0,2,edi,SIZEOF_FAST_FLOAT)], mm0
  103. movq MMWORD [MMBLOCK(0,3,edi,SIZEOF_FAST_FLOAT)], mm0
  104. movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], mm1
  105. movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], mm1
  106. movq MMWORD [MMBLOCK(1,2,edi,SIZEOF_FAST_FLOAT)], mm1
  107. movq MMWORD [MMBLOCK(1,3,edi,SIZEOF_FAST_FLOAT)], mm1
  108. jmp near .nextcolumn
  109. alignx 16,7
  110. %endif
  111. .columnDCT:
  112. ; -- Even part
  113. movd mm0, DWORD [DWBLOCK(0,0,esi,SIZEOF_JCOEF)]
  114. movd mm1, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)]
  115. movd mm2, DWORD [DWBLOCK(4,0,esi,SIZEOF_JCOEF)]
  116. movd mm3, DWORD [DWBLOCK(6,0,esi,SIZEOF_JCOEF)]
  117. punpcklwd mm0,mm0
  118. punpcklwd mm1,mm1
  119. psrad mm0,(DWORD_BIT-WORD_BIT)
  120. psrad mm1,(DWORD_BIT-WORD_BIT)
  121. pi2fd mm0,mm0
  122. pi2fd mm1,mm1
  123. pfmul mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
  124. pfmul mm1, MMWORD [MMBLOCK(2,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
  125. punpcklwd mm2,mm2
  126. punpcklwd mm3,mm3
  127. psrad mm2,(DWORD_BIT-WORD_BIT)
  128. psrad mm3,(DWORD_BIT-WORD_BIT)
  129. pi2fd mm2,mm2
  130. pi2fd mm3,mm3
  131. pfmul mm2, MMWORD [MMBLOCK(4,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
  132. pfmul mm3, MMWORD [MMBLOCK(6,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
  133. movq mm4,mm0
  134. movq mm5,mm1
  135. pfsub mm0,mm2 ; mm0=tmp11
  136. pfsub mm1,mm3
  137. pfadd mm4,mm2 ; mm4=tmp10
  138. pfadd mm5,mm3 ; mm5=tmp13
  139. pfmul mm1,[GOTOFF(ebx,PD_1_414)]
  140. pfsub mm1,mm5 ; mm1=tmp12
  141. movq mm6,mm4
  142. movq mm7,mm0
  143. pfsub mm4,mm5 ; mm4=tmp3
  144. pfsub mm0,mm1 ; mm0=tmp2
  145. pfadd mm6,mm5 ; mm6=tmp0
  146. pfadd mm7,mm1 ; mm7=tmp1
  147. movq MMWORD [wk(1)], mm4 ; tmp3
  148. movq MMWORD [wk(0)], mm0 ; tmp2
  149. ; -- Odd part
  150. movd mm2, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)]
  151. movd mm3, DWORD [DWBLOCK(3,0,esi,SIZEOF_JCOEF)]
  152. movd mm5, DWORD [DWBLOCK(5,0,esi,SIZEOF_JCOEF)]
  153. movd mm1, DWORD [DWBLOCK(7,0,esi,SIZEOF_JCOEF)]
  154. punpcklwd mm2,mm2
  155. punpcklwd mm3,mm3
  156. psrad mm2,(DWORD_BIT-WORD_BIT)
  157. psrad mm3,(DWORD_BIT-WORD_BIT)
  158. pi2fd mm2,mm2
  159. pi2fd mm3,mm3
  160. pfmul mm2, MMWORD [MMBLOCK(1,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
  161. pfmul mm3, MMWORD [MMBLOCK(3,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
  162. punpcklwd mm5,mm5
  163. punpcklwd mm1,mm1
  164. psrad mm5,(DWORD_BIT-WORD_BIT)
  165. psrad mm1,(DWORD_BIT-WORD_BIT)
  166. pi2fd mm5,mm5
  167. pi2fd mm1,mm1
  168. pfmul mm5, MMWORD [MMBLOCK(5,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
  169. pfmul mm1, MMWORD [MMBLOCK(7,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
  170. movq mm4,mm2
  171. movq mm0,mm5
  172. pfadd mm2,mm1 ; mm2=z11
  173. pfadd mm5,mm3 ; mm5=z13
  174. pfsub mm4,mm1 ; mm4=z12
  175. pfsub mm0,mm3 ; mm0=z10
  176. movq mm1,mm2
  177. pfsub mm2,mm5
  178. pfadd mm1,mm5 ; mm1=tmp7
  179. pfmul mm2,[GOTOFF(ebx,PD_1_414)] ; mm2=tmp11
  180. movq mm3,mm0
  181. pfadd mm0,mm4
  182. pfmul mm0,[GOTOFF(ebx,PD_1_847)] ; mm0=z5
  183. pfmul mm3,[GOTOFF(ebx,PD_2_613)] ; mm3=(z10 * 2.613125930)
  184. pfmul mm4,[GOTOFF(ebx,PD_1_082)] ; mm4=(z12 * 1.082392200)
  185. pfsubr mm3,mm0 ; mm3=tmp12
  186. pfsub mm4,mm0 ; mm4=tmp10
  187. ; -- Final output stage
  188. pfsub mm3,mm1 ; mm3=tmp6
  189. movq mm5,mm6
  190. movq mm0,mm7
  191. pfadd mm6,mm1 ; mm6=data0=(00 01)
  192. pfadd mm7,mm3 ; mm7=data1=(10 11)
  193. pfsub mm5,mm1 ; mm5=data7=(70 71)
  194. pfsub mm0,mm3 ; mm0=data6=(60 61)
  195. pfsub mm2,mm3 ; mm2=tmp5
  196. movq mm1,mm6 ; transpose coefficients
  197. punpckldq mm6,mm7 ; mm6=(00 10)
  198. punpckhdq mm1,mm7 ; mm1=(01 11)
  199. movq mm3,mm0 ; transpose coefficients
  200. punpckldq mm0,mm5 ; mm0=(60 70)
  201. punpckhdq mm3,mm5 ; mm3=(61 71)
  202. movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], mm6
  203. movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], mm1
  204. movq MMWORD [MMBLOCK(0,3,edi,SIZEOF_FAST_FLOAT)], mm0
  205. movq MMWORD [MMBLOCK(1,3,edi,SIZEOF_FAST_FLOAT)], mm3
  206. movq mm7, MMWORD [wk(0)] ; mm7=tmp2
  207. movq mm5, MMWORD [wk(1)] ; mm5=tmp3
  208. pfadd mm4,mm2 ; mm4=tmp4
  209. movq mm6,mm7
  210. movq mm1,mm5
  211. pfadd mm7,mm2 ; mm7=data2=(20 21)
  212. pfadd mm5,mm4 ; mm5=data4=(40 41)
  213. pfsub mm6,mm2 ; mm6=data5=(50 51)
  214. pfsub mm1,mm4 ; mm1=data3=(30 31)
  215. movq mm0,mm7 ; transpose coefficients
  216. punpckldq mm7,mm1 ; mm7=(20 30)
  217. punpckhdq mm0,mm1 ; mm0=(21 31)
  218. movq mm3,mm5 ; transpose coefficients
  219. punpckldq mm5,mm6 ; mm5=(40 50)
  220. punpckhdq mm3,mm6 ; mm3=(41 51)
  221. movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], mm7
  222. movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], mm0
  223. movq MMWORD [MMBLOCK(0,2,edi,SIZEOF_FAST_FLOAT)], mm5
  224. movq MMWORD [MMBLOCK(1,2,edi,SIZEOF_FAST_FLOAT)], mm3
  225. .nextcolumn:
  226. add esi, byte 2*SIZEOF_JCOEF ; coef_block
  227. add edx, byte 2*SIZEOF_FLOAT_MULT_TYPE ; quantptr
  228. add edi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT ; wsptr
  229. dec ecx ; ctr
  230. jnz near .columnloop
  231. ; -- Prefetch the next coefficient block
  232. prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 0*32]
  233. prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 1*32]
  234. prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 2*32]
  235. prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 3*32]
  236. ; ---- Pass 2: process rows from work array, store into output array.
  237. mov eax, [original_ebp]
  238. lea esi, [workspace] ; FAST_FLOAT *wsptr
  239. mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *)
  240. mov eax, JDIMENSION [output_col(eax)]
  241. mov ecx, DCTSIZE/2 ; ctr
  242. alignx 16,7
  243. .rowloop:
  244. ; -- Even part
  245. movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)]
  246. movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_FAST_FLOAT)]
  247. movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_FAST_FLOAT)]
  248. movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_FAST_FLOAT)]
  249. movq mm4,mm0
  250. movq mm5,mm1
  251. pfsub mm0,mm2 ; mm0=tmp11
  252. pfsub mm1,mm3
  253. pfadd mm4,mm2 ; mm4=tmp10
  254. pfadd mm5,mm3 ; mm5=tmp13
  255. pfmul mm1,[GOTOFF(ebx,PD_1_414)]
  256. pfsub mm1,mm5 ; mm1=tmp12
  257. movq mm6,mm4
  258. movq mm7,mm0
  259. pfsub mm4,mm5 ; mm4=tmp3
  260. pfsub mm0,mm1 ; mm0=tmp2
  261. pfadd mm6,mm5 ; mm6=tmp0
  262. pfadd mm7,mm1 ; mm7=tmp1
  263. movq MMWORD [wk(1)], mm4 ; tmp3
  264. movq MMWORD [wk(0)], mm0 ; tmp2
  265. ; -- Odd part
  266. movq mm2, MMWORD [MMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)]
  267. movq mm3, MMWORD [MMBLOCK(3,0,esi,SIZEOF_FAST_FLOAT)]
  268. movq mm5, MMWORD [MMBLOCK(5,0,esi,SIZEOF_FAST_FLOAT)]
  269. movq mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_FAST_FLOAT)]
  270. movq mm4,mm2
  271. movq mm0,mm5
  272. pfadd mm2,mm1 ; mm2=z11
  273. pfadd mm5,mm3 ; mm5=z13
  274. pfsub mm4,mm1 ; mm4=z12
  275. pfsub mm0,mm3 ; mm0=z10
  276. movq mm1,mm2
  277. pfsub mm2,mm5
  278. pfadd mm1,mm5 ; mm1=tmp7
  279. pfmul mm2,[GOTOFF(ebx,PD_1_414)] ; mm2=tmp11
  280. movq mm3,mm0
  281. pfadd mm0,mm4
  282. pfmul mm0,[GOTOFF(ebx,PD_1_847)] ; mm0=z5
  283. pfmul mm3,[GOTOFF(ebx,PD_2_613)] ; mm3=(z10 * 2.613125930)
  284. pfmul mm4,[GOTOFF(ebx,PD_1_082)] ; mm4=(z12 * 1.082392200)
  285. pfsubr mm3,mm0 ; mm3=tmp12
  286. pfsub mm4,mm0 ; mm4=tmp10
  287. ; -- Final output stage
  288. pfsub mm3,mm1 ; mm3=tmp6
  289. movq mm5,mm6
  290. movq mm0,mm7
  291. pfadd mm6,mm1 ; mm6=data0=(00 10)
  292. pfadd mm7,mm3 ; mm7=data1=(01 11)
  293. pfsub mm5,mm1 ; mm5=data7=(07 17)
  294. pfsub mm0,mm3 ; mm0=data6=(06 16)
  295. pfsub mm2,mm3 ; mm2=tmp5
  296. movq mm1,[GOTOFF(ebx,PD_RNDINT_MAGIC)] ; mm1=[PD_RNDINT_MAGIC]
  297. pcmpeqd mm3,mm3
  298. psrld mm3,WORD_BIT ; mm3={0xFFFF 0x0000 0xFFFF 0x0000}
  299. pfadd mm6,mm1 ; mm6=roundint(data0/8)=(00 ** 10 **)
  300. pfadd mm7,mm1 ; mm7=roundint(data1/8)=(01 ** 11 **)
  301. pfadd mm0,mm1 ; mm0=roundint(data6/8)=(06 ** 16 **)
  302. pfadd mm5,mm1 ; mm5=roundint(data7/8)=(07 ** 17 **)
  303. pand mm6,mm3 ; mm6=(00 -- 10 --)
  304. pslld mm7,WORD_BIT ; mm7=(-- 01 -- 11)
  305. pand mm0,mm3 ; mm0=(06 -- 16 --)
  306. pslld mm5,WORD_BIT ; mm5=(-- 07 -- 17)
  307. por mm6,mm7 ; mm6=(00 01 10 11)
  308. por mm0,mm5 ; mm0=(06 07 16 17)
  309. movq mm1, MMWORD [wk(0)] ; mm1=tmp2
  310. movq mm3, MMWORD [wk(1)] ; mm3=tmp3
  311. pfadd mm4,mm2 ; mm4=tmp4
  312. movq mm7,mm1
  313. movq mm5,mm3
  314. pfadd mm1,mm2 ; mm1=data2=(02 12)
  315. pfadd mm3,mm4 ; mm3=data4=(04 14)
  316. pfsub mm7,mm2 ; mm7=data5=(05 15)
  317. pfsub mm5,mm4 ; mm5=data3=(03 13)
  318. movq mm2,[GOTOFF(ebx,PD_RNDINT_MAGIC)] ; mm2=[PD_RNDINT_MAGIC]
  319. pcmpeqd mm4,mm4
  320. psrld mm4,WORD_BIT ; mm4={0xFFFF 0x0000 0xFFFF 0x0000}
  321. pfadd mm3,mm2 ; mm3=roundint(data4/8)=(04 ** 14 **)
  322. pfadd mm7,mm2 ; mm7=roundint(data5/8)=(05 ** 15 **)
  323. pfadd mm1,mm2 ; mm1=roundint(data2/8)=(02 ** 12 **)
  324. pfadd mm5,mm2 ; mm5=roundint(data3/8)=(03 ** 13 **)
  325. pand mm3,mm4 ; mm3=(04 -- 14 --)
  326. pslld mm7,WORD_BIT ; mm7=(-- 05 -- 15)
  327. pand mm1,mm4 ; mm1=(02 -- 12 --)
  328. pslld mm5,WORD_BIT ; mm5=(-- 03 -- 13)
  329. por mm3,mm7 ; mm3=(04 05 14 15)
  330. por mm1,mm5 ; mm1=(02 03 12 13)
  331. movq mm2,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm2=[PB_CENTERJSAMP]
  332. packsswb mm6,mm3 ; mm6=(00 01 10 11 04 05 14 15)
  333. packsswb mm1,mm0 ; mm1=(02 03 12 13 06 07 16 17)
  334. paddb mm6,mm2
  335. paddb mm1,mm2
  336. movq mm4,mm6 ; transpose coefficients(phase 2)
  337. punpcklwd mm6,mm1 ; mm6=(00 01 02 03 10 11 12 13)
  338. punpckhwd mm4,mm1 ; mm4=(04 05 06 07 14 15 16 17)
  339. movq mm7,mm6 ; transpose coefficients(phase 3)
  340. punpckldq mm6,mm4 ; mm6=(00 01 02 03 04 05 06 07)
  341. punpckhdq mm7,mm4 ; mm7=(10 11 12 13 14 15 16 17)
  342. pushpic ebx ; save GOT address
  343. mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW]
  344. mov ebx, JSAMPROW [edi+1*SIZEOF_JSAMPROW]
  345. movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm6
  346. movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm7
  347. poppic ebx ; restore GOT address
  348. add esi, byte 2*SIZEOF_FAST_FLOAT ; wsptr
  349. add edi, byte 2*SIZEOF_JSAMPROW
  350. dec ecx ; ctr
  351. jnz near .rowloop
  352. femms ; empty MMX/3DNow! state
  353. pop edi
  354. pop esi
  355. ; pop edx ; need not be preserved
  356. ; pop ecx ; need not be preserved
  357. pop ebx
  358. mov esp,ebp ; esp <- aligned ebp
  359. pop esp ; esp <- original ebp
  360. pop ebp
  361. ret
  362. ; For some reason, the OS X linker does not honor the request to align the
  363. ; segment unless we do this.
  364. align 16