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

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 3109 matching lines...) Expand 10 before | Expand all | Expand 10 after
3120 switch (op_kind()) { 3120 switch (op_kind()) {
3121 case Token::kADD: __ addps(left, right); break; 3121 case Token::kADD: __ addps(left, right); break;
3122 case Token::kSUB: __ subps(left, right); break; 3122 case Token::kSUB: __ subps(left, right); break;
3123 case Token::kMUL: __ mulps(left, right); break; 3123 case Token::kMUL: __ mulps(left, right); break;
3124 case Token::kDIV: __ divps(left, right); break; 3124 case Token::kDIV: __ divps(left, right); break;
3125 default: UNREACHABLE(); 3125 default: UNREACHABLE();
3126 } 3126 }
3127 } 3127 }
3128 3128
3129 3129
3130 LocationSummary* Float32x4ShuffleInstr::MakeLocationSummary() const { 3130 LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary() const {
3131 const intptr_t kNumInputs = 1; 3131 const intptr_t kNumInputs = 1;
3132 const intptr_t kNumTemps = 0; 3132 const intptr_t kNumTemps = 0;
3133 LocationSummary* summary = 3133 LocationSummary* summary =
3134 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3134 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3135 summary->set_in(0, Location::RequiresFpuRegister()); 3135 summary->set_in(0, Location::RequiresFpuRegister());
3136 summary->set_out(Location::SameAsFirstInput()); 3136 summary->set_out(Location::SameAsFirstInput());
3137 return summary; 3137 return summary;
3138 } 3138 }
3139 3139
3140 3140
3141 void Float32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3141 void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3142 XmmRegister value = locs()->in(0).fpu_reg(); 3142 XmmRegister value = locs()->in(0).fpu_reg();
3143 3143
3144 ASSERT(locs()->out().fpu_reg() == value); 3144 ASSERT(locs()->out().fpu_reg() == value);
3145 3145
3146 switch (op_kind()) { 3146 switch (op_kind()) {
3147 case MethodRecognizer::kFloat32x4ShuffleX: 3147 case MethodRecognizer::kFloat32x4ShuffleX:
3148 __ shufps(value, value, Immediate(0x00)); 3148 __ shufps(value, value, Immediate(0x00));
3149 __ cvtss2sd(value, value); 3149 __ cvtss2sd(value, value);
3150 break; 3150 break;
3151 case MethodRecognizer::kFloat32x4ShuffleY: 3151 case MethodRecognizer::kFloat32x4ShuffleY:
3152 __ shufps(value, value, Immediate(0x55)); 3152 __ shufps(value, value, Immediate(0x55));
3153 __ cvtss2sd(value, value); 3153 __ cvtss2sd(value, value);
3154 break; 3154 break;
3155 case MethodRecognizer::kFloat32x4ShuffleZ: 3155 case MethodRecognizer::kFloat32x4ShuffleZ:
3156 __ shufps(value, value, Immediate(0xAA)); 3156 __ shufps(value, value, Immediate(0xAA));
3157 __ cvtss2sd(value, value); 3157 __ cvtss2sd(value, value);
3158 break; 3158 break;
3159 case MethodRecognizer::kFloat32x4ShuffleW: 3159 case MethodRecognizer::kFloat32x4ShuffleW:
3160 __ shufps(value, value, Immediate(0xFF)); 3160 __ shufps(value, value, Immediate(0xFF));
3161 __ cvtss2sd(value, value); 3161 __ cvtss2sd(value, value);
3162 break; 3162 break;
3163 case MethodRecognizer::kFloat32x4Shuffle: 3163 case MethodRecognizer::kFloat32x4Shuffle:
3164 case MethodRecognizer::kUint32x4Shuffle:
3164 __ shufps(value, value, Immediate(mask_)); 3165 __ shufps(value, value, Immediate(mask_));
3165 break; 3166 break;
3166 default: UNREACHABLE(); 3167 default: UNREACHABLE();
3167 } 3168 }
3168 } 3169 }
3169 3170
3170 3171
3172 LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary() const {
3173 const intptr_t kNumInputs = 2;
3174 const intptr_t kNumTemps = 0;
3175 LocationSummary* summary =
3176 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3177 summary->set_in(0, Location::RequiresFpuRegister());
3178 summary->set_in(1, Location::RequiresFpuRegister());
3179 summary->set_out(Location::SameAsFirstInput());
3180 return summary;
3181 }
3182
3183
3184 void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3185 XmmRegister left = locs()->in(0).fpu_reg();
3186 XmmRegister right = locs()->in(1).fpu_reg();
3187
3188 ASSERT(locs()->out().fpu_reg() == left);
3189 switch (op_kind()) {
3190 case MethodRecognizer::kFloat32x4ShuffleMix:
3191 case MethodRecognizer::kUint32x4ShuffleMix:
3192 __ shufps(left, right, Immediate(mask_));
3193 break;
3194 default: UNREACHABLE();
3195 }
3196 }
3197
3198
3171 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary() const { 3199 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary() const {
3172 const intptr_t kNumInputs = 1; 3200 const intptr_t kNumInputs = 1;
3173 const intptr_t kNumTemps = 0; 3201 const intptr_t kNumTemps = 0;
3174 LocationSummary* summary = 3202 LocationSummary* summary =
3175 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3203 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3176 summary->set_in(0, Location::RequiresFpuRegister()); 3204 summary->set_in(0, Location::RequiresFpuRegister());
3177 summary->set_out(Location::RequiresRegister()); 3205 summary->set_out(Location::RequiresRegister());
3178 return summary; 3206 return summary;
3179 } 3207 }
3180 3208
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
3522 summary->set_out(Location::SameAsFirstInput()); 3550 summary->set_out(Location::SameAsFirstInput());
3523 return summary; 3551 return summary;
3524 } 3552 }
3525 3553
3526 3554
3527 void Float32x4ToUint32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3555 void Float32x4ToUint32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3528 // NOP. 3556 // NOP.
3529 } 3557 }
3530 3558
3531 3559
3532 LocationSummary* Float32x4TwoArgShuffleInstr::MakeLocationSummary() const {
3533 const intptr_t kNumInputs = 2;
3534 const intptr_t kNumTemps = 0;
3535 LocationSummary* summary =
3536 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3537 summary->set_in(0, Location::RequiresFpuRegister());
3538 summary->set_in(1, Location::RequiresFpuRegister());
3539 summary->set_out(Location::SameAsFirstInput());
3540 return summary;
3541 }
3542
3543
3544 void Float32x4TwoArgShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3545 XmmRegister left = locs()->in(0).fpu_reg();
3546 XmmRegister right = locs()->in(1).fpu_reg();
3547
3548 ASSERT(locs()->out().fpu_reg() == left);
3549
3550 switch (op_kind()) {
3551 case MethodRecognizer::kFloat32x4WithZWInXY:
3552 __ movhlps(left, right);
3553 break;
3554 case MethodRecognizer::kFloat32x4InterleaveXY:
3555 __ unpcklps(left, right);
3556 break;
3557 case MethodRecognizer::kFloat32x4InterleaveZW:
3558 __ unpckhps(left, right);
3559 break;
3560 case MethodRecognizer::kFloat32x4InterleaveXYPairs:
3561 __ unpcklpd(left, right);
3562 break;
3563 case MethodRecognizer::kFloat32x4InterleaveZWPairs:
3564 __ unpckhpd(left, right);
3565 break;
3566 default: UNREACHABLE();
3567 }
3568 }
3569
3570
3571 LocationSummary* Uint32x4BoolConstructorInstr::MakeLocationSummary() const { 3560 LocationSummary* Uint32x4BoolConstructorInstr::MakeLocationSummary() const {
3572 const intptr_t kNumInputs = 4; 3561 const intptr_t kNumInputs = 4;
3573 const intptr_t kNumTemps = 0; 3562 const intptr_t kNumTemps = 0;
3574 LocationSummary* summary = 3563 LocationSummary* summary =
3575 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3564 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3576 summary->set_in(0, Location::RequiresRegister()); 3565 summary->set_in(0, Location::RequiresRegister());
3577 summary->set_in(1, Location::RequiresRegister()); 3566 summary->set_in(1, Location::RequiresRegister());
3578 summary->set_in(2, Location::RequiresRegister()); 3567 summary->set_in(2, Location::RequiresRegister());
3579 summary->set_in(3, Location::RequiresRegister()); 3568 summary->set_in(3, Location::RequiresRegister());
3580 summary->set_out(Location::RequiresFpuRegister()); 3569 summary->set_out(Location::RequiresFpuRegister());
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after
5177 PcDescriptors::kOther, 5166 PcDescriptors::kOther,
5178 locs()); 5167 locs());
5179 __ Drop(2); // Discard type arguments and receiver. 5168 __ Drop(2); // Discard type arguments and receiver.
5180 } 5169 }
5181 5170
5182 } // namespace dart 5171 } // namespace dart
5183 5172
5184 #undef __ 5173 #undef __
5185 5174
5186 #endif // defined TARGET_ARCH_IA32 5175 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698