| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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" // Needed here to get TARGET_ARCH_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 3613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3624 // Convert to Float32. | 3624 // Convert to Float32. |
| 3625 __ fcvtsd(VTMP, value); | 3625 __ fcvtsd(VTMP, value); |
| 3626 | 3626 |
| 3627 // Splat across all lanes. | 3627 // Splat across all lanes. |
| 3628 __ vdups(result, VTMP, 0); | 3628 __ vdups(result, VTMP, 0); |
| 3629 } | 3629 } |
| 3630 | 3630 |
| 3631 | 3631 |
| 3632 LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Isolate* isolate, | 3632 LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Isolate* isolate, |
| 3633 bool opt) const { | 3633 bool opt) const { |
| 3634 UNIMPLEMENTED(); | 3634 const intptr_t kNumInputs = 2; |
| 3635 return NULL; | 3635 const intptr_t kNumTemps = 0; |
| 3636 LocationSummary* summary = new(isolate) LocationSummary( |
| 3637 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3638 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3639 summary->set_in(1, Location::RequiresFpuRegister()); |
| 3640 summary->set_out(0, Location::RequiresFpuRegister()); |
| 3641 return summary; |
| 3636 } | 3642 } |
| 3637 | 3643 |
| 3638 | 3644 |
| 3639 void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3645 void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3640 UNIMPLEMENTED(); | 3646 const VRegister left = locs()->in(0).fpu_reg(); |
| 3647 const VRegister right = locs()->in(1).fpu_reg(); |
| 3648 const VRegister result = locs()->out(0).fpu_reg(); |
| 3649 |
| 3650 switch (op_kind()) { |
| 3651 case MethodRecognizer::kFloat32x4Equal: |
| 3652 __ vceqs(result, left, right); |
| 3653 break; |
| 3654 case MethodRecognizer::kFloat32x4NotEqual: |
| 3655 __ vceqs(result, left, right); |
| 3656 // Invert the result. |
| 3657 __ vnot(result, result); |
| 3658 break; |
| 3659 case MethodRecognizer::kFloat32x4GreaterThan: |
| 3660 __ vcgts(result, left, right); |
| 3661 break; |
| 3662 case MethodRecognizer::kFloat32x4GreaterThanOrEqual: |
| 3663 __ vcges(result, left, right); |
| 3664 break; |
| 3665 case MethodRecognizer::kFloat32x4LessThan: |
| 3666 __ vcgts(result, right, left); |
| 3667 break; |
| 3668 case MethodRecognizer::kFloat32x4LessThanOrEqual: |
| 3669 __ vcges(result, right, left); |
| 3670 break; |
| 3671 |
| 3672 default: UNREACHABLE(); |
| 3673 } |
| 3641 } | 3674 } |
| 3642 | 3675 |
| 3643 | 3676 |
| 3644 LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Isolate* isolate, | 3677 LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Isolate* isolate, |
| 3645 bool opt) const { | 3678 bool opt) const { |
| 3646 UNIMPLEMENTED(); | 3679 const intptr_t kNumInputs = 2; |
| 3647 return NULL; | 3680 const intptr_t kNumTemps = 0; |
| 3681 LocationSummary* summary = new(isolate) LocationSummary( |
| 3682 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3683 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3684 summary->set_in(1, Location::RequiresFpuRegister()); |
| 3685 summary->set_out(0, Location::RequiresFpuRegister()); |
| 3686 return summary; |
| 3648 } | 3687 } |
| 3649 | 3688 |
| 3650 | 3689 |
| 3651 void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3690 void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3652 UNIMPLEMENTED(); | 3691 const VRegister left = locs()->in(0).fpu_reg(); |
| 3692 const VRegister right = locs()->in(1).fpu_reg(); |
| 3693 const VRegister result = locs()->out(0).fpu_reg(); |
| 3694 |
| 3695 switch (op_kind()) { |
| 3696 case MethodRecognizer::kFloat32x4Min: |
| 3697 __ vmins(result, left, right); |
| 3698 break; |
| 3699 case MethodRecognizer::kFloat32x4Max: |
| 3700 __ vmaxs(result, left, right); |
| 3701 break; |
| 3702 default: UNREACHABLE(); |
| 3703 } |
| 3653 } | 3704 } |
| 3654 | 3705 |
| 3655 | 3706 |
| 3656 LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Isolate* isolate, | 3707 LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Isolate* isolate, |
| 3657 bool opt) const { | 3708 bool opt) const { |
| 3658 UNIMPLEMENTED(); | 3709 const intptr_t kNumInputs = 1; |
| 3659 return NULL; | 3710 const intptr_t kNumTemps = 0; |
| 3711 LocationSummary* summary = new(isolate) LocationSummary( |
| 3712 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3713 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3714 summary->set_out(0, Location::RequiresFpuRegister()); |
| 3715 return summary; |
| 3660 } | 3716 } |
| 3661 | 3717 |
| 3662 | 3718 |
| 3663 void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3719 void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3664 UNIMPLEMENTED(); | 3720 const VRegister left = locs()->in(0).fpu_reg(); |
| 3721 const VRegister result = locs()->out(0).fpu_reg(); |
| 3722 |
| 3723 switch (op_kind()) { |
| 3724 case MethodRecognizer::kFloat32x4Sqrt: |
| 3725 __ vsqrts(result, left); |
| 3726 break; |
| 3727 case MethodRecognizer::kFloat32x4Reciprocal: |
| 3728 __ VRecps(result, left); |
| 3729 break; |
| 3730 case MethodRecognizer::kFloat32x4ReciprocalSqrt: |
| 3731 __ VRSqrts(result, left); |
| 3732 break; |
| 3733 default: UNREACHABLE(); |
| 3734 } |
| 3665 } | 3735 } |
| 3666 | 3736 |
| 3667 | 3737 |
| 3668 LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Isolate* isolate, | 3738 LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Isolate* isolate, |
| 3669 bool opt) const { | 3739 bool opt) const { |
| 3670 const intptr_t kNumInputs = 2; | 3740 const intptr_t kNumInputs = 2; |
| 3671 const intptr_t kNumTemps = 0; | 3741 const intptr_t kNumTemps = 0; |
| 3672 LocationSummary* summary = new(isolate) LocationSummary( | 3742 LocationSummary* summary = new(isolate) LocationSummary( |
| 3673 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 3743 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3674 summary->set_in(0, Location::RequiresFpuRegister()); | 3744 summary->set_in(0, Location::RequiresFpuRegister()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3717 case MethodRecognizer::kFloat32x4Absolute: | 3787 case MethodRecognizer::kFloat32x4Absolute: |
| 3718 __ vabss(result, left); | 3788 __ vabss(result, left); |
| 3719 break; | 3789 break; |
| 3720 default: UNREACHABLE(); | 3790 default: UNREACHABLE(); |
| 3721 } | 3791 } |
| 3722 } | 3792 } |
| 3723 | 3793 |
| 3724 | 3794 |
| 3725 LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Isolate* isolate, | 3795 LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Isolate* isolate, |
| 3726 bool opt) const { | 3796 bool opt) const { |
| 3727 UNIMPLEMENTED(); | 3797 const intptr_t kNumInputs = 3; |
| 3728 return NULL; | 3798 const intptr_t kNumTemps = 0; |
| 3799 LocationSummary* summary = new(isolate) LocationSummary( |
| 3800 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3801 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3802 summary->set_in(1, Location::RequiresFpuRegister()); |
| 3803 summary->set_in(2, Location::RequiresFpuRegister()); |
| 3804 summary->set_out(0, Location::RequiresFpuRegister()); |
| 3805 return summary; |
| 3729 } | 3806 } |
| 3730 | 3807 |
| 3731 | 3808 |
| 3732 void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3809 void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3733 UNIMPLEMENTED(); | 3810 const VRegister left = locs()->in(0).fpu_reg(); |
| 3811 const VRegister lower = locs()->in(1).fpu_reg(); |
| 3812 const VRegister upper = locs()->in(2).fpu_reg(); |
| 3813 const VRegister result = locs()->out(0).fpu_reg(); |
| 3814 __ vmins(result, left, upper); |
| 3815 __ vmaxs(result, result, lower); |
| 3734 } | 3816 } |
| 3735 | 3817 |
| 3736 | 3818 |
| 3737 LocationSummary* Float32x4WithInstr::MakeLocationSummary(Isolate* isolate, | 3819 LocationSummary* Float32x4WithInstr::MakeLocationSummary(Isolate* isolate, |
| 3738 bool opt) const { | 3820 bool opt) const { |
| 3739 const intptr_t kNumInputs = 2; | 3821 const intptr_t kNumInputs = 2; |
| 3740 const intptr_t kNumTemps = 0; | 3822 const intptr_t kNumTemps = 0; |
| 3741 LocationSummary* summary = new LocationSummary( | 3823 LocationSummary* summary = new LocationSummary( |
| 3742 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 3824 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3743 summary->set_in(0, Location::RequiresFpuRegister()); | 3825 summary->set_in(0, Location::RequiresFpuRegister()); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3872 summary->set_out(0, Location::RequiresFpuRegister()); | 3954 summary->set_out(0, Location::RequiresFpuRegister()); |
| 3873 return summary; | 3955 return summary; |
| 3874 } | 3956 } |
| 3875 | 3957 |
| 3876 | 3958 |
| 3877 void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3959 void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3878 const VRegister v0 = locs()->in(0).fpu_reg(); | 3960 const VRegister v0 = locs()->in(0).fpu_reg(); |
| 3879 const VRegister v1 = locs()->in(1).fpu_reg(); | 3961 const VRegister v1 = locs()->in(1).fpu_reg(); |
| 3880 const VRegister r = locs()->out(0).fpu_reg(); | 3962 const VRegister r = locs()->out(0).fpu_reg(); |
| 3881 __ vinsd(r, 0, v0, 0); | 3963 __ vinsd(r, 0, v0, 0); |
| 3882 __ vinsd(r, 0, v1, 0); | 3964 __ vinsd(r, 1, v1, 0); |
| 3883 } | 3965 } |
| 3884 | 3966 |
| 3885 | 3967 |
| 3886 LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( | 3968 LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( |
| 3887 Isolate* isolate, bool opt) const { | 3969 Isolate* isolate, bool opt) const { |
| 3888 const intptr_t kNumInputs = 1; | 3970 const intptr_t kNumInputs = 1; |
| 3889 const intptr_t kNumTemps = 0; | 3971 const intptr_t kNumTemps = 0; |
| 3890 LocationSummary* summary = new LocationSummary( | 3972 LocationSummary* summary = new LocationSummary( |
| 3891 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 3973 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3892 summary->set_in(0, Location::RequiresFpuRegister()); | 3974 summary->set_in(0, Location::RequiresFpuRegister()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3934 __ vinsd(r, 0, VTMP, 0); | 4016 __ vinsd(r, 0, VTMP, 0); |
| 3935 // Set Y. | 4017 // Set Y. |
| 3936 __ vinss(VTMP, 0, q, 1); | 4018 __ vinss(VTMP, 0, q, 1); |
| 3937 __ fcvtds(VTMP, VTMP); | 4019 __ fcvtds(VTMP, VTMP); |
| 3938 __ vinsd(r, 1, VTMP, 0); | 4020 __ vinsd(r, 1, VTMP, 0); |
| 3939 } | 4021 } |
| 3940 | 4022 |
| 3941 | 4023 |
| 3942 LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Isolate* isolate, | 4024 LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Isolate* isolate, |
| 3943 bool opt) const { | 4025 bool opt) const { |
| 3944 UNIMPLEMENTED(); | 4026 const intptr_t kNumInputs = 1; |
| 3945 return NULL; | 4027 const intptr_t kNumTemps = 0; |
| 4028 LocationSummary* summary = new(isolate) LocationSummary( |
| 4029 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4030 |
| 4031 if (representation() == kTagged) { |
| 4032 ASSERT(op_kind() == MethodRecognizer::kFloat64x2GetSignMask); |
| 4033 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4034 summary->set_out(0, Location::RequiresRegister()); |
| 4035 } else { |
| 4036 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4037 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4038 } |
| 4039 return summary; |
| 3946 } | 4040 } |
| 3947 | 4041 |
| 3948 | 4042 |
| 3949 void Float64x2ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4043 void Float64x2ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3950 UNIMPLEMENTED(); | 4044 const VRegister value = locs()->in(0).fpu_reg(); |
| 4045 |
| 4046 if ((op_kind() == MethodRecognizer::kFloat64x2GetSignMask)) { |
| 4047 const Register out = locs()->out(0).reg(); |
| 4048 |
| 4049 // Bits of X lane. |
| 4050 __ vmovrd(out, value, 0); |
| 4051 __ Lsr(out, out, 63); |
| 4052 // Bits of Y lane. |
| 4053 __ vmovrd(TMP, value, 1); |
| 4054 __ Lsr(TMP, TMP, 63); |
| 4055 __ orr(out, out, Operand(TMP, LSL, 1)); |
| 4056 // Tag. |
| 4057 __ SmiTag(out); |
| 4058 return; |
| 4059 } |
| 4060 ASSERT(representation() == kUnboxedFloat64x2); |
| 4061 const VRegister result = locs()->out(0).fpu_reg(); |
| 4062 |
| 4063 switch (op_kind()) { |
| 4064 case MethodRecognizer::kFloat64x2Negate: |
| 4065 __ vnegd(result, value); |
| 4066 break; |
| 4067 case MethodRecognizer::kFloat64x2Abs: |
| 4068 __ vabsd(result, value); |
| 4069 break; |
| 4070 case MethodRecognizer::kFloat64x2Sqrt: |
| 4071 __ vsqrtd(result, value); |
| 4072 break; |
| 4073 default: UNREACHABLE(); |
| 4074 } |
| 3951 } | 4075 } |
| 3952 | 4076 |
| 3953 | 4077 |
| 3954 LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Isolate* isolate, | 4078 LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Isolate* isolate, |
| 3955 bool opt) const { | 4079 bool opt) const { |
| 3956 const intptr_t kNumInputs = 2; | 4080 const intptr_t kNumInputs = 2; |
| 3957 const intptr_t kNumTemps = 0; | 4081 const intptr_t kNumTemps = 0; |
| 3958 LocationSummary* summary = new LocationSummary( | 4082 LocationSummary* summary = new LocationSummary( |
| 3959 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4083 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3960 summary->set_in(0, Location::RequiresFpuRegister()); | 4084 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3961 summary->set_in(1, Location::RequiresFpuRegister()); | 4085 summary->set_in(1, Location::RequiresFpuRegister()); |
| 3962 summary->set_out(0, Location::SameAsFirstInput()); | 4086 summary->set_out(0, Location::SameAsFirstInput()); |
| 3963 return summary; | 4087 return summary; |
| 3964 } | 4088 } |
| 3965 | 4089 |
| 3966 | 4090 |
| 3967 void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4091 void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3968 const VRegister left = locs()->in(0).fpu_reg(); | 4092 const VRegister left = locs()->in(0).fpu_reg(); |
| 3969 const VRegister right = locs()->in(1).fpu_reg(); | 4093 const VRegister right = locs()->in(1).fpu_reg(); |
| 3970 const VRegister out = locs()->out(0).fpu_reg(); | 4094 const VRegister out = locs()->out(0).fpu_reg(); |
| 3971 ASSERT(left == out); | 4095 ASSERT(left == out); |
| 3972 | 4096 |
| 3973 switch (op_kind()) { | 4097 switch (op_kind()) { |
| 3974 case MethodRecognizer::kFloat64x2Scale: | 4098 case MethodRecognizer::kFloat64x2Scale: |
| 3975 __ vmuld(out, left, right); | 4099 __ vdupd(VTMP, right, 0); |
| 4100 __ vmuld(out, left, VTMP); |
| 3976 break; | 4101 break; |
| 3977 case MethodRecognizer::kFloat64x2WithX: | 4102 case MethodRecognizer::kFloat64x2WithX: |
| 3978 __ vinsd(out, 0, right, 0); | 4103 __ vinsd(out, 0, right, 0); |
| 3979 break; | 4104 break; |
| 3980 case MethodRecognizer::kFloat64x2WithY: | 4105 case MethodRecognizer::kFloat64x2WithY: |
| 3981 __ vinsd(out, 1, right, 0); | 4106 __ vinsd(out, 1, right, 0); |
| 3982 break; | 4107 break; |
| 3983 case MethodRecognizer::kFloat64x2Min: { | 4108 case MethodRecognizer::kFloat64x2Min: |
| 3984 UNIMPLEMENTED(); | 4109 __ vmind(out, left, right); |
| 3985 break; | 4110 break; |
| 3986 } | 4111 case MethodRecognizer::kFloat64x2Max: |
| 3987 case MethodRecognizer::kFloat64x2Max: { | 4112 __ vmaxd(out, left, right); |
| 3988 UNIMPLEMENTED(); | |
| 3989 break; | 4113 break; |
| 3990 } | |
| 3991 default: UNREACHABLE(); | 4114 default: UNREACHABLE(); |
| 3992 } | 4115 } |
| 3993 } | 4116 } |
| 3994 | 4117 |
| 3995 | 4118 |
| 3996 LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( | 4119 LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( |
| 3997 Isolate* isolate, bool opt) const { | 4120 Isolate* isolate, bool opt) const { |
| 3998 const intptr_t kNumInputs = 4; | 4121 const intptr_t kNumInputs = 4; |
| 3999 const intptr_t kNumTemps = 1; | 4122 const intptr_t kNumTemps = 1; |
| 4000 LocationSummary* summary = new LocationSummary( | 4123 LocationSummary* summary = new LocationSummary( |
| (...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5286 compiler->GenerateCall(token_pos(), | 5409 compiler->GenerateCall(token_pos(), |
| 5287 &label, | 5410 &label, |
| 5288 PcDescriptors::kOther, | 5411 PcDescriptors::kOther, |
| 5289 locs()); | 5412 locs()); |
| 5290 __ Drop(ArgumentCount()); // Discard arguments. | 5413 __ Drop(ArgumentCount()); // Discard arguments. |
| 5291 } | 5414 } |
| 5292 | 5415 |
| 5293 } // namespace dart | 5416 } // namespace dart |
| 5294 | 5417 |
| 5295 #endif // defined TARGET_ARCH_ARM64 | 5418 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |