Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: runtime/vm/intermediate_language_x64.cc

Issue 51373004: SIMD shuffle API changes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 3121 matching lines...) Expand 10 before | Expand all | Expand 10 after
3132 switch (op_kind()) { 3132 switch (op_kind()) {
3133 case Token::kADD: __ addps(left, right); break; 3133 case Token::kADD: __ addps(left, right); break;
3134 case Token::kSUB: __ subps(left, right); break; 3134 case Token::kSUB: __ subps(left, right); break;
3135 case Token::kMUL: __ mulps(left, right); break; 3135 case Token::kMUL: __ mulps(left, right); break;
3136 case Token::kDIV: __ divps(left, right); break; 3136 case Token::kDIV: __ divps(left, right); break;
3137 default: UNREACHABLE(); 3137 default: UNREACHABLE();
3138 } 3138 }
3139 } 3139 }
3140 3140
3141 3141
3142 LocationSummary* Float32x4ShuffleInstr::MakeLocationSummary() const { 3142 LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary() const {
3143 const intptr_t kNumInputs = 1; 3143 const intptr_t kNumInputs = 1;
3144 const intptr_t kNumTemps = 0; 3144 const intptr_t kNumTemps = 0;
3145 LocationSummary* summary = 3145 LocationSummary* summary =
3146 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3146 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3147 summary->set_in(0, Location::RequiresFpuRegister()); 3147 summary->set_in(0, Location::RequiresFpuRegister());
3148 summary->set_out(Location::SameAsFirstInput()); 3148 summary->set_out(Location::SameAsFirstInput());
3149 return summary; 3149 return summary;
3150 } 3150 }
3151 3151
3152 3152
3153 void Float32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3153 void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3154 XmmRegister value = locs()->in(0).fpu_reg(); 3154 XmmRegister value = locs()->in(0).fpu_reg();
3155 3155
3156 ASSERT(locs()->out().fpu_reg() == value); 3156 ASSERT(locs()->out().fpu_reg() == value);
3157 3157
3158 switch (op_kind()) { 3158 switch (op_kind()) {
3159 case MethodRecognizer::kFloat32x4ShuffleX: 3159 case MethodRecognizer::kFloat32x4ShuffleX:
3160 __ shufps(value, value, Immediate(0x00)); 3160 __ shufps(value, value, Immediate(0x00));
3161 __ cvtss2sd(value, value); 3161 __ cvtss2sd(value, value);
3162 break; 3162 break;
3163 case MethodRecognizer::kFloat32x4ShuffleY: 3163 case MethodRecognizer::kFloat32x4ShuffleY:
3164 __ shufps(value, value, Immediate(0x55)); 3164 __ shufps(value, value, Immediate(0x55));
3165 __ cvtss2sd(value, value); 3165 __ cvtss2sd(value, value);
3166 break; 3166 break;
3167 case MethodRecognizer::kFloat32x4ShuffleZ: 3167 case MethodRecognizer::kFloat32x4ShuffleZ:
3168 __ shufps(value, value, Immediate(0xAA)); 3168 __ shufps(value, value, Immediate(0xAA));
3169 __ cvtss2sd(value, value); 3169 __ cvtss2sd(value, value);
3170 break; 3170 break;
3171 case MethodRecognizer::kFloat32x4ShuffleW: 3171 case MethodRecognizer::kFloat32x4ShuffleW:
3172 __ shufps(value, value, Immediate(0xFF)); 3172 __ shufps(value, value, Immediate(0xFF));
3173 __ cvtss2sd(value, value); 3173 __ cvtss2sd(value, value);
3174 break; 3174 break;
3175 case MethodRecognizer::kFloat32x4Shuffle: 3175 case MethodRecognizer::kFloat32x4Shuffle:
3176 case MethodRecognizer::kUint32x4Shuffle:
3176 __ shufps(value, value, Immediate(mask_)); 3177 __ shufps(value, value, Immediate(mask_));
3177 break; 3178 break;
3178 default: UNREACHABLE(); 3179 default: UNREACHABLE();
3179 } 3180 }
3180 } 3181 }
3181 3182
3182 3183
3184 LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary() const {
3185 const intptr_t kNumInputs = 2;
3186 const intptr_t kNumTemps = 0;
3187 LocationSummary* summary =
3188 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3189 summary->set_in(0, Location::RequiresFpuRegister());
3190 summary->set_in(1, Location::RequiresFpuRegister());
3191 summary->set_out(Location::SameAsFirstInput());
3192 return summary;
3193 }
3194
3195
3196 void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3197 XmmRegister left = locs()->in(0).fpu_reg();
3198 XmmRegister right = locs()->in(1).fpu_reg();
3199
3200 ASSERT(locs()->out().fpu_reg() == left);
3201 switch (op_kind()) {
3202 case MethodRecognizer::kFloat32x4ShuffleMix:
3203 case MethodRecognizer::kUint32x4ShuffleMix:
3204 __ shufps(left, right, Immediate(mask_));
3205 break;
3206 default: UNREACHABLE();
3207 }
3208 }
3209
3210
3183 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary() const { 3211 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary() const {
3184 const intptr_t kNumInputs = 1; 3212 const intptr_t kNumInputs = 1;
3185 const intptr_t kNumTemps = 0; 3213 const intptr_t kNumTemps = 0;
3186 LocationSummary* summary = 3214 LocationSummary* summary =
3187 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3215 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3188 summary->set_in(0, Location::RequiresFpuRegister()); 3216 summary->set_in(0, Location::RequiresFpuRegister());
3189 summary->set_out(Location::RequiresRegister()); 3217 summary->set_out(Location::RequiresRegister());
3190 return summary; 3218 return summary;
3191 } 3219 }
3192 3220
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
3534 summary->set_out(Location::SameAsFirstInput()); 3562 summary->set_out(Location::SameAsFirstInput());
3535 return summary; 3563 return summary;
3536 } 3564 }
3537 3565
3538 3566
3539 void Float32x4ToUint32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3567 void Float32x4ToUint32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3540 // NOP. 3568 // NOP.
3541 } 3569 }
3542 3570
3543 3571
3544 LocationSummary* Float32x4TwoArgShuffleInstr::MakeLocationSummary() const {
3545 const intptr_t kNumInputs = 2;
3546 const intptr_t kNumTemps = 0;
3547 LocationSummary* summary =
3548 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3549 summary->set_in(0, Location::RequiresFpuRegister());
3550 summary->set_in(1, Location::RequiresFpuRegister());
3551 summary->set_out(Location::SameAsFirstInput());
3552 return summary;
3553 }
3554
3555
3556 void Float32x4TwoArgShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3557 XmmRegister left = locs()->in(0).fpu_reg();
3558 XmmRegister right = locs()->in(1).fpu_reg();
3559
3560 ASSERT(locs()->out().fpu_reg() == left);
3561
3562 switch (op_kind()) {
3563 case MethodRecognizer::kFloat32x4WithZWInXY:
3564 __ movhlps(left, right);
3565 break;
3566 case MethodRecognizer::kFloat32x4InterleaveXY:
3567 __ unpcklps(left, right);
3568 break;
3569 case MethodRecognizer::kFloat32x4InterleaveZW:
3570 __ unpckhps(left, right);
3571 break;
3572 case MethodRecognizer::kFloat32x4InterleaveXYPairs:
3573 __ unpcklpd(left, right);
3574 break;
3575 case MethodRecognizer::kFloat32x4InterleaveZWPairs:
3576 __ unpckhpd(left, right);
3577 break;
3578 default: UNREACHABLE();
3579 }
3580 }
3581
3582
3583 LocationSummary* Uint32x4BoolConstructorInstr::MakeLocationSummary() const { 3572 LocationSummary* Uint32x4BoolConstructorInstr::MakeLocationSummary() const {
3584 const intptr_t kNumInputs = 4; 3573 const intptr_t kNumInputs = 4;
3585 const intptr_t kNumTemps = 1; 3574 const intptr_t kNumTemps = 1;
3586 LocationSummary* summary = 3575 LocationSummary* summary =
3587 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3576 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3588 summary->set_in(0, Location::RequiresRegister()); 3577 summary->set_in(0, Location::RequiresRegister());
3589 summary->set_in(1, Location::RequiresRegister()); 3578 summary->set_in(1, Location::RequiresRegister());
3590 summary->set_in(2, Location::RequiresRegister()); 3579 summary->set_in(2, Location::RequiresRegister());
3591 summary->set_in(3, Location::RequiresRegister()); 3580 summary->set_in(3, Location::RequiresRegister());
3592 summary->set_temp(0, Location::RequiresRegister()); 3581 summary->set_temp(0, Location::RequiresRegister());
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
4806 PcDescriptors::kOther, 4795 PcDescriptors::kOther,
4807 locs()); 4796 locs());
4808 __ Drop(2); // Discard type arguments and receiver. 4797 __ Drop(2); // Discard type arguments and receiver.
4809 } 4798 }
4810 4799
4811 } // namespace dart 4800 } // namespace dart
4812 4801
4813 #undef __ 4802 #undef __
4814 4803
4815 #endif // defined TARGET_ARCH_X64 4804 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698