Just FYI: clang 3.8.0 macros on arm comparison: with and without -march=armv7-a --mcpu=cortext-a7
Mark Millard
markmi at dsl-only.net
Thu Jun 30 08:03:50 UTC 2016
# clang -E -dM - < /dev/null | grep -i align
#define __BIGGEST_ALIGNMENT__ 8
# clang -munaligned-access -E -dM - < /dev/null | grep -i align
#define __ARM_FEATURE_UNALIGNED 1
#define __BIGGEST_ALIGNMENT__ 8
It appears that an explicit -munaligned-access is required to have __ARM_FEATURE_UNALIGNED defined.
Below I diff the following clang compiler outputs. . .
# clang -march=armv7-a -mcpu=cortex-a7 -E -dM - < /dev/null > ~/clang380_rpi2_macros_armv7-a_cortex-a7.txt
# clang -std=c11 -march=armv7-a -mcpu=cortex-a7 -E -dM - < /dev/null > ~/clang_c11_380_rpi2_macros_armv7-a_cortex-a7.txt
# clang -E -dM - < /dev/null > ~/clang380_rpi2_macros_default.txt
# clang -march=armv7-a -E -dM - < /dev/null > ~/clang380_rpi2_macros_armv7-a.txt
# clang -mcpu=cortex-a7 -E -dM - < /dev/null > ~/clang380_rpi2_macros_cortex-a7.txt
# clang -xc++ -std=c++14 -march=armv7-a -mcpu=cortex-a7 -E -dM - < /dev/null > ~/clang++14_380_rpi2_macros_armv7-a_cortex-a7.txt
# diff ~/clang380_rpi2_macros_armv7-a_cortex-a7.txt ~/clang380_rpi2_macros_default.txt
6,8c6,7
< #define __ARM_ARCH 7
< #define __ARM_ARCH_7A__ 1
< #define __ARM_ARCH_EXT_IDIV__ 1
---
> #define __ARM_ARCH 6
> #define __ARM_ARCH_6KZ__ 1
10,11c9
< #define __ARM_ARCH_ISA_THUMB 2
< #define __ARM_ARCH_PROFILE 'A'
---
> #define __ARM_ARCH_ISA_THUMB 1
15,17c13
< #define __ARM_FEATURE_FMA 1
< #define __ARM_FEATURE_IDIV 1
< #define __ARM_FEATURE_LDREX 0xF
---
> #define __ARM_FEATURE_LDREX 0x4
21c17
< #define __ARM_FP 0xE
---
> #define __ARM_FP 0xC
24,26d19
< #define __ARM_NEON 1
< #define __ARM_NEON_FP 0x6
< #define __ARM_NEON__ 1
31c24
< #define __ARM_VFPV4__ 1
---
> #define __ARM_VFPV2__ 1
# diff ~/clang380_rpi2_macros_armv7-a_cortex-a7.txt ~/clang_c11_380_rpi2_macros_armv7-a_cortex-a7.txt
224a225
> #define __STRICT_ANSI__ 1
336d336
< #define unix 1
# diff ~/clang380_rpi2_macros_armv7-a_cortex-a7.txt ~/clang380_arpi2_macros_armv7-a.txt
8d7
< #define __ARM_ARCH_EXT_IDIV__ 1
16d14
< #define __ARM_FEATURE_IDIV 1
21c19
< #define __ARM_FP 0xE
---
> #define __ARM_FP 0xC
25c23
< #define __ARM_NEON_FP 0x6
---
> #define __ARM_NEON_FP 0x4
31c29
< #define __ARM_VFPV4__ 1
---
> #define __ARM_VFPV3__ 1
# diff ~/clang380_rpi2_macros_armv7-a_cortex-a7.txt ~/clang380_rpi2_macros_cortex-a7.txt
(Yep: nothing different.)
# diff ~/clang380_rpi2_macros_armv7-a_cortex-a7.txt ~/clang++14_380_rpi2_macros_armv7-a_cortex-a7.txt
59a60
> #define __DEPRECATED 1
60a62
> #define __EXCEPTIONS 1
94a97
> #define __GNUC_GNU_INLINE__ 1
97d99
< #define __GNUC_STDC_INLINE__ 1
98a101
> #define __GNUG__ 4
99a103
> #define __GXX_EXPERIMENTAL_CXX0X__ 1
100a105
> #define __GXX_WEAK__ 1
223d227
< #define __STDC_VERSION__ 201112L
224a229
> #define __STRICT_ANSI__ 1
332a338,366
> #define __cplusplus 201402L
> #define __cpp_aggregate_nsdmi 201304
> #define __cpp_alias_templates 200704
> #define __cpp_attributes 200809
> #define __cpp_binary_literals 201304
> #define __cpp_constexpr 201304
> #define __cpp_decltype 200707
> #define __cpp_decltype_auto 201304
> #define __cpp_delegating_constructors 200604
> #define __cpp_digit_separators 201309
> #define __cpp_exceptions 199711
> #define __cpp_generic_lambdas 201304
> #define __cpp_inheriting_constructors 200802
> #define __cpp_init_captures 201304
> #define __cpp_initializer_lists 200806
> #define __cpp_lambdas 200907
> #define __cpp_nsdmi 200809
> #define __cpp_range_based_for 200907
> #define __cpp_raw_strings 200710
> #define __cpp_ref_qualifiers 200710
> #define __cpp_return_type_deduction 201304
> #define __cpp_rtti 199711
> #define __cpp_rvalue_references 200610
> #define __cpp_static_assert 200410
> #define __cpp_unicode_characters 200704
> #define __cpp_unicode_literals 200710
> #define __cpp_user_defined_literals 200809
> #define __cpp_variable_templates 201304
> #define __cpp_variadic_templates 200704
333a368
> #define __private_extern__ extern
336d370
< #define unix 1
Some other points of note:
#define __FreeBSD_cc_version 1100004
#define _ILP32 1
#define __ARM_SIZEOF_MINIMAL_ENUM 4
#define __ARM_SIZEOF_WCHAR_T 4
#define __BIGGEST_ALIGNMENT__ 8
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
#define __CHAR16_TYPE__ unsigned short
#define __CHAR32_TYPE__ unsigned int
#define __CHAR_BIT__ 8
#define __CHAR_UNSIGNED__ 1
===
Mark Millard
markmi at dsl-only.net
More information about the freebsd-arm
mailing list