• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavcodec/mips/mathops.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2009 Mans Rullgard <mans@mansr.com>
00003  *
00004  * This file is part of FFmpeg.
00005  *
00006  * FFmpeg is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * FFmpeg is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with FFmpeg; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 
00021 #ifndef AVCODEC_MIPS_MATHOPS_H
00022 #define AVCODEC_MIPS_MATHOPS_H
00023 
00024 #include <stdint.h>
00025 #include "config.h"
00026 #include "libavutil/common.h"
00027 
00028 #if HAVE_LOONGSON
00029 
00030 static inline av_const int64_t MAC64(int64_t d, int a, int b)
00031 {
00032     int64_t m;
00033     __asm__ ("dmult.g %1, %2, %3 \n\t"
00034              "daddu   %0, %0, %1 \n\t"
00035              : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
00036     return d;
00037 }
00038 #define MAC64(d, a, b) ((d) = MAC64(d, a, b))
00039 
00040 static inline av_const int64_t MLS64(int64_t d, int a, int b)
00041 {
00042     int64_t m;
00043     __asm__ ("dmult.g %1, %2, %3 \n\t"
00044              "dsubu   %0, %0, %1 \n\t"
00045              : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
00046     return d;
00047 }
00048 #define MLS64(d, a, b) ((d) = MLS64(d, a, b))
00049 
00050 #elif ARCH_MIPS64
00051 
00052 static inline av_const int64_t MAC64(int64_t d, int a, int b)
00053 {
00054     int64_t m;
00055     __asm__ ("dmult %2, %3     \n\t"
00056              "mflo  %1         \n\t"
00057              "daddu %0, %0, %1 \n\t"
00058              : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
00059     return d;
00060 }
00061 #define MAC64(d, a, b) ((d) = MAC64(d, a, b))
00062 
00063 static inline av_const int64_t MLS64(int64_t d, int a, int b)
00064 {
00065     int64_t m;
00066     __asm__ ("dmult %2, %3     \n\t"
00067              "mflo  %1         \n\t"
00068              "dsubu %0, %0, %1 \n\t"
00069              : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
00070     return d;
00071 }
00072 #define MLS64(d, a, b) ((d) = MLS64(d, a, b))
00073 
00074 #endif
00075 
00076 #endif /* AVCODEC_MIPS_MATHOPS_H */

Generated on Fri Sep 16 2011 17:17:34 for FFmpeg by  doxygen 1.7.1