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

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 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after
3144 switch (op_kind()) { 3144 switch (op_kind()) {
3145 case Token::kADD: __ addps(left, right); break; 3145 case Token::kADD: __ addps(left, right); break;
3146 case Token::kSUB: __ subps(left, right); break; 3146 case Token::kSUB: __ subps(left, right); break;
3147 case Token::kMUL: __ mulps(left, right); break; 3147 case Token::kMUL: __ mulps(left, right); break;
3148 case Token::kDIV: __ divps(left, right); break; 3148 case Token::kDIV: __ divps(left, right); break;
3149 default: UNREACHABLE(); 3149 default: UNREACHABLE();
3150 } 3150 }
3151 } 3151 }
3152 3152
3153 3153
3154 LocationSummary* Float32x4ShuffleInstr::MakeLocationSummary() const { 3154 LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary() const {
3155 const intptr_t kNumInputs = 1; 3155 const intptr_t kNumInputs = 1;
3156 const intptr_t kNumTemps = 0; 3156 const intptr_t kNumTemps = 0;
3157 LocationSummary* summary = 3157 LocationSummary* summary =
3158 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3158 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3159 summary->set_in(0, Location::RequiresFpuRegister()); 3159 summary->set_in(0, Location::RequiresFpuRegister());
3160 summary->set_out(Location::SameAsFirstInput()); 3160 summary->set_out(Location::SameAsFirstInput());
3161 return summary; 3161 return summary;
3162 } 3162 }
3163 3163
3164 3164
3165 void Float32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3165 void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3166 XmmRegister value = locs()->in(0).fpu_reg(); 3166 XmmRegister value = locs()->in(0).fpu_reg();
3167 3167
3168 ASSERT(locs()->out().fpu_reg() == value); 3168 ASSERT(locs()->out().fpu_reg() == value);
3169 3169
3170 switch (op_kind()) { 3170 switch (op_kind()) {
3171 case MethodRecognizer::kFloat32x4ShuffleX: 3171 case MethodRecognizer::kFloat32x4ShuffleX:
3172 __ shufps(value, value, Immediate(0x00)); 3172 __ shufps(value, value, Immediate(0x00));
3173 __ cvtss2sd(value, value); 3173 __ cvtss2sd(value, value);
3174 break; 3174 break;
3175 case MethodRecognizer::kFloat32x4ShuffleY: 3175 case MethodRecognizer::kFloat32x4ShuffleY:
3176 __ shufps(value, value, Immediate(0x55)); 3176 __ shufps(value, value, Immediate(0x55));
3177 __ cvtss2sd(value, value); 3177 __ cvtss2sd(value, value);
3178 break; 3178 break;
3179 case MethodRecognizer::kFloat32x4ShuffleZ: 3179 case MethodRecognizer::kFloat32x4ShuffleZ:
3180 __ shufps(value, value, Immediate(0xAA)); 3180 __ shufps(value, value, Immediate(0xAA));
3181 __ cvtss2sd(value, value); 3181 __ cvtss2sd(value, value);
3182 break; 3182 break;
3183 case MethodRecognizer::kFloat32x4ShuffleW: 3183 case MethodRecognizer::kFloat32x4ShuffleW:
3184 __ shufps(value, value, Immediate(0xFF)); 3184 __ shufps(value, value, Immediate(0xFF));
3185 __ cvtss2sd(value, value); 3185 __ cvtss2sd(value, value);
3186 break; 3186 break;
3187 case MethodRecognizer::kFloat32x4Shuffle: 3187 case MethodRecognizer::kFloat32x4Shuffle:
3188 case MethodRecognizer::kUint32x4Shuffle:
3188 __ shufps(value, value, Immediate(mask_)); 3189 __ shufps(value, value, Immediate(mask_));
3189 break; 3190 break;
3190 default: UNREACHABLE(); 3191 default: UNREACHABLE();
3191 } 3192 }
3192 } 3193 }
3193 3194
3194 3195
3196 LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary() const {
3197 const intptr_t kNumInputs = 2;
3198 const intptr_t kNumTemps = 0;
3199 LocationSummary* summary =
3200 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3201 summary->set_in(0, Location::RequiresFpuRegister());
3202 summary->set_in(1, Location::RequiresFpuRegister());
3203 summary->set_out(Location::SameAsFirstInput());
3204 return summary;
3205 }
3206
3207
3208 void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3209 XmmRegister left = locs()->in(0).fpu_reg();
3210 XmmRegister right = locs()->in(1).fpu_reg();
3211
3212 ASSERT(locs()->out().fpu_reg() == left);
3213 switch (op_kind()) {
3214 case MethodRecognizer::kFloat32x4ShuffleMix:
3215 case MethodRecognizer::kUint32x4ShuffleMix:
3216 __ shufps(left, right, Immediate(mask_));
3217 break;
3218 default: UNREACHABLE();
3219 }
3220 }
3221
3222
3195 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary() const { 3223 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary() const {
3196 const intptr_t kNumInputs = 1; 3224 const intptr_t kNumInputs = 1;
3197 const intptr_t kNumTemps = 0; 3225 const intptr_t kNumTemps = 0;
3198 LocationSummary* summary = 3226 LocationSummary* summary =
3199 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3227 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3200 summary->set_in(0, Location::RequiresFpuRegister()); 3228 summary->set_in(0, Location::RequiresFpuRegister());
3201 summary->set_out(Location::RequiresRegister()); 3229 summary->set_out(Location::RequiresRegister());
3202 return summary; 3230 return summary;
3203 } 3231 }
3204 3232
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
3546 summary->set_out(Location::SameAsFirstInput()); 3574 summary->set_out(Location::SameAsFirstInput());
3547 return summary; 3575 return summary;
3548 } 3576 }
3549 3577
3550 3578
3551 void Float32x4ToUint32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3579 void Float32x4ToUint32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3552 // NOP. 3580 // NOP.
3553 } 3581 }
3554 3582
3555 3583
3556 LocationSummary* Float32x4TwoArgShuffleInstr::MakeLocationSummary() const {
3557 const intptr_t kNumInputs = 2;
3558 const intptr_t kNumTemps = 0;
3559 LocationSummary* summary =
3560 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3561 summary->set_in(0, Location::RequiresFpuRegister());
3562 summary->set_in(1, Location::RequiresFpuRegister());
3563 summary->set_out(Location::SameAsFirstInput());
3564 return summary;
3565 }
3566
3567
3568 void Float32x4TwoArgShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3569 XmmRegister left = locs()->in(0).fpu_reg();
3570 XmmRegister right = locs()->in(1).fpu_reg();
3571
3572 ASSERT(locs()->out().fpu_reg() == left);
3573
3574 switch (op_kind()) {
3575 case MethodRecognizer::kFloat32x4WithZWInXY:
3576 __ movhlps(left, right);
3577 break;
3578 case MethodRecognizer::kFloat32x4InterleaveXY:
3579 __ unpcklps(left, right);
3580 break;
3581 case MethodRecognizer::kFloat32x4InterleaveZW:
3582 __ unpckhps(left, right);
3583 break;
3584 case MethodRecognizer::kFloat32x4InterleaveXYPairs:
3585 __ unpcklpd(left, right);
3586 break;
3587 case MethodRecognizer::kFloat32x4InterleaveZWPairs:
3588 __ unpckhpd(left, right);
3589 break;
3590 default: UNREACHABLE();
3591 }
3592 }
3593
3594
3595 LocationSummary* Uint32x4BoolConstructorInstr::MakeLocationSummary() const { 3584 LocationSummary* Uint32x4BoolConstructorInstr::MakeLocationSummary() const {
3596 const intptr_t kNumInputs = 4; 3585 const intptr_t kNumInputs = 4;
3597 const intptr_t kNumTemps = 1; 3586 const intptr_t kNumTemps = 1;
3598 LocationSummary* summary = 3587 LocationSummary* summary =
3599 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3588 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3600 summary->set_in(0, Location::RequiresRegister()); 3589 summary->set_in(0, Location::RequiresRegister());
3601 summary->set_in(1, Location::RequiresRegister()); 3590 summary->set_in(1, Location::RequiresRegister());
3602 summary->set_in(2, Location::RequiresRegister()); 3591 summary->set_in(2, Location::RequiresRegister());
3603 summary->set_in(3, Location::RequiresRegister()); 3592 summary->set_in(3, Location::RequiresRegister());
3604 summary->set_temp(0, Location::RequiresRegister()); 3593 summary->set_temp(0, Location::RequiresRegister());
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
4818 PcDescriptors::kOther, 4807 PcDescriptors::kOther,
4819 locs()); 4808 locs());
4820 __ Drop(2); // Discard type arguments and receiver. 4809 __ Drop(2); // Discard type arguments and receiver.
4821 } 4810 }
4822 4811
4823 } // namespace dart 4812 } // namespace dart
4824 4813
4825 #undef __ 4814 #undef __
4826 4815
4827 #endif // defined TARGET_ARCH_X64 4816 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698