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

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

Issue 2748083005: Move files in wtf/ to platform/wtf/ (Part 1). (Closed)
Patch Set: Created 3 years, 9 months 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 | « third_party/WebKit/Source/wtf/ByteSwap.h ('k') | third_party/WebKit/Source/wtf/Compiler.h » ('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 // Copyright 2017 The Chromium Authors. All rights reserved.
2 * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be
3 * Copyright (C) 2007-2009 Torch Mobile, Inc. 3 // found in the LICENSE file.
4 * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved.
5 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 4
29 #ifndef WTF_CPU_h 5 #include "platform/wtf/CPU.h"
30 #define WTF_CPU_h
31 6
32 #include "wtf/Compiler.h" 7 // The contents of this header was moved to platform/wtf as part of
33 8 // WTF migration project. See the following post for details:
34 /* CPU() - the target CPU architecture */ 9 // https://groups.google.com/a/chromium.org/d/msg/blink-dev/tLdAZCTlcAA/bYXVT8gY CAAJ
35 #define CPU(WTF_FEATURE) \
36 (defined WTF_CPU_##WTF_FEATURE && WTF_CPU_##WTF_FEATURE)
37
38 /* ==== CPU() - the target CPU architecture ==== */
39
40 /* This defines CPU(BIG_ENDIAN) or nothing, as appropriate. */
41 /* This defines CPU(32BIT) or CPU(64BIT), as appropriate. */
42
43 /* CPU(X86) - i386 / x86 32-bit */
44 #if defined(__i386__) || defined(i386) || defined(_M_IX86) || \
45 defined(_X86_) || defined(__THW_INTEL)
46 #define WTF_CPU_X86 1
47 #endif
48
49 /* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */
50 #if defined(__x86_64__) || defined(_M_X64)
51 #define WTF_CPU_X86_64 1
52 #define WTF_CPU_64BIT 1
53 #endif
54
55 /* CPU(ARM) - ARM, any version*/
56 #define WTF_ARM_ARCH_AT_LEAST(N) \
57 (CPU(ARM) && defined(WTF_ARM_ARCH_VERSION) && WTF_ARM_ARCH_VERSION >= N)
58
59 #if defined(arm) || defined(__arm__) || defined(ARM) || defined(_ARM_)
60 #define WTF_CPU_ARM 1
61
62 #if defined(__ARMEB__)
63 #define WTF_CPU_BIG_ENDIAN 1
64
65 #elif !defined(__ARM_EABI__) && !defined(__EABI__) && !defined(__VFP_FP__) && \
66 !defined(_WIN32_WCE) && !defined(ANDROID)
67 #define WTF_CPU_MIDDLE_ENDIAN 1
68
69 #endif
70
71 /* Set WTF_ARM_ARCH_VERSION */
72 #if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || \
73 defined(__MARM_ARMV4__)
74 #define WTF_ARM_ARCH_VERSION 4
75
76 #elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || \
77 defined(__MARM_ARMV5__)
78 #define WTF_ARM_ARCH_VERSION 5
79
80 #elif defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) || \
81 defined(__ARM_ARCH_5TEJ__)
82 #define WTF_ARM_ARCH_VERSION 5
83
84 #elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \
85 defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || \
86 defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) || \
87 defined(__ARMV6__)
88 #define WTF_ARM_ARCH_VERSION 6
89
90 #elif defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || \
91 defined(__ARM_ARCH_7S__)
92 #define WTF_ARM_ARCH_VERSION 7
93
94 /* MSVC sets _M_ARM */
95 #elif defined(_M_ARM)
96 #define WTF_ARM_ARCH_VERSION _M_ARM
97 #else
98 #define WTF_ARM_ARCH_VERSION 0
99
100 #endif
101
102 /* Set WTF_THUMB_ARCH_VERSION */
103 #if defined(__ARM_ARCH_4T__)
104 #define WTF_THUMB_ARCH_VERSION 1
105
106 #elif defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__) || \
107 defined(__ARM_ARCH_5TEJ__)
108 #define WTF_THUMB_ARCH_VERSION 2
109
110 #elif defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || \
111 defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || \
112 defined(__ARM_ARCH_6M__)
113 #define WTF_THUMB_ARCH_VERSION 3
114
115 #elif defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_7__) || \
116 defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7M__) || \
117 defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7S__)
118 #define WTF_THUMB_ARCH_VERSION 4
119
120 #else
121 #define WTF_THUMB_ARCH_VERSION 0
122 #endif
123
124 /* CPU(ARM_THUMB2) - Thumb2 instruction set is available */
125 #if !defined(WTF_CPU_ARM_THUMB2)
126 #if defined(thumb2) || defined(__thumb2__) || \
127 ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4)
128 #define WTF_CPU_ARM_THUMB2 1
129 #elif WTF_ARM_ARCH_AT_LEAST(4)
130 #define WTF_CPU_ARM_THUMB2 0
131 #else
132 #error "Unsupported ARM architecture"
133 #endif
134 #endif /* !defined(WTF_CPU_ARM_THUMB2) */
135
136 #if defined(__ARM_NEON__) && !defined(WTF_CPU_ARM_NEON)
137 #define WTF_CPU_ARM_NEON 1
138 #endif
139
140 #if CPU(ARM_NEON) && \
141 (COMPILER(CLANG) || !COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 7, 0))
142 // All NEON intrinsics usage can be disabled by this macro.
143 #define HAVE_ARM_NEON_INTRINSICS 1
144 #endif
145
146 #endif /* ARM */
147
148 /* CPU(ARM64) - AArch64 64-bit */
149 #if defined(__aarch64__)
150 #define WTF_CPU_ARM64 1
151 #define WTF_CPU_64BIT 1
152 #endif
153
154 /* CPU(MIPS), CPU(MIPS64) */
155 #if defined(__mips__) && (__mips == 64)
156 #define WTF_CPU_MIPS64 1
157 #define WTF_CPU_64BIT 1
158 #elif defined(__mips__)
159 #define WTF_CPU_MIPS 1
160 #endif
161
162 #if defined(__mips_msa) && defined(__mips_isa_rev) && (__mips_isa_rev >= 5)
163 // All MSA intrinsics usage can be disabled by this macro.
164 #define HAVE_MIPS_MSA_INTRINSICS 1
165 #endif
166
167 #if !defined(WTF_CPU_64BIT)
168 #define WTF_CPU_32BIT 1
169 #endif
170
171 #endif /* WTF_CPU_h */
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/ByteSwap.h ('k') | third_party/WebKit/Source/wtf/Compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698