Coverage Report

Created: 2023-09-25 06:56

/src/FreeRDP/libfreerdp/primitives/prim_add_opt.c
Line
Count
Source (jump to first uncovered line)
1
/* FreeRDP: A Remote Desktop Protocol Client
2
 * Optimized add operations.
3
 * vi:ts=4 sw=4:
4
 *
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.
14
 *
15
 */
16
17
#include <freerdp/config.h>
18
19
#include <freerdp/types.h>
20
#include <freerdp/primitives.h>
21
#include <winpr/sysinfo.h>
22
23
#ifdef WITH_SSE2
24
#include <emmintrin.h>
25
#include <pmmintrin.h>
26
#endif /* WITH_SSE2 */
27
28
#ifdef WITH_IPP
29
#include <ipps.h>
30
#endif /* WITH_IPP */
31
32
#include "prim_internal.h"
33
#include "prim_templates.h"
34
35
static primitives_t* generic = NULL;
36
37
#ifdef WITH_SSE2
38
#if !defined(WITH_IPP) || defined(ALL_PRIMITIVES_VERSIONS)
39
/* ------------------------------------------------------------------------- */
40
SSE3_SSD_ROUTINE(sse3_add_16s, INT16, generic->add_16s, _mm_adds_epi16,
41
                 generic->add_16s(sptr1++, sptr2++, dptr++, 1))
42
#endif /* !defined(WITH_IPP) || defined(ALL_PRIMITIVES_VERSIONS) */
43
#endif
44
45
/* ------------------------------------------------------------------------- */
46
void primitives_init_add_opt(primitives_t* WINPR_RESTRICT prims)
47
0
{
48
0
  generic = primitives_get_generic();
49
0
  primitives_init_add(prims);
50
#ifdef WITH_IPP
51
  prims->add_16s = (__add_16s_t)ippsAdd_16s;
52
#elif defined(WITH_SSE2)
53
54
0
  if (IsProcessorFeaturePresent(PF_SSE2_INSTRUCTIONS_AVAILABLE) &&
55
0
      IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE)) /* for LDDQU */
56
0
  {
57
0
    prims->add_16s = sse3_add_16s;
58
0
  }
59
60
0
#endif
61
0
}