Commit 7f429e62 authored by rmcilroy@chromium.org's avatar rmcilroy@chromium.org

[Arm]: Simplify compile-time Arm feature detection.

Simplify the compile time feature detection on Arm:
 - Define CAN_USE_XXX definitions unconditionally for all target/host
   toolchain combinations
 - Rename arm_test / ARM_TEST to arm_test_noprob / ARM_TEST_NO_FEATURE_PROBE
 - Don't set ARM_TEST_NO_FEATURE_PROBE implicitly on the simulator to make
   make simulator / native more consistent
 - Unify CpuFeatures::PrintTarget for simulator and native builds
 - Remove unecessary CAN_USE_VFP_INSTRUCTIONS definition for android (this is
   the default for arm_fpu=default)
 - Add a CpuFeatures::Probe() before calling CpuFeatures::PrintFeatures() in PrintHelp
    to ensure we have probed features before printing them.

BUG=384474
LOG=N
R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/340373002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21935 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a818a3e7
...@@ -191,15 +191,14 @@ ifeq ($(armthumb), on) ...@@ -191,15 +191,14 @@ ifeq ($(armthumb), on)
GYPFLAGS += -Darm_thumb=1 GYPFLAGS += -Darm_thumb=1
endif endif
endif endif
# armtest=on # arm_test_noprobe=on
# With this flag set, by default v8 will only use features implied # With this flag set, by default v8 will only use features implied
# by the compiler (no probe). This is done by modifying the default # by the compiler (no probe). This is done by modifying the default
# values of enable_armv7, enable_vfp3, enable_32dregs and enable_neon. # values of enable_armv7, enable_vfp3, enable_32dregs and enable_neon.
# Modifying these flags when launching v8 will enable the probing for # Modifying these flags when launching v8 will enable the probing for
# the specified values. # the specified values.
# When using the simulator, this flag is implied. ifeq ($(arm_test_noprobe), on)
ifeq ($(armtest), on) GYPFLAGS += -Darm_test_noprobe=on
GYPFLAGS += -Darm_test=on
endif endif
# ----------------- available targets: -------------------- # ----------------- available targets: --------------------
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
# these registers in the snapshot and use CPU feature probing when running # these registers in the snapshot and use CPU feature probing when running
# on the target. # on the target.
'v8_can_use_vfp32dregs%': 'false', 'v8_can_use_vfp32dregs%': 'false',
'arm_test%': 'off', 'arm_test_noprobe%': 'off',
# Similar to vfp but on MIPS. # Similar to vfp but on MIPS.
'v8_can_use_fpu_instructions%': 'true', 'v8_can_use_fpu_instructions%': 'true',
...@@ -89,6 +89,36 @@ ...@@ -89,6 +89,36 @@
'defines': [ 'defines': [
'V8_TARGET_ARCH_ARM', 'V8_TARGET_ARCH_ARM',
], ],
'conditions': [
[ 'arm_version==7 or arm_version=="default"', {
'defines': [
'CAN_USE_ARMV7_INSTRUCTIONS',
],
}],
[ 'arm_fpu=="vfpv3-d16" or arm_fpu=="default"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
],
}],
[ 'arm_fpu=="vfpv3"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
'CAN_USE_VFP32DREGS',
],
}],
[ 'arm_fpu=="neon"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
'CAN_USE_VFP32DREGS',
'CAN_USE_NEON',
],
}],
[ 'arm_test_noprobe=="on"', {
'defines': [
'ARM_TEST_NO_FEATURE_PROBE',
],
}],
],
'target_conditions': [ 'target_conditions': [
['_toolset=="host"', { ['_toolset=="host"', {
'variables': { 'variables': {
...@@ -116,45 +146,10 @@ ...@@ -116,45 +146,10 @@
[ 'arm_thumb==0', { [ 'arm_thumb==0', {
'cflags': ['-marm',], 'cflags': ['-marm',],
}], }],
[ 'arm_test=="on"', {
'defines': [
'ARM_TEST',
],
}],
], ],
}, { }, {
# armcompiler=="no" # armcompiler=="no"
'conditions': [ 'conditions': [
[ 'arm_version==7 or arm_version=="default"', {
'defines': [
'CAN_USE_ARMV7_INSTRUCTIONS=1',
],
'conditions': [
[ 'arm_fpu=="default"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
],
}],
[ 'arm_fpu=="vfpv3-d16"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
],
}],
[ 'arm_fpu=="vfpv3"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
'CAN_USE_VFP32DREGS',
],
}],
[ 'arm_fpu=="neon"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
'CAN_USE_VFP32DREGS',
'CAN_USE_NEON',
],
}],
],
}],
[ 'arm_float_abi=="hard"', { [ 'arm_float_abi=="hard"', {
'defines': [ 'defines': [
'USE_EABI_HARDFLOAT=1', 'USE_EABI_HARDFLOAT=1',
...@@ -166,9 +161,6 @@ ...@@ -166,9 +161,6 @@
], ],
}], }],
], ],
'defines': [
'ARM_TEST',
],
}], }],
], ],
}], # _toolset=="host" }], # _toolset=="host"
...@@ -198,67 +190,10 @@ ...@@ -198,67 +190,10 @@
[ 'arm_thumb==0', { [ 'arm_thumb==0', {
'cflags': ['-marm',], 'cflags': ['-marm',],
}], }],
[ 'arm_test=="on"', {
'defines': [
'ARM_TEST',
],
'conditions': [
[ 'arm_fpu=="vfpv3-d16"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
],
}],
[ 'arm_fpu=="vfpv3"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
'CAN_USE_VFP32DREGS',
],
}],
[ 'arm_fpu=="neon"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
'CAN_USE_VFP32DREGS',
'CAN_USE_NEON',
],
}],
],
}],
], ],
}, { }, {
# armcompiler=="no" # armcompiler=="no"
'conditions': [ 'conditions': [
[ 'arm_version==7 or arm_version=="default"', {
'defines': [
'CAN_USE_ARMV7_INSTRUCTIONS=1',
],
'conditions': [
[ 'arm_fpu=="default"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
'CAN_USE_VFP32DREGS',
'CAN_USE_NEON',
],
}],
[ 'arm_fpu=="vfpv3-d16"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
],
}],
[ 'arm_fpu=="vfpv3"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
'CAN_USE_VFP32DREGS',
],
}],
[ 'arm_fpu=="neon"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
'CAN_USE_VFP32DREGS',
'CAN_USE_NEON',
],
}],
],
}],
[ 'arm_float_abi=="hard"', { [ 'arm_float_abi=="hard"', {
'defines': [ 'defines': [
'USE_EABI_HARDFLOAT=1', 'USE_EABI_HARDFLOAT=1',
...@@ -270,9 +205,6 @@ ...@@ -270,9 +205,6 @@
], ],
}], }],
], ],
'defines': [
'ARM_TEST',
],
}], }],
], ],
}], # _toolset=="target" }], # _toolset=="target"
......
...@@ -129,56 +129,53 @@ void CpuFeatures::ProbeImpl(bool cross_compile) { ...@@ -129,56 +129,53 @@ void CpuFeatures::ProbeImpl(bool cross_compile) {
void CpuFeatures::PrintTarget() { void CpuFeatures::PrintTarget() {
const char* arm_arch = NULL; const char* arm_arch = NULL;
const char* arm_test = ""; const char* arm_target_type = "";
const char* arm_no_probe = "";
const char* arm_fpu = ""; const char* arm_fpu = "";
const char* arm_thumb = ""; const char* arm_thumb = "";
const char* arm_float_abi = NULL; const char* arm_float_abi = NULL;
#if !defined __arm__
arm_target_type = " simulator";
#endif
#if defined ARM_TEST_NO_FEATURE_PROBE
arm_no_probe = " noprobe";
#endif
#if defined CAN_USE_ARMV7_INSTRUCTIONS #if defined CAN_USE_ARMV7_INSTRUCTIONS
arm_arch = "arm v7"; arm_arch = "arm v7";
#else #else
arm_arch = "arm v6"; arm_arch = "arm v6";
#endif #endif
#ifdef __arm__ #if defined CAN_USE_NEON
# ifdef ARM_TEST
arm_test = " test";
# endif
# if defined __ARM_NEON__
arm_fpu = " neon"; arm_fpu = " neon";
# elif defined CAN_USE_VFP3_INSTRUCTIONS #elif defined CAN_USE_VFP3_INSTRUCTIONS
arm_fpu = " vfp3";
# else
arm_fpu = " vfp2";
# endif
# if (defined __thumb__) || (defined __thumb2__)
arm_thumb = " thumb";
# endif
arm_float_abi = OS::ArmUsingHardFloat() ? "hard" : "softfp";
#else // __arm__
arm_test = " simulator";
# if defined CAN_USE_VFP3_INSTRUCTIONS
# if defined CAN_USE_VFP32DREGS # if defined CAN_USE_VFP32DREGS
arm_fpu = " vfp3"; arm_fpu = " vfp3";
# else # else
arm_fpu = " vfp3-d16"; arm_fpu = " vfp3-d16";
# endif # endif
# else #else
arm_fpu = " vfp2"; arm_fpu = " vfp2";
# endif #endif
# if USE_EABI_HARDFLOAT == 1
#ifdef __arm__
arm_float_abi = OS::ArmUsingHardFloat() ? "hard" : "softfp";
#elif USE_EABI_HARDFLOAT
arm_float_abi = "hard"; arm_float_abi = "hard";
# else #else
arm_float_abi = "softfp"; arm_float_abi = "softfp";
# endif #endif
#endif // __arm__ #if defined __arm__ && (defined __thumb__) || (defined __thumb2__)
arm_thumb = " thumb";
#endif
printf("target%s %s%s%s %s\n", printf("target%s%s %s%s%s %s\n",
arm_test, arm_arch, arm_fpu, arm_thumb, arm_float_abi); arm_target_type, arm_no_probe, arm_arch, arm_fpu, arm_thumb,
arm_float_abi);
} }
......
...@@ -105,22 +105,22 @@ struct MaybeBoolFlag { ...@@ -105,22 +105,22 @@ struct MaybeBoolFlag {
}; };
#endif #endif
#if (defined CAN_USE_VFP3_INSTRUCTIONS) || !(defined ARM_TEST) #if (defined CAN_USE_VFP3_INSTRUCTIONS) || !(defined ARM_TEST_NO_FEATURE_PROBE)
# define ENABLE_VFP3_DEFAULT true # define ENABLE_VFP3_DEFAULT true
#else #else
# define ENABLE_VFP3_DEFAULT false # define ENABLE_VFP3_DEFAULT false
#endif #endif
#if (defined CAN_USE_ARMV7_INSTRUCTIONS) || !(defined ARM_TEST) #if (defined CAN_USE_ARMV7_INSTRUCTIONS) || !(defined ARM_TEST_NO_FEATURE_PROBE)
# define ENABLE_ARMV7_DEFAULT true # define ENABLE_ARMV7_DEFAULT true
#else #else
# define ENABLE_ARMV7_DEFAULT false # define ENABLE_ARMV7_DEFAULT false
#endif #endif
#if (defined CAN_USE_VFP32DREGS) || !(defined ARM_TEST) #if (defined CAN_USE_VFP32DREGS) || !(defined ARM_TEST_NO_FEATURE_PROBE)
# define ENABLE_32DREGS_DEFAULT true # define ENABLE_32DREGS_DEFAULT true
#else #else
# define ENABLE_32DREGS_DEFAULT false # define ENABLE_32DREGS_DEFAULT false
#endif #endif
#if (defined CAN_USE_NEON) || !(defined ARM_TEST) #if (defined CAN_USE_NEON) || !(defined ARM_TEST_NO_FEATURE_PROBE)
# define ENABLE_NEON_DEFAULT true # define ENABLE_NEON_DEFAULT true
#else #else
# define ENABLE_NEON_DEFAULT false # define ENABLE_NEON_DEFAULT false
......
...@@ -517,6 +517,7 @@ void FlagList::ResetAllFlags() { ...@@ -517,6 +517,7 @@ void FlagList::ResetAllFlags() {
// static // static
void FlagList::PrintHelp() { void FlagList::PrintHelp() {
CpuFeatures::Probe(false);
CpuFeatures::PrintTarget(); CpuFeatures::PrintTarget();
CpuFeatures::PrintFeatures(); CpuFeatures::PrintFeatures();
......
...@@ -837,9 +837,6 @@ ...@@ -837,9 +837,6 @@
} }
], ],
['OS=="android"', { ['OS=="android"', {
'defines': [
'CAN_USE_VFP_INSTRUCTIONS',
],
'sources': [ 'sources': [
'../../src/platform-posix.cc' '../../src/platform-posix.cc'
], ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment