diff options
author | Nick Kurshev <nickols_k@mail.ru> | 2002-01-20 14:48:02 +0000 |
---|---|---|
committer | Nick Kurshev <nickols_k@mail.ru> | 2002-01-20 14:48:02 +0000 |
commit | 1e98dffb7aa4b4681ecc7949e7ad58acc80ad86a (patch) | |
tree | eda5315707572d48e2f75e55cd210254068fea18 /libavcodec/alpha/asm.h | |
parent | 4bdd9157cc0b06c7001cb93e5cdd6304306253c4 (diff) | |
download | ffmpeg-1e98dffb7aa4b4681ecc7949e7ad58acc80ad86a.tar.gz |
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
Originally committed as revision 274 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/alpha/asm.h')
-rw-r--r-- | libavcodec/alpha/asm.h | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/libavcodec/alpha/asm.h b/libavcodec/alpha/asm.h new file mode 100644 index 0000000000..088497c24c --- /dev/null +++ b/libavcodec/alpha/asm.h @@ -0,0 +1,141 @@ +/* + * Alpha optimized DSP utils + * Copyright (c) 2002 Falk Hueffner <falk@debian.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef LIBAVCODEC_ALPHA_ASM_H +#define LIBAVCODEC_ALPHA_ASM_H + +#include <stdint.h> + +#define AMASK_BWX (1 << 0) +#define AMASK_FIX (1 << 1) +#define AMASK_MVI (1 << 8) + +static inline uint64_t BYTE_VEC(uint64_t x) +{ + x |= x << 8; + x |= x << 16; + x |= x << 32; + return x; +} +static inline uint64_t WORD_VEC(uint64_t x) +{ + x |= x << 16; + x |= x << 32; + return x; +} + +static inline int32_t ldl(const void* p) +{ + return *(const int32_t*) p; +} +static inline uint64_t ldq(const void* p) +{ + return *(const uint64_t*) p; +} +/* FIXME ccc doesn't seem to get it? Use inline asm? */ +static inline uint64_t ldq_u(const void* p) +{ + return *(const uint64_t*) ((uintptr_t) p & ~7ul); +} +static inline void stl(uint32_t l, void* p) +{ + *(uint32_t*) p = l; +} +static inline void stq(uint64_t l, void* p) +{ + *(uint64_t*) p = l; +} + +#ifdef __GNUC__ +#define OPCODE1(name) \ +static inline uint64_t name(uint64_t l) \ +{ \ + uint64_t r; \ + asm (#name " %1, %0" : "=r" (r) : "r" (l)); \ + return r; \ +} + +#define OPCODE2(name) \ +static inline uint64_t name(uint64_t l1, uint64_t l2) \ +{ \ + uint64_t r; \ + asm (#name " %1, %2, %0" : "=r" (r) : "r" (l1), "rI" (l2)); \ + return r; \ +} + +/* We don't want gcc to move this around or combine it with another + rpcc, so mark it volatile. */ +static inline uint64_t rpcc(void) +{ + uint64_t r; + asm volatile ("rpcc %0" : "=r" (r)); + return r; +} + +static inline uint64_t uldq(const void* v) +{ + struct foo { + unsigned long l; + } __attribute__((packed)); + + return ((const struct foo*) v)->l; +} + +#elif defined(__DECC) /* Compaq "ccc" compiler */ + +#include <c_asm.h> +#define OPCODE1(name) \ +static inline uint64_t name(uint64_t l) \ +{ \ + return asm (#name " %a0, %v0", l); \ +} + +#define OPCODE2(name) \ +static inline uint64_t name(uint64_t l1, uint64_t l2) \ +{ \ + return asm (#name " %a0, %a1, %v0", l1, l2); \ +} + +static inline uint64_t rpcc(void) +{ + return asm ("rpcc %v0"); +} + +static inline uint64_t uldq(const void* v) +{ + return *(const __unaligned uint64_t *) v; +} + +#endif + +OPCODE1(amask); +OPCODE1(unpkbw); +OPCODE1(pkwb); +OPCODE2(extql); +OPCODE2(extqh); +OPCODE2(zap); +OPCODE2(cmpbge); +OPCODE2(minsw4); +OPCODE2(minuw4); +OPCODE2(minub8); +OPCODE2(maxsw4); +OPCODE2(maxuw4); +OPCODE2(perr); + +#endif /* LIBAVCODEC_ALPHA_ASM_H */ |