Mercurial > libavcodec.hg
comparison ppc/mathops.h @ 9596:182f35c8eaed libavcodec
PPC: implement MULH() in assembler
Left to its own devices, gcc calculates the full 64-bit product only to
discard the low 32 bits. This forces it to do the right thing.
20% faster MP3 decoding on G4.
| author | mru |
|---|---|
| date | Mon, 04 May 2009 17:31:15 +0000 |
| parents | 31bdc2da2e80 |
| children | 7c4ab94a82d8 |
comparison
equal
deleted
inserted
replaced
| 9595:f9a7147cc9e6 | 9596:182f35c8eaed |
|---|---|
| 35 ({ int __rt; \ | 35 ({ int __rt; \ |
| 36 __asm__ ("mullhw %0, %1, %2" : "=r" (__rt) : "r" (ra), "r" (rb)); \ | 36 __asm__ ("mullhw %0, %1, %2" : "=r" (__rt) : "r" (ra), "r" (rb)); \ |
| 37 __rt; }) | 37 __rt; }) |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 #define MULH MULH | |
| 41 static inline av_const int MULH(int a, int b){ | |
| 42 int r; | |
| 43 __asm__ ("mulhw %0, %1, %2" : "=r"(r) : "r"(a), "r"(b)); | |
| 44 return r; | |
| 45 } | |
| 46 | |
| 40 #endif /* AVCODEC_PPC_MATHOPS_H */ | 47 #endif /* AVCODEC_PPC_MATHOPS_H */ |
