1
/* FreeRDP: A Remote Desktop Protocol Client
5
* (c) Copyright 2012 Hewlett-Packard Development Company, L.P.
6
* Licensed under the Apache License, Version 2.0 (the "License"); you may
7
* not use this file except in compliance with the License. You may obtain
8
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12
* or implied. See the License for the specific language governing
13
* permissions and limitations under the License.
20
#include <freerdp/types.h>
21
#include <freerdp/primitives.h>
22
#include <winpr/sysinfo.h>
25
#include <emmintrin.h>
26
#include <pmmintrin.h>
27
#endif /* WITH_SSE2 */
33
#include "prim_internal.h"
34
#include "prim_templates.h"
35
#include "prim_shift.h"
39
# if !defined(WITH_IPP) || defined(ALL_PRIMITIVES_VERSIONS)
40
/* ------------------------------------------------------------------------- */
41
SSE3_SCD_ROUTINE(sse2_lShiftC_16s, INT16, general_lShiftC_16s,
42
_mm_slli_epi16, *dptr++ = *sptr++ << val)
43
/* ------------------------------------------------------------------------- */
44
SSE3_SCD_ROUTINE(sse2_rShiftC_16s, INT16, general_rShiftC_16s,
45
_mm_srai_epi16, *dptr++ = *sptr++ >> val)
46
/* ------------------------------------------------------------------------- */
47
SSE3_SCD_ROUTINE(sse2_lShiftC_16u, UINT16, general_lShiftC_16u,
48
_mm_slli_epi16, *dptr++ = *sptr++ << val)
49
/* ------------------------------------------------------------------------- */
50
SSE3_SCD_ROUTINE(sse2_rShiftC_16u, UINT16, general_rShiftC_16u,
51
_mm_srli_epi16, *dptr++ = *sptr++ >> val)
52
# endif /* !defined(WITH_IPP) || defined(ALL_PRIMITIVES_VERSIONS) */
56
/* Note: the IPP version will have to call ippLShiftC_16s or ippRShiftC_16s
57
* depending on the sign of val. To avoid using the deprecated inplace
58
* routines, a wrapper can use the src for the dest.
61
/* ------------------------------------------------------------------------- */
62
void primitives_init_shift_opt(primitives_t *prims)
65
prims->lShiftC_16s = (__lShiftC_16s_t) ippsLShiftC_16s;
66
prims->rShiftC_16s = (__rShiftC_16s_t) ippsRShiftC_16s;
67
prims->lShiftC_16u = (__lShiftC_16u_t) ippsLShiftC_16u;
68
prims->rShiftC_16u = (__rShiftC_16u_t) ippsRShiftC_16u;
69
#elif defined(WITH_SSE2)
70
if (IsProcessorFeaturePresent(PF_SSE2_INSTRUCTIONS_AVAILABLE)
71
&& IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE))
73
prims->lShiftC_16s = sse2_lShiftC_16s;
74
prims->rShiftC_16s = sse2_rShiftC_16s;
75
prims->lShiftC_16u = sse2_lShiftC_16u;
76
prims->rShiftC_16u = sse2_rShiftC_16u;