Chromium Code Reviews| 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 namespace internal { | 45 namespace internal { |
| 46 | 46 |
| 47 #ifdef DEBUG | 47 #ifdef DEBUG |
| 48 bool CpuFeatures::initialized_ = false; | 48 bool CpuFeatures::initialized_ = false; |
| 49 #endif | 49 #endif |
| 50 unsigned CpuFeatures::supported_ = 0; | 50 unsigned CpuFeatures::supported_ = 0; |
| 51 unsigned CpuFeatures::found_by_runtime_probing_ = 0; | 51 unsigned CpuFeatures::found_by_runtime_probing_ = 0; |
| 52 | 52 |
| 53 | 53 |
| 54 // Get the CPU features enabled by the build. For cross compilation the | 54 // Get the CPU features enabled by the build. For cross compilation the |
| 55 // preprocessor symbols CAN_USE_ARMV7_INSTRUCTIONS and CAN_USE_VFP_INSTRUCTIONS | 55 // preprocessor symbols CAN_USE_ARMV7_INSTRUCTIONS and CAN_USE_VFP3_INSTRUCTIONS |
| 56 // can be defined to enable ARMv7 and VFPv3 instructions when building the | 56 // can be defined to enable ARMv7 and VFPv3 instructions when building the |
| 57 // snapshot. | 57 // snapshot. |
| 58 static uint64_t CpuFeaturesImpliedByCompiler() { | 58 static uint64_t CpuFeaturesImpliedByCompiler() { |
| 59 uint64_t answer = 0; | 59 uint64_t answer = 0; |
| 60 #ifdef CAN_USE_ARMV7_INSTRUCTIONS | 60 #ifdef CAN_USE_ARMV7_INSTRUCTIONS |
| 61 answer |= 1u << ARMv7; | 61 answer |= 1u << ARMv7; |
| 62 #endif // def CAN_USE_ARMV7_INSTRUCTIONS | 62 #endif // def CAN_USE_ARMV7_INSTRUCTIONS |
| 63 #ifdef CAN_USE_VFP_INSTRUCTIONS | 63 #ifdef CAN_USE_VFP3_INSTRUCTIONS |
| 64 answer |= 1u << VFP3 | 1u << ARMv7; | 64 answer |= 1u << VFP3 | 1u << VFP2 | 1u << ARMv7; |
| 65 #endif // def CAN_USE_VFP_INSTRUCTIONS | 65 #endif // def CAN_USE_VFP3_INSTRUCTIONS |
| 66 #ifdef CAN_USE_VFP2_INSTRUCTIONS | |
| 67 answer |= 1u << VFP2; | |
| 68 #endif // def CAN_USE_VFP2_INSTRUCTIONS | |
| 66 | 69 |
| 67 #ifdef __arm__ | 70 #ifdef __arm__ |
| 68 // If the compiler is allowed to use VFP then we can use VFP too in our code | 71 // If the compiler is allowed to use VFP then we can use VFP too in our code |
| 69 // generation even when generating snapshots. ARMv7 and hardware floating | 72 // generation even when generating snapshots. ARMv7 and hardware floating |
| 70 // point support implies VFPv3, see ARM DDI 0406B, page A1-6. | 73 // point support implies VFPv3, see ARM DDI 0406B, page A1-6. |
| 71 #if defined(CAN_USE_ARMV7_INSTRUCTIONS) && defined(__VFP_FP__) \ | 74 #if defined(CAN_USE_ARMV7_INSTRUCTIONS) && defined(__VFP_FP__) \ |
| 72 && !defined(__SOFTFP__) | 75 && !defined(__SOFTFP__) |
| 73 answer |= 1u << VFP3 | 1u << ARMv7; | 76 answer |= 1u << VFP3 | 1u << ARMv7; |
| 74 #endif // defined(CAN_USE_ARMV7_INSTRUCTIONS) && defined(__VFP_FP__) | 77 #endif // defined(CAN_USE_ARMV7_INSTRUCTIONS) && defined(__VFP_FP__) |
| 75 // && !defined(__SOFTFP__) | 78 // && !defined(__SOFTFP__) |
| (...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1735 | 1738 |
| 1736 | 1739 |
| 1737 void Assembler::vstr(const DwVfpRegister src, | 1740 void Assembler::vstr(const DwVfpRegister src, |
| 1738 const Register base, | 1741 const Register base, |
| 1739 int offset, | 1742 int offset, |
| 1740 const Condition cond) { | 1743 const Condition cond) { |
| 1741 // MEM(Rbase + offset) = Dsrc. | 1744 // MEM(Rbase + offset) = Dsrc. |
| 1742 // Instruction details available in ARM DDI 0406A, A8-786. | 1745 // Instruction details available in ARM DDI 0406A, A8-786. |
| 1743 // cond(31-28) | 1101(27-24)| U000(23-20) | | Rbase(19-16) | | 1746 // cond(31-28) | 1101(27-24)| U000(23-20) | | Rbase(19-16) | |
| 1744 // Vsrc(15-12) | 1011(11-8) | (offset/4) | 1747 // Vsrc(15-12) | 1011(11-8) | (offset/4) |
| 1745 ASSERT(CpuFeatures::IsEnabled(VFP3)); | 1748 ASSERT(CpuFeatures::IsEnabled(VFP3) || CpuFeatures::IsEnabled(VFP2)); |
|
Yang
2012/07/23 07:21:19
it seems to me that VFP3 is a superset of VFP2, VS
| |
| 1746 int u = 1; | 1749 int u = 1; |
| 1747 if (offset < 0) { | 1750 if (offset < 0) { |
| 1748 offset = -offset; | 1751 offset = -offset; |
| 1749 u = 0; | 1752 u = 0; |
| 1750 } | 1753 } |
| 1751 ASSERT(offset >= 0); | 1754 ASSERT(offset >= 0); |
| 1752 if ((offset % 4) == 0 && (offset / 4) < 256) { | 1755 if ((offset % 4) == 0 && (offset / 4) < 256) { |
| 1753 emit(cond | u*B23 | 0xD0*B20 | base.code()*B16 | src.code()*B12 | | 1756 emit(cond | u*B23 | 0xD0*B20 | base.code()*B16 | src.code()*B12 | |
| 1754 0xB*B8 | ((offset / 4) & 255)); | 1757 0xB*B8 | ((offset / 4) & 255)); |
| 1755 } else { | 1758 } else { |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2007 src.split_code(&sm, &m); | 2010 src.split_code(&sm, &m); |
| 2008 emit(cond | 0xE*B24 | d*B22 | 0xB*B20 | sd*B12 | 0xA*B8 | B6 | m*B5 | sm); | 2011 emit(cond | 0xE*B24 | d*B22 | 0xB*B20 | sd*B12 | 0xA*B8 | B6 | m*B5 | sm); |
| 2009 } | 2012 } |
| 2010 | 2013 |
| 2011 | 2014 |
| 2012 void Assembler::vmov(const DwVfpRegister dst, | 2015 void Assembler::vmov(const DwVfpRegister dst, |
| 2013 const DwVfpRegister src, | 2016 const DwVfpRegister src, |
| 2014 const Condition cond) { | 2017 const Condition cond) { |
| 2015 // Dd = Dm | 2018 // Dd = Dm |
| 2016 // Instruction details available in ARM DDI 0406B, A8-642. | 2019 // Instruction details available in ARM DDI 0406B, A8-642. |
| 2017 ASSERT(CpuFeatures::IsEnabled(VFP3)); | 2020 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
|
Yang
2012/07/23 07:21:19
From what I found, this is also available for VFPv
| |
| 2018 emit(cond | 0xE*B24 | 0xB*B20 | | 2021 emit(cond | 0xE*B24 | 0xB*B20 | |
| 2019 dst.code()*B12 | 0x5*B9 | B8 | B6 | src.code()); | 2022 dst.code()*B12 | 0x5*B9 | B8 | B6 | src.code()); |
| 2020 } | 2023 } |
| 2021 | 2024 |
| 2022 | 2025 |
| 2023 void Assembler::vmov(const DwVfpRegister dst, | 2026 void Assembler::vmov(const DwVfpRegister dst, |
| 2024 const Register src1, | 2027 const Register src1, |
| 2025 const Register src2, | 2028 const Register src2, |
| 2026 const Condition cond) { | 2029 const Condition cond) { |
| 2027 // Dm = <Rt,Rt2>. | 2030 // Dm = <Rt,Rt2>. |
| 2028 // Instruction details available in ARM DDI 0406A, A8-646. | 2031 // Instruction details available in ARM DDI 0406A, A8-646. |
| 2029 // cond(31-28) | 1100(27-24)| 010(23-21) | op=0(20) | Rt2(19-16) | | 2032 // cond(31-28) | 1100(27-24)| 010(23-21) | op=0(20) | Rt2(19-16) | |
| 2030 // Rt(15-12) | 1011(11-8) | 00(7-6) | M(5) | 1(4) | Vm | 2033 // Rt(15-12) | 1011(11-8) | 00(7-6) | M(5) | 1(4) | Vm |
| 2031 ASSERT(CpuFeatures::IsEnabled(VFP3)); | 2034 ASSERT(CpuFeatures::IsEnabled(VFP3) || CpuFeatures::IsEnabled(VFP2)); |
|
Yang
2012/07/23 07:21:19
Ditto.
| |
| 2032 ASSERT(!src1.is(pc) && !src2.is(pc)); | 2035 ASSERT(!src1.is(pc) && !src2.is(pc)); |
| 2033 emit(cond | 0xC*B24 | B22 | src2.code()*B16 | | 2036 emit(cond | 0xC*B24 | B22 | src2.code()*B16 | |
| 2034 src1.code()*B12 | 0xB*B8 | B4 | dst.code()); | 2037 src1.code()*B12 | 0xB*B8 | B4 | dst.code()); |
| 2035 } | 2038 } |
| 2036 | 2039 |
| 2037 | 2040 |
| 2038 void Assembler::vmov(const Register dst1, | 2041 void Assembler::vmov(const Register dst1, |
| 2039 const Register dst2, | 2042 const Register dst2, |
| 2040 const DwVfpRegister src, | 2043 const DwVfpRegister src, |
| 2041 const Condition cond) { | 2044 const Condition cond) { |
| 2042 // <Rt,Rt2> = Dm. | 2045 // <Rt,Rt2> = Dm. |
| 2043 // Instruction details available in ARM DDI 0406A, A8-646. | 2046 // Instruction details available in ARM DDI 0406A, A8-646. |
| 2044 // cond(31-28) | 1100(27-24)| 010(23-21) | op=1(20) | Rt2(19-16) | | 2047 // cond(31-28) | 1100(27-24)| 010(23-21) | op=1(20) | Rt2(19-16) | |
| 2045 // Rt(15-12) | 1011(11-8) | 00(7-6) | M(5) | 1(4) | Vm | 2048 // Rt(15-12) | 1011(11-8) | 00(7-6) | M(5) | 1(4) | Vm |
| 2046 ASSERT(CpuFeatures::IsEnabled(VFP3)); | 2049 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
|
Yang
2012/07/23 07:21:19
Ditto. Also enable for VFP2?
| |
| 2047 ASSERT(!dst1.is(pc) && !dst2.is(pc)); | 2050 ASSERT(!dst1.is(pc) && !dst2.is(pc)); |
| 2048 emit(cond | 0xC*B24 | B22 | B20 | dst2.code()*B16 | | 2051 emit(cond | 0xC*B24 | B22 | B20 | dst2.code()*B16 | |
| 2049 dst1.code()*B12 | 0xB*B8 | B4 | src.code()); | 2052 dst1.code()*B12 | 0xB*B8 | B4 | src.code()); |
| 2050 } | 2053 } |
| 2051 | 2054 |
| 2052 | 2055 |
| 2053 void Assembler::vmov(const SwVfpRegister dst, | 2056 void Assembler::vmov(const SwVfpRegister dst, |
| 2054 const Register src, | 2057 const Register src, |
| 2055 const Condition cond) { | 2058 const Condition cond) { |
| 2056 // Sn = Rt. | 2059 // Sn = Rt. |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2669 | 2672 |
| 2670 // Since a constant pool was just emitted, move the check offset forward by | 2673 // Since a constant pool was just emitted, move the check offset forward by |
| 2671 // the standard interval. | 2674 // the standard interval. |
| 2672 next_buffer_check_ = pc_offset() + kCheckPoolInterval; | 2675 next_buffer_check_ = pc_offset() + kCheckPoolInterval; |
| 2673 } | 2676 } |
| 2674 | 2677 |
| 2675 | 2678 |
| 2676 } } // namespace v8::internal | 2679 } } // namespace v8::internal |
| 2677 | 2680 |
| 2678 #endif // V8_TARGET_ARCH_ARM | 2681 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |