| # MMX assist routines for peakval |
| # Copyright 2001 Phil Karn, KA9Q |
| # May be used under the terms of the GNU Lesser General Public License (LGPL) |
| # Find peak value in signed 16-bit input samples |
| # int peakval_mmx(signed short *in,int cnt); |
| .type peakval_mmx,@function |
| pxor %mm7,%mm7 # clear peak |
| psraw $15,%mm1 # mm1 = 1's if negative, 0's if positive |
| pxor %mm1,%mm0 # complement negatives |
| psubw %mm1,%mm0 # add 1 to negatives |
| movq %mm7,%mm6 # copy previous peak |
| pcmpgtw %mm0,%mm6 # ff == old peak greater |
| pand %mm6,%mm7 # select old peaks that are greater |
| pandn %mm0,%mm6 # select new values that are greater |