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

Side by Side Diff: runtime/vm/intermediate_language_ia32.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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 3117 matching lines...) Expand 10 before | Expand all | Expand 10 after
3128 switch (op_kind()) { 3128 switch (op_kind()) {
3129 case Token::kADD: __ addps(left, right); break; 3129 case Token::kADD: __ addps(left, right); break;
3130 case Token::kSUB: __ subps(left, right); break; 3130 case Token::kSUB: __ subps(left, right); break;
3131 case Token::kMUL: __ mulps(left, right); break; 3131 case Token::kMUL: __ mulps(left, right); break;
3132 case Token::kDIV: __ divps(left, right); break; 3132 case Token::kDIV: __ divps(left, right); break;
3133 default: UNREACHABLE(); 3133 default: UNREACHABLE();
3134 } 3134 }
3135 } 3135 }
3136 3136
3137 3137
3138 LocationSummary* Float32x4ShuffleInstr::MakeLocationSummary() const { 3138 LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary() const {
3139 const intptr_t kNumInputs = 1; 3139 const intptr_t kNumInputs = 1;
3140 const intptr_t kNumTemps = 0; 3140 const intptr_t kNumTemps = 0;
3141 LocationSummary* summary = 3141 LocationSummary* summary =
3142 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3142 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3143 summary->set_in(0, Location::RequiresFpuRegister()); 3143 summary->set_in(0, Location::RequiresFpuRegister());
3144 summary->set_out(Location::SameAsFirstInput()); 3144 summary->set_out(Location::SameAsFirstInput());
3145 return summary; 3145 return summary;
3146 } 3146 }
3147 3147
3148 3148
3149 void Float32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3149 void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3150 XmmRegister value = locs()->in(0).fpu_reg(); 3150 XmmRegister value = locs()->in(0).fpu_reg();
3151 3151
3152 ASSERT(locs()->out().fpu_reg() == value); 3152 ASSERT(locs()->out().fpu_reg() == value);
3153 3153
3154 switch (op_kind()) { 3154 switch (op_kind()) {
3155 case MethodRecognizer::kFloat32x4ShuffleX: 3155 case MethodRecognizer::kFloat32x4ShuffleX:
3156 __ shufps(value, value, Immediate(0x00)); 3156 __ shufps(value, value, Immediate(0x00));
3157 __ cvtss2sd(value, value); 3157 __ cvtss2sd(value, value);
3158 break; 3158 break;
3159 case MethodRecognizer::kFloat32x4ShuffleY: 3159 case MethodRecognizer::kFloat32x4ShuffleY:
3160 __ shufps(value, value, Immediate(0x55)); 3160 __ shufps(value, value, Immediate(0x55));
3161 __ cvtss2sd(value, value); 3161 __ cvtss2sd(value, value);
3162 break; 3162 break;
3163 case MethodRecognizer::kFloat32x4ShuffleZ: 3163 case MethodRecognizer::kFloat32x4ShuffleZ:
3164 __ shufps(value, value, Immediate(0xAA)); 3164 __ shufps(value, value, Immediate(0xAA));
3165 __ cvtss2sd(value, value); 3165 __ cvtss2sd(value, value);
3166 break; 3166 break;
3167 case MethodRecognizer::kFloat32x4ShuffleW: 3167 case MethodRecognizer::kFloat32x4ShuffleW:
3168 __ shufps(value, value, Immediate(0xFF)); 3168 __ shufps(value, value, Immediate(0xFF));
3169 __ cvtss2sd(value, value); 3169 __ cvtss2sd(value, value);
3170 break; 3170 break;
3171 case MethodRecognizer::kFloat32x4Shuffle: 3171 case MethodRecognizer::kFloat32x4Shuffle:
3172 case MethodRecognizer::kUint32x4Shuffle:
3172 __ shufps(value, value, Immediate(mask_)); 3173 __ shufps(value, value, Immediate(mask_));
3173 break; 3174 break;
3174 default: UNREACHABLE(); 3175 default: UNREACHABLE();
3175 } 3176 }
3176 } 3177 }
3177 3178
3178 3179
3180 LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary() const {
3181 const intptr_t kNumInputs = 2;
3182 const intptr_t kNumTemps = 0;
3183 LocationSummary* summary =
3184 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3185 summary->set_in(0, Location::RequiresFpuRegister());
3186 summary->set_in(1, Location::RequiresFpuRegister());
3187 summary->set_out(Location::SameAsFirstInput());
3188 return summary;
3189 }
3190
3191
3192 void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3193 XmmRegister left = locs()->in(0).fpu_reg();
3194 XmmRegister right = locs()->in(1).fpu_reg();
3195
3196 ASSERT(locs()->out().fpu_reg() == left);
3197 switch (op_kind()) {
3198 case MethodRecognizer::kFloat32x4ShuffleMix:
3199 case MethodRecognizer::kUint32x4ShuffleMix:
3200 __ shufps(left, right, Immediate(mask_));
3201 break;
3202 default: UNREACHABLE();
3203 }
3204 }
3205
3206
3179 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary() const { 3207 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary() const {
3180 const intptr_t kNumInputs = 1; 3208 const intptr_t kNumInputs = 1;
3181 const intptr_t kNumTemps = 0; 3209 const intptr_t kNumTemps = 0;
3182 LocationSummary* summary = 3210 LocationSummary* summary =
3183 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3211 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3184 summary->set_in(0, Location::RequiresFpuRegister()); 3212 summary->set_in(0, Location::RequiresFpuRegister());
3185 summary->set_out(Location::RequiresRegister()); 3213 summary->set_out(Location::RequiresRegister());
3186 return summary; 3214 return summary;
3187 } 3215 }
3188 3216
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
3530 summary->set_out(Location::SameAsFirstInput()); 3558 summary->set_out(Location::SameAsFirstInput());
3531 return summary; 3559 return summary;
3532 } 3560 }
3533 3561
3534 3562
3535 void Float32x4ToUint32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3563 void Float32x4ToUint32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3536 // NOP. 3564 // NOP.
3537 } 3565 }
3538 3566
3539 3567
3540 LocationSummary* Float32x4TwoArgShuffleInstr::MakeLocationSummary() const {
3541 const intptr_t kNumInputs = 2;
3542 const intptr_t kNumTemps = 0;
3543 LocationSummary* summary =
3544 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3545 summary->set_in(0, Location::RequiresFpuRegister());
3546 summary->set_in(1, Location::RequiresFpuRegister());
3547 summary->set_out(Location::SameAsFirstInput());
3548 return summary;
3549 }
3550
3551
3552 void Float32x4TwoArgShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3553 XmmRegister left = locs()->in(0).fpu_reg();
3554 XmmRegister right = locs()->in(1).fpu_reg();
3555
3556 ASSERT(locs()->out().fpu_reg() == left);
3557
3558 switch (op_kind()) {
3559 case MethodRecognizer::kFloat32x4WithZWInXY:
3560 __ movhlps(left, right);
3561 break;
3562 case MethodRecognizer::kFloat32x4InterleaveXY:
3563 __ unpcklps(left, right);
3564 break;
3565 case MethodRecognizer::kFloat32x4InterleaveZW:
3566 __ unpckhps(left, right);
3567 break;
3568 case MethodRecognizer::kFloat32x4InterleaveXYPairs:
3569 __ unpcklpd(left, right);
3570 break;
3571 case MethodRecognizer::kFloat32x4InterleaveZWPairs:
3572 __ unpckhpd(left, right);
3573 break;
3574 default: UNREACHABLE();
3575 }
3576 }
3577
3578
3579 LocationSummary* Uint32x4BoolConstructorInstr::MakeLocationSummary() const { 3568 LocationSummary* Uint32x4BoolConstructorInstr::MakeLocationSummary() const {
3580 const intptr_t kNumInputs = 4; 3569 const intptr_t kNumInputs = 4;
3581 const intptr_t kNumTemps = 0; 3570 const intptr_t kNumTemps = 0;
3582 LocationSummary* summary = 3571 LocationSummary* summary =
3583 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3572 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3584 summary->set_in(0, Location::RequiresRegister()); 3573 summary->set_in(0, Location::RequiresRegister());
3585 summary->set_in(1, Location::RequiresRegister()); 3574 summary->set_in(1, Location::RequiresRegister());
3586 summary->set_in(2, Location::RequiresRegister()); 3575 summary->set_in(2, Location::RequiresRegister());
3587 summary->set_in(3, Location::RequiresRegister()); 3576 summary->set_in(3, Location::RequiresRegister());
3588 summary->set_out(Location::RequiresFpuRegister()); 3577 summary->set_out(Location::RequiresFpuRegister());
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after
5185 PcDescriptors::kOther, 5174 PcDescriptors::kOther,
5186 locs()); 5175 locs());
5187 __ Drop(2); // Discard type arguments and receiver. 5176 __ Drop(2); // Discard type arguments and receiver.
5188 } 5177 }
5189 5178
5190 } // namespace dart 5179 } // namespace dart
5191 5180
5192 #undef __ 5181 #undef __
5193 5182
5194 #endif // defined TARGET_ARCH_IA32 5183 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698