1 /* Copyright (C) 2012-2013 Free Software Foundation, Inc.
2    Contributed by Richard Henderson <rth@redhat.com>.
3 
4    This file is part of the GNU Atomic Library (libatomic).
5 
6    Libatomic is free software; you can redistribute it and/or modify it
7    under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10 
11    Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY
12    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14    more details.
15 
16    Under Section 7 of GPL version 3, you are granted additional
17    permissions described in the GCC Runtime Library Exception, version
18    3.1, as published by the Free Software Foundation.
19 
20    You should have received a copy of the GNU General Public License and
21    a copy of the GCC Runtime Library Exception along with this program;
22    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23    <http://www.gnu.org/licenses/>.  */
24 
25 
26 #if defined(__ARM_ARCH_2__)
27 # define __ARM_ARCH__ 2
28 #endif
29 
30 #if defined(__ARM_ARCH_3__)
31 # define __ARM_ARCH__ 3
32 #endif
33 
34 #if defined(__ARM_ARCH_3M__) || defined(__ARM_ARCH_4__) \
35 	|| defined(__ARM_ARCH_4T__)
36 /* We use __ARM_ARCH__ set to 4 here, but in reality it's any processor with
37    long multiply instructions.  That includes v3M.  */
38 # define __ARM_ARCH__ 4
39 #endif
40 
41 #if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
42 	|| defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
43 	|| defined(__ARM_ARCH_5TEJ__)
44 # define __ARM_ARCH__ 5
45 #endif
46 
47 #if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
48 	|| defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
49 	|| defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \
50 	|| defined(__ARM_ARCH_6M__)
51 # define __ARM_ARCH__ 6
52 #endif
53 
54 #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
55 	|| defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
56 	|| defined(__ARM_ARCH_7EM__)
57 # define __ARM_ARCH__ 7
58 #endif
59 
60 #if defined(__ARM_ARCH_8A__)
61 # define __ARM_ARCH__ 8
62 #endif
63 
64 #ifndef __ARM_ARCH__
65 #error Unable to determine architecture.
66 #endif
67 
68 #if __ARM_ARCH__ >= 7 || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6ZK__)
69 # define HAVE_STREX	1
70 # define HAVE_STREXBHD	1
71 #elif __ARM_ARCH__ == 6
72 # define HAVE_STREX	1
73 #endif
74 
75 #if __ARM_ARCH__ >= 7
76 # define HAVE_DMB	1
77 #elif __ARM_ARCH__ == 6
78 # define HAVE_DMB_MCR	1
79 #endif
80