OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 3 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
4 * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved. | 4 * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved. |
5 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 5 * Copyright (C) 2013-2014 Samsung Electronics. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
11 * notice, this list of conditions and the following disclaimer. | 11 * notice, this list of conditions and the following disclaimer. |
12 * 2. Redistributions in binary form must reproduce the above copyright | 12 * 2. Redistributions in binary form must reproduce the above copyright |
13 * notice, this list of conditions and the following disclaimer in the | 13 * notice, this list of conditions and the following disclaimer in the |
14 * documentation and/or other materials provided with the distribution. | 14 * documentation and/or other materials provided with the distribution. |
15 * | 15 * |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 # if defined(thumb2) || defined(__thumb2__) \ | 148 # if defined(thumb2) || defined(__thumb2__) \ |
149 || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4) | 149 || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4) |
150 # define WTF_CPU_ARM_THUMB2 1 | 150 # define WTF_CPU_ARM_THUMB2 1 |
151 # elif WTF_ARM_ARCH_AT_LEAST(4) | 151 # elif WTF_ARM_ARCH_AT_LEAST(4) |
152 # define WTF_CPU_ARM_THUMB2 0 | 152 # define WTF_CPU_ARM_THUMB2 0 |
153 # else | 153 # else |
154 # error "Unsupported ARM architecture" | 154 # error "Unsupported ARM architecture" |
155 # endif | 155 # endif |
156 #endif /* !defined(WTF_CPU_ARM_THUMB2) */ | 156 #endif /* !defined(WTF_CPU_ARM_THUMB2) */ |
157 | 157 |
158 #if defined(__ARM_NEON__) && !defined(WTF_CPU_ARM_NEON) | 158 // The isSupportedNEON() function returns true if the target device |
159 #define WTF_CPU_ARM_NEON 1 | 159 // is ARMv7-A and supports Neon instructions. In OPTIONAL mode, this actually |
| 160 // probes the CPU at runtime (and caches the result). |
| 161 #if CPU(ARM_NEON) |
| 162 static inline bool isSupportedNEON(void) { return true; } |
| 163 #elif CPU(ARM_NEON_OPTIONAL) |
| 164 extern bool isSupportedNEON(void) WTF_PURE_FUNCTION; |
| 165 #else |
| 166 static inline bool isSupportedNEON(void) { return false; } |
160 #endif | 167 #endif |
161 | 168 |
162 #if CPU(ARM_NEON) && (!COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 7, 0)) | 169 // Helper macro |
163 // All NEON intrinsics usage can be disabled by this macro. | 170 #if CPU(ARM) |
| 171 #define WTF_CPU_ARM_HAS_NEON() isSupportedNEON() |
| 172 #endif |
| 173 |
| 174 // Use WTF_CPU_ARM_NEON_WRAP(symbol) to map 'symbol' to a NEON-specific symbol |
| 175 // when applicable. This will transform 'symbol' differently depending on |
| 176 // the current NEON configuration, i.e.: |
| 177 // |
| 178 // NONE -> 'symbol' |
| 179 // WTF_CPU_ARM_NEON -> 'symbolNEON' |
| 180 // WTF_CPU_ARM_NEON_OPTIONAL -> 'symbol' or 'symbolNEON' depending on
runtime check. |
| 181 #if CPU(ARM_NEON) |
| 182 # define WTF_CPU_ARM_NEON_WRAP(x) (x ## NEON) |
| 183 #elif CPU(ARM_NEON_OPTIONAL) |
| 184 # define WTF_CPU_ARM_NEON_WRAP(x) (WTF_CPU_ARM_HAS_NEON() ? x ## NEON : x) |
| 185 #else |
| 186 # define WTF_CPU_ARM_NEON_WRAP(x) (x) |
| 187 #endif |
| 188 |
| 189 #if (CPU(ARM_NEON) || CPU(ARM_NEON_OPTIONAL)) && (!COMPILER(GCC) || GCC_VERSION_
AT_LEAST(4, 7, 0)) |
| 190 // All NEON intrinsics usage can be enabled by this macro. |
164 #define HAVE_ARM_NEON_INTRINSICS 1 | 191 #define HAVE_ARM_NEON_INTRINSICS 1 |
165 #endif | 192 #endif |
166 | 193 |
167 #if defined(__ARM_ARCH_7S__) | 194 #if defined(__ARM_ARCH_7S__) |
168 #define WTF_CPU_APPLE_ARMV7S 1 | 195 #define WTF_CPU_APPLE_ARMV7S 1 |
169 #endif | 196 #endif |
170 | 197 |
171 #if !defined(WTF_CPU_64BIT) | 198 #if !defined(WTF_CPU_64BIT) |
172 #define WTF_CPU_32BIT 1 | 199 #define WTF_CPU_32BIT 1 |
173 #endif | 200 #endif |
174 | 201 |
175 #endif /* ARM */ | 202 #endif /* ARM */ |
176 | 203 |
177 /* CPU(ARM64) - AArch64 64-bit */ | 204 /* CPU(ARM64) - AArch64 64-bit */ |
178 #if defined(__aarch64__) | 205 #if defined(__aarch64__) |
179 #define WTF_CPU_ARM64 1 | 206 #define WTF_CPU_ARM64 1 |
180 #define WTF_CPU_64BIT 1 | 207 #define WTF_CPU_64BIT 1 |
181 #endif | 208 #endif |
182 | 209 |
183 #endif /* WTF_CPU_h */ | 210 #endif /* WTF_CPU_h */ |
OLD | NEW |