| OLD | NEW |
| 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 2 // All Rights Reserved. | 2 // All Rights Reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
| 6 // are met: | 6 // are met: |
| 7 // | 7 // |
| 8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
| 9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
| 10 // | 10 // |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 namespace v8 { | 46 namespace v8 { |
| 47 namespace internal { | 47 namespace internal { |
| 48 | 48 |
| 49 // Get the CPU features enabled by the build. For cross compilation the | 49 // Get the CPU features enabled by the build. For cross compilation the |
| 50 // preprocessor symbols CAN_USE_ARMV7_INSTRUCTIONS and CAN_USE_VFP3_INSTRUCTIONS | 50 // preprocessor symbols CAN_USE_ARMV7_INSTRUCTIONS and CAN_USE_VFP3_INSTRUCTIONS |
| 51 // can be defined to enable ARMv7 and VFPv3 instructions when building the | 51 // can be defined to enable ARMv7 and VFPv3 instructions when building the |
| 52 // snapshot. | 52 // snapshot. |
| 53 static unsigned CpuFeaturesImpliedByCompiler() { | 53 static unsigned CpuFeaturesImpliedByCompiler() { |
| 54 unsigned answer = 0; | 54 unsigned answer = 0; |
| 55 #ifdef CAN_USE_ARMV8_INSTRUCTIONS |
| 56 if (FLAG_enable_armv8) { |
| 57 answer |= 1u << ARMv8; |
| 58 // ARMv8 always features VFP and NEON. |
| 59 answer |= 1u << ARMv7 | 1u << VFP3 | 1u << NEON | 1u << VFP32DREGS; |
| 60 answer |= 1u << SUDIV | 1u << MLS; |
| 61 } |
| 62 #endif // CAN_USE_ARMV8_INSTRUCTIONS |
| 55 #ifdef CAN_USE_ARMV7_INSTRUCTIONS | 63 #ifdef CAN_USE_ARMV7_INSTRUCTIONS |
| 56 if (FLAG_enable_armv7) answer |= 1u << ARMv7; | 64 if (FLAG_enable_armv7) answer |= 1u << ARMv7; |
| 57 #endif // CAN_USE_ARMV7_INSTRUCTIONS | 65 #endif // CAN_USE_ARMV7_INSTRUCTIONS |
| 58 #ifdef CAN_USE_VFP3_INSTRUCTIONS | 66 #ifdef CAN_USE_VFP3_INSTRUCTIONS |
| 59 if (FLAG_enable_vfp3) answer |= 1u << VFP3 | 1u << ARMv7; | 67 if (FLAG_enable_vfp3) answer |= 1u << VFP3 | 1u << ARMv7; |
| 60 #endif // CAN_USE_VFP3_INSTRUCTIONS | 68 #endif // CAN_USE_VFP3_INSTRUCTIONS |
| 61 #ifdef CAN_USE_VFP32DREGS | 69 #ifdef CAN_USE_VFP32DREGS |
| 62 if (FLAG_enable_32dregs) answer |= 1u << VFP32DREGS; | 70 if (FLAG_enable_32dregs) answer |= 1u << VFP32DREGS; |
| 63 #endif // CAN_USE_VFP32DREGS | 71 #endif // CAN_USE_VFP32DREGS |
| 64 #ifdef CAN_USE_NEON | 72 #ifdef CAN_USE_NEON |
| 65 if (FLAG_enable_neon) answer |= 1u << NEON; | 73 if (FLAG_enable_neon) answer |= 1u << NEON; |
| 66 #endif // CAN_USE_VFP32DREGS | 74 #endif // CAN_USE_VFP32DREGS |
| 67 if ((answer & (1u << ARMv7)) && FLAG_enable_unaligned_accesses) { | 75 if ((answer & (1u << ARMv7)) && FLAG_enable_unaligned_accesses) { |
| 68 answer |= 1u << UNALIGNED_ACCESSES; | 76 answer |= 1u << UNALIGNED_ACCESSES; |
| 69 } | 77 } |
| 70 | 78 |
| 71 return answer; | 79 return answer; |
| 72 } | 80 } |
| 73 | 81 |
| 74 | 82 |
| 75 void CpuFeatures::ProbeImpl(bool cross_compile) { | 83 void CpuFeatures::ProbeImpl(bool cross_compile) { |
| 76 supported_ |= CpuFeaturesImpliedByCompiler(); | 84 supported_ |= CpuFeaturesImpliedByCompiler(); |
| 77 cache_line_size_ = 64; | 85 cache_line_size_ = 64; |
| 78 | 86 |
| 79 // Only use statically determined features for cross compile (snapshot). | 87 // Only use statically determined features for cross compile (snapshot). |
| 80 if (cross_compile) return; | 88 if (cross_compile) return; |
| 81 | 89 |
| 82 #ifndef __arm__ | 90 #ifndef __arm__ |
| 83 // For the simulator build, use whatever the flags specify. | 91 // For the simulator build, use whatever the flags specify. |
| 92 if (FLAG_enable_armv8) { |
| 93 supported_ |= 1u << ARMv8; |
| 94 // ARMv8 always features VFP and NEON. |
| 95 supported_ |= 1u << ARMv7 | 1u << VFP3 | 1u << NEON | 1u << VFP32DREGS; |
| 96 supported_ |= 1u << SUDIV | 1u << MLS; |
| 97 if (FLAG_enable_movw_movt) supported_ |= 1u << MOVW_MOVT_IMMEDIATE_LOADS; |
| 98 } |
| 84 if (FLAG_enable_armv7) { | 99 if (FLAG_enable_armv7) { |
| 85 supported_ |= 1u << ARMv7; | 100 supported_ |= 1u << ARMv7; |
| 86 if (FLAG_enable_vfp3) supported_ |= 1u << VFP3; | 101 if (FLAG_enable_vfp3) supported_ |= 1u << VFP3; |
| 87 if (FLAG_enable_neon) supported_ |= 1u << NEON | 1u << VFP32DREGS; | 102 if (FLAG_enable_neon) supported_ |= 1u << NEON | 1u << VFP32DREGS; |
| 88 if (FLAG_enable_sudiv) supported_ |= 1u << SUDIV; | 103 if (FLAG_enable_sudiv) supported_ |= 1u << SUDIV; |
| 89 if (FLAG_enable_movw_movt) supported_ |= 1u << MOVW_MOVT_IMMEDIATE_LOADS; | 104 if (FLAG_enable_movw_movt) supported_ |= 1u << MOVW_MOVT_IMMEDIATE_LOADS; |
| 90 if (FLAG_enable_32dregs) supported_ |= 1u << VFP32DREGS; | 105 if (FLAG_enable_32dregs) supported_ |= 1u << VFP32DREGS; |
| 91 } | 106 } |
| 92 if (FLAG_enable_mls) supported_ |= 1u << MLS; | 107 if (FLAG_enable_mls) supported_ |= 1u << MLS; |
| 93 if (FLAG_enable_unaligned_accesses) supported_ |= 1u << UNALIGNED_ACCESSES; | 108 if (FLAG_enable_unaligned_accesses) supported_ |= 1u << UNALIGNED_ACCESSES; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 const char* arm_float_abi = NULL; | 162 const char* arm_float_abi = NULL; |
| 148 | 163 |
| 149 #if !defined __arm__ | 164 #if !defined __arm__ |
| 150 arm_target_type = " simulator"; | 165 arm_target_type = " simulator"; |
| 151 #endif | 166 #endif |
| 152 | 167 |
| 153 #if defined ARM_TEST_NO_FEATURE_PROBE | 168 #if defined ARM_TEST_NO_FEATURE_PROBE |
| 154 arm_no_probe = " noprobe"; | 169 arm_no_probe = " noprobe"; |
| 155 #endif | 170 #endif |
| 156 | 171 |
| 157 #if defined CAN_USE_ARMV7_INSTRUCTIONS | 172 #if defined CAN_USE_ARMV8_INSTRUCTIONS |
| 173 arm_arch = "arm v8"; |
| 174 #elif defined CAN_USE_ARMV7_INSTRUCTIONS |
| 158 arm_arch = "arm v7"; | 175 arm_arch = "arm v7"; |
| 159 #else | 176 #else |
| 160 arm_arch = "arm v6"; | 177 arm_arch = "arm v6"; |
| 161 #endif | 178 #endif |
| 162 | 179 |
| 163 #if defined CAN_USE_NEON | 180 #if defined CAN_USE_NEON |
| 164 arm_fpu = " neon"; | 181 arm_fpu = " neon"; |
| 165 #elif defined CAN_USE_VFP3_INSTRUCTIONS | 182 #elif defined CAN_USE_VFP3_INSTRUCTIONS |
| 166 # if defined CAN_USE_VFP32DREGS | 183 # if defined CAN_USE_VFP32DREGS |
| 167 arm_fpu = " vfp3"; | 184 arm_fpu = " vfp3"; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 185 #endif | 202 #endif |
| 186 | 203 |
| 187 printf("target%s%s %s%s%s %s\n", | 204 printf("target%s%s %s%s%s %s\n", |
| 188 arm_target_type, arm_no_probe, arm_arch, arm_fpu, arm_thumb, | 205 arm_target_type, arm_no_probe, arm_arch, arm_fpu, arm_thumb, |
| 189 arm_float_abi); | 206 arm_float_abi); |
| 190 } | 207 } |
| 191 | 208 |
| 192 | 209 |
| 193 void CpuFeatures::PrintFeatures() { | 210 void CpuFeatures::PrintFeatures() { |
| 194 printf( | 211 printf( |
| 195 "ARMv7=%d VFP3=%d VFP32DREGS=%d NEON=%d SUDIV=%d UNALIGNED_ACCESSES=%d " | 212 "ARMv8=%d ARMv7=%d VFP3=%d VFP32DREGS=%d NEON=%d SUDIV=%d MLS=%d" |
| 196 "MOVW_MOVT_IMMEDIATE_LOADS=%d COHERENT_CACHE=%d", | 213 "UNALIGNED_ACCESSES=%d MOVW_MOVT_IMMEDIATE_LOADS=%d COHERENT_CACHE=%d", |
| 214 CpuFeatures::IsSupported(ARMv8), |
| 197 CpuFeatures::IsSupported(ARMv7), | 215 CpuFeatures::IsSupported(ARMv7), |
| 198 CpuFeatures::IsSupported(VFP3), | 216 CpuFeatures::IsSupported(VFP3), |
| 199 CpuFeatures::IsSupported(VFP32DREGS), | 217 CpuFeatures::IsSupported(VFP32DREGS), |
| 200 CpuFeatures::IsSupported(NEON), | 218 CpuFeatures::IsSupported(NEON), |
| 201 CpuFeatures::IsSupported(SUDIV), | 219 CpuFeatures::IsSupported(SUDIV), |
| 220 CpuFeatures::IsSupported(MLS), |
| 202 CpuFeatures::IsSupported(UNALIGNED_ACCESSES), | 221 CpuFeatures::IsSupported(UNALIGNED_ACCESSES), |
| 203 CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS), | 222 CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS), |
| 204 CpuFeatures::IsSupported(COHERENT_CACHE)); | 223 CpuFeatures::IsSupported(COHERENT_CACHE)); |
| 205 #ifdef __arm__ | 224 #ifdef __arm__ |
| 206 bool eabi_hardfloat = base::OS::ArmUsingHardFloat(); | 225 bool eabi_hardfloat = base::OS::ArmUsingHardFloat(); |
| 207 #elif USE_EABI_HARDFLOAT | 226 #elif USE_EABI_HARDFLOAT |
| 208 bool eabi_hardfloat = true; | 227 bool eabi_hardfloat = true; |
| 209 #else | 228 #else |
| 210 bool eabi_hardfloat = false; | 229 bool eabi_hardfloat = false; |
| 211 #endif | 230 #endif |
| (...skipping 3808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4020 DCHECK(is_uint12(offset)); | 4039 DCHECK(is_uint12(offset)); |
| 4021 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset)); | 4040 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset)); |
| 4022 } | 4041 } |
| 4023 } | 4042 } |
| 4024 | 4043 |
| 4025 | 4044 |
| 4026 } // namespace internal | 4045 } // namespace internal |
| 4027 } // namespace v8 | 4046 } // namespace v8 |
| 4028 | 4047 |
| 4029 #endif // V8_TARGET_ARCH_ARM | 4048 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |