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 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2754 // Instruction details available in ARM DDI 0406B, A8.6.298. | 2754 // Instruction details available in ARM DDI 0406B, A8.6.298. |
2755 // cond(31-28) | 11101(27-23)| D(22) | 11(21-20) | 0111(19-16) | | 2755 // cond(31-28) | 11101(27-23)| D(22) | 11(21-20) | 0111(19-16) | |
2756 // Vd(15-12) | 101(11-9) | sz(8) | 1(7) | 1(6) | M(5) | 0(4) | Vm(3-0) | 2756 // Vd(15-12) | 101(11-9) | sz(8) | 1(7) | 1(6) | M(5) | 0(4) | Vm(3-0) |
2757 int sz = IsDoubleVFPType(src_type) ? 0x1 : 0x0; | 2757 int sz = IsDoubleVFPType(src_type) ? 0x1 : 0x0; |
2758 return (cond | 0xE*B24 | B23 | D*B22 | 0x3*B20 | 0x7*B16 | | 2758 return (cond | 0xE*B24 | B23 | D*B22 | 0x3*B20 | 0x7*B16 | |
2759 Vd*B12 | 0x5*B9 | sz*B8 | B7 | B6 | M*B5 | Vm); | 2759 Vd*B12 | 0x5*B9 | sz*B8 | B7 | B6 | M*B5 | Vm); |
2760 } | 2760 } |
2761 } | 2761 } |
2762 | 2762 |
2763 | 2763 |
| 2764 static Instr EncodeVCVTFraction(const VFPType dst_type, |
| 2765 const int dst_src_code, |
| 2766 const VFPType src_type, |
| 2767 const int fraction_bits, |
| 2768 const Condition cond) { |
| 2769 // Conversion between IEEE floating point and 32-bit fixed point. |
| 2770 // Instruction details available in ARM DDI 0406C.b, A8-874. |
| 2771 // cond(31-28) | 11101(27-23) | D(22) | 111(21-19) | op(18) | 1(17) | U(16) | |
| 2772 // Vd(15-12) | 101(11-9) | sf(8) | sx(7) | 1(6) | i(5) | 0(4) | imm4(3-0) |
| 2773 ASSERT(fraction_bits > 0 && fraction_bits <= 32); |
| 2774 ASSERT(CpuFeatures::IsSupported(VFP3)); |
| 2775 ASSERT(IsIntegerVFPType(dst_type) != IsIntegerVFPType(src_type)); |
| 2776 int D, Vd, U, sz, op; |
| 2777 if (IsIntegerVFPType(dst_type)) { |
| 2778 // Wider register should be set to Vd, D |
| 2779 SplitRegCode(src_type, dst_src_code, &Vd, &D); |
| 2780 U = IsSignedVFPType(dst_type) ? 0x0 : 0x1; |
| 2781 sz = IsDoubleVFPType(src_type) ? 0x1 : 0x0; |
| 2782 op = 0x1; |
| 2783 } else { |
| 2784 SplitRegCode(dst_type, dst_src_code, &Vd, &D); |
| 2785 U = IsSignedVFPType(src_type) ? 0x0 : 0x1; |
| 2786 sz = IsDoubleVFPType(dst_type) ? 0x1 : 0x0; |
| 2787 op = 0x0; |
| 2788 } |
| 2789 int sx = 0x1; |
| 2790 int imm5 = (sx ? 32 : 16) - fraction_bits; |
| 2791 ASSERT(imm5 >= 0); |
| 2792 // Encode imm5 |
| 2793 int i = imm5 & 1; |
| 2794 int imm4 = imm5 >> 1; |
| 2795 |
| 2796 return (cond | 0xE*B24 | B23 | D*B22 | 0x3*B20 | B19 | op*B18 | B17 | U*B16 | |
| 2797 Vd*B12 | 0x5*B9 | sz*B8 | sx*B7 | B6 | i*B5 | imm4); |
| 2798 } |
| 2799 |
| 2800 |
2764 void Assembler::vcvt_f64_s32(const DwVfpRegister dst, | 2801 void Assembler::vcvt_f64_s32(const DwVfpRegister dst, |
2765 const SwVfpRegister src, | 2802 const SwVfpRegister src, |
2766 VFPConversionMode mode, | 2803 VFPConversionMode mode, |
2767 const Condition cond) { | 2804 const Condition cond) { |
2768 emit(EncodeVCVT(F64, dst.code(), S32, src.code(), mode, cond)); | 2805 emit(EncodeVCVT(F64, dst.code(), S32, src.code(), mode, cond)); |
2769 } | 2806 } |
2770 | 2807 |
2771 | 2808 |
2772 void Assembler::vcvt_f32_s32(const SwVfpRegister dst, | 2809 void Assembler::vcvt_f32_s32(const SwVfpRegister dst, |
2773 const SwVfpRegister src, | 2810 const SwVfpRegister src, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2811 | 2848 |
2812 void Assembler::vcvt_f32_f64(const SwVfpRegister dst, | 2849 void Assembler::vcvt_f32_f64(const SwVfpRegister dst, |
2813 const DwVfpRegister src, | 2850 const DwVfpRegister src, |
2814 VFPConversionMode mode, | 2851 VFPConversionMode mode, |
2815 const Condition cond) { | 2852 const Condition cond) { |
2816 emit(EncodeVCVT(F32, dst.code(), F64, src.code(), mode, cond)); | 2853 emit(EncodeVCVT(F32, dst.code(), F64, src.code(), mode, cond)); |
2817 } | 2854 } |
2818 | 2855 |
2819 | 2856 |
2820 void Assembler::vcvt_f64_s32(const DwVfpRegister dst, | 2857 void Assembler::vcvt_f64_s32(const DwVfpRegister dst, |
2821 int fraction_bits, | 2858 const int fraction_bits, |
2822 const Condition cond) { | 2859 const Condition cond) { |
2823 // Instruction details available in ARM DDI 0406C.b, A8-874. | 2860 emit(EncodeVCVTFraction(F64, dst.code(), S32, fraction_bits, cond)); |
2824 // cond(31-28) | 11101(27-23) | D(22) | 11(21-20) | 1010(19-16) | Vd(15-12) | | |
2825 // 101(11-9) | sf=1(8) | sx=1(7) | 1(6) | i(5) | 0(4) | imm4(3-0) | |
2826 ASSERT(fraction_bits > 0 && fraction_bits <= 32); | |
2827 ASSERT(CpuFeatures::IsSupported(VFP3)); | |
2828 int vd, d; | |
2829 dst.split_code(&vd, &d); | |
2830 int i = ((32 - fraction_bits) >> 4) & 1; | |
2831 int imm4 = (32 - fraction_bits) & 0xf; | |
2832 emit(cond | 0xE*B24 | B23 | d*B22 | 0x3*B20 | B19 | 0x2*B16 | | |
2833 vd*B12 | 0x5*B9 | B8 | B7 | B6 | i*B5 | imm4); | |
2834 } | 2861 } |
2835 | 2862 |
2836 | 2863 |
| 2864 void Assembler::vcvt_u32_f64(const DwVfpRegister dst, |
| 2865 const int fraction_bits, |
| 2866 const Condition cond) { |
| 2867 emit(EncodeVCVTFraction(U32, dst.code(), F64, fraction_bits, cond)); |
| 2868 } |
| 2869 |
| 2870 |
2837 void Assembler::vneg(const DwVfpRegister dst, | 2871 void Assembler::vneg(const DwVfpRegister dst, |
2838 const DwVfpRegister src, | 2872 const DwVfpRegister src, |
2839 const Condition cond) { | 2873 const Condition cond) { |
2840 // Instruction details available in ARM DDI 0406C.b, A8-968. | 2874 // Instruction details available in ARM DDI 0406C.b, A8-968. |
2841 // cond(31-28) | 11101(27-23) | D(22) | 11(21-20) | 0001(19-16) | Vd(15-12) | | 2875 // cond(31-28) | 11101(27-23) | D(22) | 11(21-20) | 0001(19-16) | Vd(15-12) | |
2842 // 101(11-9) | sz=1(8) | 0(7) | 1(6) | M(5) | 0(4) | Vm(3-0) | 2876 // 101(11-9) | sz=1(8) | 0(7) | 1(6) | M(5) | 0(4) | Vm(3-0) |
2843 int vd, d; | 2877 int vd, d; |
2844 dst.split_code(&vd, &d); | 2878 dst.split_code(&vd, &d); |
2845 int vm, m; | 2879 int vm, m; |
2846 src.split_code(&vm, &m); | 2880 src.split_code(&vm, &m); |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3732 ASSERT((index_64bit == count_of_64bit_) && | 3766 ASSERT((index_64bit == count_of_64bit_) && |
3733 (index_code_ptr == (index_64bit + count_of_code_ptr_)) && | 3767 (index_code_ptr == (index_64bit + count_of_code_ptr_)) && |
3734 (index_heap_ptr == (index_code_ptr + count_of_heap_ptr_)) && | 3768 (index_heap_ptr == (index_code_ptr + count_of_heap_ptr_)) && |
3735 (index_32bit == (index_heap_ptr + count_of_32bit_))); | 3769 (index_32bit == (index_heap_ptr + count_of_32bit_))); |
3736 } | 3770 } |
3737 | 3771 |
3738 | 3772 |
3739 } } // namespace v8::internal | 3773 } } // namespace v8::internal |
3740 | 3774 |
3741 #endif // V8_TARGET_ARCH_ARM | 3775 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |