Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: Source/wtf/CPU.h

Issue 715753002: [WIP] support arm_neon_optional flag in blink. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/wtf/CPU.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 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
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 higher than ARMv7-A and supports Neon instructions.
160 // In OPTIONAL mode, this actually probes the CPU at runtime (and caches the res ult).
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 #define WTF_CPU_ARM_HAS_NEON() isSupportedNEON()
164 #define HAVE_ARM_NEON_INTRINSICS 1 171
172 // Use WTF_CPU_ARM_NEON_WRAP(symbol) to map 'symbol' to a NEON-specific symbol
173 // when applicable. This will transform 'symbol' differently depending on
174 // the current NEON configuration, i.e.:
175 //
176 // NONE -> 'symbol'
177 // WTF_CPU_ARM_NEON -> 'symbolNEON'
178 // WTF_CPU_ARM_NEON_OPTIONAL -> 'symbol' or 'symbolNEON' depending on runtime check.
179 #if CPU(ARM_NEON)
180 # define WTF_CPU_ARM_NEON_WRAP(x) (x ## NEON)
181 #elif CPU(ARM_NEON_OPTIONAL)
182 # define WTF_CPU_ARM_NEON_WRAP(x) (WTF_CPU_ARM_HAS_NEON() ? x ## NEON : x)
183 #else
184 # define WTF_CPU_ARM_NEON_WRAP(x) (x)
165 #endif 185 #endif
166 186
167 #if defined(__ARM_ARCH_7S__) 187 #if defined(__ARM_ARCH_7S__)
168 #define WTF_CPU_APPLE_ARMV7S 1 188 #define WTF_CPU_APPLE_ARMV7S 1
169 #endif 189 #endif
170 190
171 #if !defined(WTF_CPU_64BIT) 191 #if !defined(WTF_CPU_64BIT)
172 #define WTF_CPU_32BIT 1 192 #define WTF_CPU_32BIT 1
173 #endif 193 #endif
174 194
175 #endif /* ARM */ 195 #endif /* ARM */
176 196
177 /* CPU(ARM64) - AArch64 64-bit */ 197 /* CPU(ARM64) - AArch64 64-bit */
178 #if defined(__aarch64__) 198 #if defined(__aarch64__)
179 #define WTF_CPU_ARM64 1 199 #define WTF_CPU_ARM64 1
180 #define WTF_CPU_64BIT 1 200 #define WTF_CPU_64BIT 1
181 #endif 201 #endif
182 202
183 #endif /* WTF_CPU_h */ 203 #endif /* WTF_CPU_h */
OLDNEW
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/wtf/CPU.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698