1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/liboil/src/fb/fbmmx.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,62 @@
1.4 +/*
1.5 + * Copyright © 2004 Red Hat, Inc.
1.6 + * Copyright © 2005 Trolltech AS
1.7 + *
1.8 + * Permission to use, copy, modify, distribute, and sell this software and its
1.9 + * documentation for any purpose is hereby granted without fee, provided that
1.10 + * the above copyright notice appear in all copies and that both that
1.11 + * copyright notice and this permission notice appear in supporting
1.12 + * documentation, and that the name of Red Hat not be used in advertising or
1.13 + * publicity pertaining to distribution of the software without specific,
1.14 + * written prior permission. Red Hat makes no representations about the
1.15 + * suitability of this software for any purpose. It is provided "as is"
1.16 + * without express or implied warranty.
1.17 + *
1.18 + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
1.19 + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
1.20 + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
1.21 + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1.22 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
1.23 + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
1.24 + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1.25 + * SOFTWARE.
1.26 + *
1.27 + * Author: Søren Sandmann (sandmann@redhat.com)
1.28 + * Lars Knoll (lars@trolltech.com)
1.29 + *
1.30 + * Based on work by Owen Taylor
1.31 + */
1.32 +
1.33 +
1.34 +#define MmxNegate(x) _mm_xor_si64((x), mmx_4x00ff)
1.35 +#define MmxAlpha(x) _mm_shuffle_pi16 ((x), _MM_SHUFFLE(3, 3, 3, 3));
1.36 +#define MmxTo(x) _mm_unpacklo_pi8 (_mm_cvtsi32_si64((x)), mmx_0)
1.37 +#define MmxFrom(x) (uint32_t)_mm_cvtsi64_si32(_mm_packs_pu16((x), mmx_0))
1.38 +#define MmxAdd(x, y) _mm_adds_pu16 ((x), (y))
1.39 +
1.40 +#define MmxMulAdd(x, a, y) do { \
1.41 + x = _mm_mullo_pi16 (x, a); \
1.42 + x = _mm_adds_pu16 (x, _mm_srli_pi16 (x, 8)); \
1.43 + x = _mm_adds_pu16 (x, mmx_4x0080); \
1.44 + x = _mm_srli_pi16 (x, 8); \
1.45 + x = _mm_adds_pu16(x, y); \
1.46 + } while (0)
1.47 +
1.48 +#define MmxMul(x, a) do { \
1.49 + x = _mm_mullo_pi16 (x, a); \
1.50 + x = _mm_adds_pu16 (x, _mm_srli_pi16 (x, 8)); \
1.51 + x = _mm_adds_pu16 (x, mmx_4x0080); \
1.52 + x = _mm_srli_pi16 (x, 8); \
1.53 + } while (0)
1.54 +
1.55 +#define MmxAddMul(x, a, y, b) do { \
1.56 + x = _mm_mullo_pi16 (x, a); \
1.57 + y = _mm_mullo_pi16 (y, b); \
1.58 + x = _mm_srli_pi16(x, 1); \
1.59 + y = _mm_srli_pi16(y, 1); \
1.60 + x = _mm_adds_pu16 (x, y); \
1.61 + x = _mm_adds_pu16 (x, _mm_srli_pi16 (x, 8)); \
1.62 + x = _mm_adds_pu16 (x, mmx_4x0080); \
1.63 + x = _mm_srli_pi16 (x, 7); \
1.64 + } while (0)
1.65 +