• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /***************************************************************************
2  Copyright (c) 2010, Code Aurora Forum. All rights reserved.
3  Copyright 2006-2010, The Android Open Source Project
4 
5  Licensed under the Apache License, Version 2.0 (the "License"); you
6  may not use this file except in compliance with the License.  You may
7  obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11  Unless required by applicable law or agreed to in writing, software
12  distributed under the License is distributed on an "AS IS" BASIS,
13  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14  implied.  See the License for the specific language governing
15  permissions and limitations under the License.
16  ***************************************************************************/
17 
18 /* Changes:
19  * 2011-04-01 ARM
20  *    Merged the functions from src/opts/opts_check_arm_neon.cpp
21  *    Modified to return ARM version of memset16 and memset32 if no neon
22  *    available in the core
23  */
24 
25 #include "SkUtils.h"
26 
27 extern "C" void memset16_neon(uint16_t dst[], uint16_t value, int count);
28 extern "C" void memset32_neon(uint32_t dst[], uint32_t value, int count);
29 
30 extern "C" void arm_memset16(uint16_t* dst, uint16_t value, int count);
31 extern "C" void arm_memset32(uint32_t* dst, uint32_t value, int count);
32 
hasNeonRegisters()33 static inline bool hasNeonRegisters() {
34 #if defined(__ARM_HAVE_NEON) && defined(SK_CPU_LENDIAN)
35     return true;
36 #else
37     return false;
38 #endif
39 }
40 
SkMemset16GetPlatformProc()41 SkMemset16Proc SkMemset16GetPlatformProc() {
42     if (hasNeonRegisters()) {
43         return memset16_neon;
44     } else {
45 #if defined(SK_CPU_LENDIAN)
46         return arm_memset16;
47 #else
48         return NULL;
49 #endif
50     }
51 }
52 
SkMemset32GetPlatformProc()53 SkMemset32Proc SkMemset32GetPlatformProc() {
54     if (hasNeonRegisters()) {
55         return memset32_neon;
56     } else {
57 #if defined(SK_CPU_LENDIAN)
58         return arm_memset32;
59 #else
60         return NULL;
61 #endif
62     }
63 }
64