OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // NOLINT | 5 #include "vm/globals.h" // NOLINT |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 | 778 |
779 void Assembler::orps(XmmRegister dst, XmmRegister src) { | 779 void Assembler::orps(XmmRegister dst, XmmRegister src) { |
780 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 780 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
781 EmitREX_RB(dst, src); | 781 EmitREX_RB(dst, src); |
782 EmitUint8(0x0F); | 782 EmitUint8(0x0F); |
783 EmitUint8(0x56); | 783 EmitUint8(0x56); |
784 EmitXmmRegisterOperand(dst & 7, src); | 784 EmitXmmRegisterOperand(dst & 7, src); |
785 } | 785 } |
786 | 786 |
787 void Assembler::notps(XmmRegister dst) { | 787 void Assembler::notps(XmmRegister dst) { |
788 // { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; | 788 static const struct ALIGN16 { |
789 movq(TMP, Address(THR, Thread::float_not_address_offset())); | 789 uint32_t a; |
| 790 uint32_t b; |
| 791 uint32_t c; |
| 792 uint32_t d; |
| 793 } float_not_constant = |
| 794 { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; |
| 795 LoadImmediate( |
| 796 TMP, Immediate(reinterpret_cast<intptr_t>(&float_not_constant))); |
790 xorps(dst, Address(TMP, 0)); | 797 xorps(dst, Address(TMP, 0)); |
791 } | 798 } |
792 | 799 |
793 | 800 |
794 void Assembler::negateps(XmmRegister dst) { | 801 void Assembler::negateps(XmmRegister dst) { |
795 // { 0x80000000, 0x80000000, 0x80000000, 0x80000000 } | 802 static const struct ALIGN16 { |
796 movq(TMP, Address(THR, Thread::float_negate_address_offset())); | 803 uint32_t a; |
| 804 uint32_t b; |
| 805 uint32_t c; |
| 806 uint32_t d; |
| 807 } float_negate_constant = |
| 808 { 0x80000000, 0x80000000, 0x80000000, 0x80000000 }; |
| 809 LoadImmediate( |
| 810 TMP, Immediate(reinterpret_cast<intptr_t>(&float_negate_constant))); |
797 xorps(dst, Address(TMP, 0)); | 811 xorps(dst, Address(TMP, 0)); |
798 } | 812 } |
799 | 813 |
800 | 814 |
801 void Assembler::absps(XmmRegister dst) { | 815 void Assembler::absps(XmmRegister dst) { |
802 // { 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF } | 816 static const struct ALIGN16 { |
803 movq(TMP, Address(THR, Thread::float_absolute_address_offset())); | 817 uint32_t a; |
| 818 uint32_t b; |
| 819 uint32_t c; |
| 820 uint32_t d; |
| 821 } float_absolute_constant = |
| 822 { 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF }; |
| 823 LoadImmediate( |
| 824 TMP, Immediate(reinterpret_cast<intptr_t>(&float_absolute_constant))); |
804 andps(dst, Address(TMP, 0)); | 825 andps(dst, Address(TMP, 0)); |
805 } | 826 } |
806 | 827 |
807 | 828 |
808 void Assembler::zerowps(XmmRegister dst) { | 829 void Assembler::zerowps(XmmRegister dst) { |
809 // { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000 } | 830 static const struct ALIGN16 { |
810 movq(TMP, Address(THR, Thread::float_zerow_address_offset())); | 831 uint32_t a; |
| 832 uint32_t b; |
| 833 uint32_t c; |
| 834 uint32_t d; |
| 835 } float_zerow_constant = |
| 836 { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000 }; |
| 837 LoadImmediate( |
| 838 TMP, Immediate(reinterpret_cast<intptr_t>(&float_zerow_constant))); |
811 andps(dst, Address(TMP, 0)); | 839 andps(dst, Address(TMP, 0)); |
812 } | 840 } |
813 | 841 |
814 | 842 |
815 void Assembler::cmppseq(XmmRegister dst, XmmRegister src) { | 843 void Assembler::cmppseq(XmmRegister dst, XmmRegister src) { |
816 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 844 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
817 EmitREX_RB(dst, src); | 845 EmitREX_RB(dst, src); |
818 EmitUint8(0x0F); | 846 EmitUint8(0x0F); |
819 EmitUint8(0xC2); | 847 EmitUint8(0xC2); |
820 EmitXmmRegisterOperand(dst & 7, src); | 848 EmitXmmRegisterOperand(dst & 7, src); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 ASSERT(dst <= XMM15); | 1010 ASSERT(dst <= XMM15); |
983 EmitUint8(0x66); | 1011 EmitUint8(0x66); |
984 EmitREX_RB(dst, src); | 1012 EmitREX_RB(dst, src); |
985 EmitUint8(0x0F); | 1013 EmitUint8(0x0F); |
986 EmitUint8(0x58); | 1014 EmitUint8(0x58); |
987 EmitXmmRegisterOperand(dst & 7, src); | 1015 EmitXmmRegisterOperand(dst & 7, src); |
988 } | 1016 } |
989 | 1017 |
990 | 1018 |
991 void Assembler::negatepd(XmmRegister dst) { | 1019 void Assembler::negatepd(XmmRegister dst) { |
992 // { 0x8000000000000000LL, 0x8000000000000000LL } | 1020 static const struct ALIGN16 { |
993 movq(TMP, Address(THR, Thread::double_negate_address_offset())); | 1021 uint64_t a; |
| 1022 uint64_t b; |
| 1023 } double_negate_constant = |
| 1024 { 0x8000000000000000LL, 0x8000000000000000LL }; |
| 1025 LoadImmediate( |
| 1026 TMP, Immediate(reinterpret_cast<intptr_t>(&double_negate_constant))); |
994 xorpd(dst, Address(TMP, 0)); | 1027 xorpd(dst, Address(TMP, 0)); |
995 } | 1028 } |
996 | 1029 |
997 | 1030 |
998 void Assembler::subpd(XmmRegister dst, XmmRegister src) { | 1031 void Assembler::subpd(XmmRegister dst, XmmRegister src) { |
999 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1032 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1000 ASSERT(src <= XMM15); | 1033 ASSERT(src <= XMM15); |
1001 ASSERT(dst <= XMM15); | 1034 ASSERT(dst <= XMM15); |
1002 EmitUint8(0x66); | 1035 EmitUint8(0x66); |
1003 EmitREX_RB(dst, src); | 1036 EmitREX_RB(dst, src); |
(...skipping 21 matching lines...) Expand all Loading... |
1025 ASSERT(dst <= XMM15); | 1058 ASSERT(dst <= XMM15); |
1026 EmitUint8(0x66); | 1059 EmitUint8(0x66); |
1027 EmitREX_RB(dst, src); | 1060 EmitREX_RB(dst, src); |
1028 EmitUint8(0x0F); | 1061 EmitUint8(0x0F); |
1029 EmitUint8(0x5E); | 1062 EmitUint8(0x5E); |
1030 EmitXmmRegisterOperand(dst & 7, src); | 1063 EmitXmmRegisterOperand(dst & 7, src); |
1031 } | 1064 } |
1032 | 1065 |
1033 | 1066 |
1034 void Assembler::abspd(XmmRegister dst) { | 1067 void Assembler::abspd(XmmRegister dst) { |
1035 // { 0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL } | 1068 static const struct ALIGN16 { |
1036 movq(TMP, Address(THR, Thread::double_abs_address_offset())); | 1069 uint64_t a; |
| 1070 uint64_t b; |
| 1071 } double_absolute_const = |
| 1072 { 0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL }; |
| 1073 LoadImmediate( |
| 1074 TMP, Immediate(reinterpret_cast<intptr_t>(&double_absolute_const))); |
1037 andpd(dst, Address(TMP, 0)); | 1075 andpd(dst, Address(TMP, 0)); |
1038 } | 1076 } |
1039 | 1077 |
1040 | 1078 |
1041 void Assembler::minpd(XmmRegister dst, XmmRegister src) { | 1079 void Assembler::minpd(XmmRegister dst, XmmRegister src) { |
1042 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1080 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1043 ASSERT(src <= XMM15); | 1081 ASSERT(src <= XMM15); |
1044 ASSERT(dst <= XMM15); | 1082 ASSERT(dst <= XMM15); |
1045 EmitUint8(0x66); | 1083 EmitUint8(0x66); |
1046 EmitREX_RB(dst, src); | 1084 EmitREX_RB(dst, src); |
(...skipping 2068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3115 Register temp = RCX; | 3153 Register temp = RCX; |
3116 pushq(temp); | 3154 pushq(temp); |
3117 leaq(temp, dest); | 3155 leaq(temp, dest); |
3118 addq(Address(temp, VerifiedMemory::offset()), inc_imm); | 3156 addq(Address(temp, VerifiedMemory::offset()), inc_imm); |
3119 popq(temp); | 3157 popq(temp); |
3120 } | 3158 } |
3121 } | 3159 } |
3122 | 3160 |
3123 | 3161 |
3124 void Assembler::DoubleNegate(XmmRegister d) { | 3162 void Assembler::DoubleNegate(XmmRegister d) { |
3125 // {0x8000000000000000LL, 0x8000000000000000LL} | 3163 static const struct ALIGN16 { |
3126 movq(TMP, Address(THR, Thread::double_negate_address_offset())); | 3164 uint64_t a; |
| 3165 uint64_t b; |
| 3166 } double_negate_constant = |
| 3167 {0x8000000000000000LL, 0x8000000000000000LL}; |
| 3168 LoadImmediate( |
| 3169 TMP, Immediate(reinterpret_cast<intptr_t>(&double_negate_constant))); |
3127 xorpd(d, Address(TMP, 0)); | 3170 xorpd(d, Address(TMP, 0)); |
3128 } | 3171 } |
3129 | 3172 |
3130 | 3173 |
3131 void Assembler::DoubleAbs(XmmRegister reg) { | 3174 void Assembler::DoubleAbs(XmmRegister reg) { |
3132 // {0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL} | 3175 static const struct ALIGN16 { |
3133 movq(TMP, Address(THR, Thread::double_abs_address_offset())); | 3176 uint64_t a; |
| 3177 uint64_t b; |
| 3178 } double_abs_constant = |
| 3179 {0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL}; |
| 3180 LoadImmediate(TMP, |
| 3181 Immediate(reinterpret_cast<intptr_t>(&double_abs_constant))); |
3134 andpd(reg, Address(TMP, 0)); | 3182 andpd(reg, Address(TMP, 0)); |
3135 } | 3183 } |
3136 | 3184 |
3137 | 3185 |
3138 void Assembler::Stop(const char* message, bool fixed_length_encoding) { | 3186 void Assembler::Stop(const char* message, bool fixed_length_encoding) { |
3139 int64_t message_address = reinterpret_cast<int64_t>(message); | 3187 int64_t message_address = reinterpret_cast<int64_t>(message); |
3140 if (FLAG_print_stop_message) { | 3188 if (FLAG_print_stop_message) { |
3141 pushq(TMP); // Preserve TMP register. | 3189 pushq(TMP); // Preserve TMP register. |
3142 pushq(RDI); // Preserve RDI register. | 3190 pushq(RDI); // Preserve RDI register. |
3143 if (fixed_length_encoding) { | 3191 if (fixed_length_encoding) { |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3915 | 3963 |
3916 | 3964 |
3917 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3965 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
3918 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3966 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
3919 return xmm_reg_names[reg]; | 3967 return xmm_reg_names[reg]; |
3920 } | 3968 } |
3921 | 3969 |
3922 } // namespace dart | 3970 } // namespace dart |
3923 | 3971 |
3924 #endif // defined TARGET_ARCH_X64 | 3972 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |