| 1 |
709 |
jeremybenn |
/* Intrinsics for TI C6X.
|
| 2 |
|
|
|
| 3 |
|
|
Copyright (C) 2011 Free Software Foundation, Inc.
|
| 4 |
|
|
Contributed by CodeSourcery.
|
| 5 |
|
|
|
| 6 |
|
|
This file is part of GCC.
|
| 7 |
|
|
|
| 8 |
|
|
GCC is free software; you can redistribute it and/or modify it
|
| 9 |
|
|
under the terms of the GNU General Public License as published
|
| 10 |
|
|
by the Free Software Foundation; either version 3, or (at your
|
| 11 |
|
|
option) any later version.
|
| 12 |
|
|
|
| 13 |
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT
|
| 14 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
| 15 |
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
| 16 |
|
|
License for more details.
|
| 17 |
|
|
|
| 18 |
|
|
Under Section 7 of GPL version 3, you are granted additional
|
| 19 |
|
|
permissions described in the GCC Runtime Library Exception, version
|
| 20 |
|
|
3.1, as published by the Free Software Foundation.
|
| 21 |
|
|
|
| 22 |
|
|
You should have received a copy of the GNU General Public License and
|
| 23 |
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
| 24 |
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
| 25 |
|
|
<http://www.gnu.org/licenses/>. */
|
| 26 |
|
|
|
| 27 |
|
|
#ifndef _GCC_C6X_INTRINSICS_H
|
| 28 |
|
|
#define _GCC_C6X_INTRINSICS_H
|
| 29 |
|
|
|
| 30 |
|
|
#if !defined(__TMS320C6X__)
|
| 31 |
|
|
# error "c6x_intrinsics.h is only supported for C6X targets"
|
| 32 |
|
|
#endif
|
| 33 |
|
|
|
| 34 |
|
|
#ifdef __cplusplus
|
| 35 |
|
|
extern "C" {
|
| 36 |
|
|
#endif
|
| 37 |
|
|
|
| 38 |
|
|
#include <stdint.h>
|
| 39 |
|
|
|
| 40 |
|
|
/* Define vector types. */
|
| 41 |
|
|
typedef uint8_t __uv4qi __attribute__((vector_size (4)));
|
| 42 |
|
|
typedef int16_t __v2hi __attribute__((vector_size (4)));
|
| 43 |
|
|
typedef int32_t __v2si __attribute__((vector_size (8)));
|
| 44 |
|
|
|
| 45 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 46 |
|
|
_abs (int src)
|
| 47 |
|
|
{
|
| 48 |
|
|
return __builtin_c6x_abs (src);
|
| 49 |
|
|
}
|
| 50 |
|
|
|
| 51 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 52 |
|
|
_abs2 (int src)
|
| 53 |
|
|
{
|
| 54 |
|
|
return (int)__builtin_c6x_abs2 ((__v2hi)src);
|
| 55 |
|
|
}
|
| 56 |
|
|
|
| 57 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 58 |
|
|
_sadd (int src1, int src2)
|
| 59 |
|
|
{
|
| 60 |
|
|
return __builtin_c6x_sadd (src1, src2);
|
| 61 |
|
|
}
|
| 62 |
|
|
|
| 63 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 64 |
|
|
_ssub (int src1, int src2)
|
| 65 |
|
|
{
|
| 66 |
|
|
return __builtin_c6x_ssub (src1, src2);
|
| 67 |
|
|
}
|
| 68 |
|
|
|
| 69 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 70 |
|
|
_add2 (int src1, int src2)
|
| 71 |
|
|
{
|
| 72 |
|
|
return (int)__builtin_c6x_add2 ((__v2hi)src1, (__v2hi)src2);
|
| 73 |
|
|
}
|
| 74 |
|
|
|
| 75 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 76 |
|
|
_sub2 (int src1, int src2)
|
| 77 |
|
|
{
|
| 78 |
|
|
return (int)__builtin_c6x_sub2 ((__v2hi)src1, (__v2hi)src2);
|
| 79 |
|
|
}
|
| 80 |
|
|
|
| 81 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 82 |
|
|
_add4 (int src1, int src2)
|
| 83 |
|
|
{
|
| 84 |
|
|
return (int)__builtin_c6x_add4 ((__uv4qi)src1, (__uv4qi)src2);
|
| 85 |
|
|
}
|
| 86 |
|
|
|
| 87 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 88 |
|
|
_sub4 (int src1, int src2)
|
| 89 |
|
|
{
|
| 90 |
|
|
return (int)__builtin_c6x_sub4 ((__uv4qi)src1, (__uv4qi)src2);
|
| 91 |
|
|
}
|
| 92 |
|
|
|
| 93 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 94 |
|
|
_sadd2 (int src1, int src2)
|
| 95 |
|
|
{
|
| 96 |
|
|
return (int)__builtin_c6x_sadd2 ((__v2hi)src1, (__v2hi)src2);
|
| 97 |
|
|
}
|
| 98 |
|
|
|
| 99 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 100 |
|
|
_ssub2 (int src1, int src2)
|
| 101 |
|
|
{
|
| 102 |
|
|
return (int)__builtin_c6x_ssub2 ((__v2hi)src1, (__v2hi)src2);
|
| 103 |
|
|
}
|
| 104 |
|
|
|
| 105 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 106 |
|
|
_saddu4 (int src1, int src2)
|
| 107 |
|
|
{
|
| 108 |
|
|
return (int)__builtin_c6x_saddu4 ((__uv4qi)src1, (__uv4qi)src2);
|
| 109 |
|
|
}
|
| 110 |
|
|
|
| 111 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 112 |
|
|
_smpy (int src1, int src2)
|
| 113 |
|
|
{
|
| 114 |
|
|
return __builtin_c6x_smpy (src1, src2);
|
| 115 |
|
|
}
|
| 116 |
|
|
|
| 117 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 118 |
|
|
_smpylh (int src1, int src2)
|
| 119 |
|
|
{
|
| 120 |
|
|
return __builtin_c6x_smpylh (src1, src2);
|
| 121 |
|
|
}
|
| 122 |
|
|
|
| 123 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 124 |
|
|
_smpyhl (int src1, int src2)
|
| 125 |
|
|
{
|
| 126 |
|
|
return __builtin_c6x_smpyhl (src1, src2);
|
| 127 |
|
|
}
|
| 128 |
|
|
|
| 129 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 130 |
|
|
_smpyh (int src1, int src2)
|
| 131 |
|
|
{
|
| 132 |
|
|
return __builtin_c6x_smpyh (src1, src2);
|
| 133 |
|
|
}
|
| 134 |
|
|
|
| 135 |
|
|
__extension__ static __inline long long __attribute__ ((__always_inline__))
|
| 136 |
|
|
_smpy2ll (int src1, int src2)
|
| 137 |
|
|
{
|
| 138 |
|
|
return (long long)__builtin_c6x_smpy2 ((__v2hi)src1, (__v2hi)src2);
|
| 139 |
|
|
}
|
| 140 |
|
|
|
| 141 |
|
|
__extension__ static __inline long long __attribute__ ((__always_inline__))
|
| 142 |
|
|
_mpy2ll (int src1, int src2)
|
| 143 |
|
|
{
|
| 144 |
|
|
return (long long)__builtin_c6x_mpy2 ((__v2hi)src1, (__v2hi)src2);
|
| 145 |
|
|
}
|
| 146 |
|
|
|
| 147 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 148 |
|
|
_extr (int src1, int src2)
|
| 149 |
|
|
{
|
| 150 |
|
|
return __builtin_c6x_extr (src1, src2);
|
| 151 |
|
|
}
|
| 152 |
|
|
|
| 153 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 154 |
|
|
_extru (int src1, int src2)
|
| 155 |
|
|
{
|
| 156 |
|
|
return __builtin_c6x_extru (src1, src2);
|
| 157 |
|
|
}
|
| 158 |
|
|
|
| 159 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 160 |
|
|
_clrr (int src1, int src2)
|
| 161 |
|
|
{
|
| 162 |
|
|
return __builtin_c6x_clrr (src1, src2);
|
| 163 |
|
|
}
|
| 164 |
|
|
|
| 165 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 166 |
|
|
_avg2 (int src1, int src2)
|
| 167 |
|
|
{
|
| 168 |
|
|
return (int)__builtin_c6x_avg2 ((__v2hi)src1, (__v2hi)src2);
|
| 169 |
|
|
}
|
| 170 |
|
|
|
| 171 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 172 |
|
|
_avgu4 (int src1, int src2)
|
| 173 |
|
|
{
|
| 174 |
|
|
return (int)__builtin_c6x_avgu4 ((__uv4qi)src1, (__uv4qi)src2);
|
| 175 |
|
|
}
|
| 176 |
|
|
|
| 177 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 178 |
|
|
_sshl (int src1, int src2)
|
| 179 |
|
|
{
|
| 180 |
|
|
return __builtin_c6x_sshl (src1, src2);
|
| 181 |
|
|
}
|
| 182 |
|
|
|
| 183 |
|
|
__extension__ static __inline int __attribute__ ((__always_inline__))
|
| 184 |
|
|
_subc (int src1, int src2)
|
| 185 |
|
|
{
|
| 186 |
|
|
return __builtin_c6x_subc (src1, src2);
|
| 187 |
|
|
}
|
| 188 |
|
|
|
| 189 |
|
|
|
| 190 |
|
|
#ifdef __cplusplus
|
| 191 |
|
|
}
|
| 192 |
|
|
#endif
|
| 193 |
|
|
|
| 194 |
|
|
#endif
|