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

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

Issue 24240020: Cleanup bit casting methods between SIMD types (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months 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/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 return true; 2176 return true;
2177 } else if (recognized_kind == MethodRecognizer::kFloat32x4Constructor) { 2177 } else if (recognized_kind == MethodRecognizer::kFloat32x4Constructor) {
2178 Float32x4ConstructorInstr* con = 2178 Float32x4ConstructorInstr* con =
2179 new Float32x4ConstructorInstr(new Value(call->ArgumentAt(1)), 2179 new Float32x4ConstructorInstr(new Value(call->ArgumentAt(1)),
2180 new Value(call->ArgumentAt(2)), 2180 new Value(call->ArgumentAt(2)),
2181 new Value(call->ArgumentAt(3)), 2181 new Value(call->ArgumentAt(3)),
2182 new Value(call->ArgumentAt(4)), 2182 new Value(call->ArgumentAt(4)),
2183 call->deopt_id()); 2183 call->deopt_id());
2184 ReplaceCall(call, con); 2184 ReplaceCall(call, con);
2185 return true; 2185 return true;
2186 } else if (recognized_kind == MethodRecognizer::kFloat32x4Uint32x4Bits) {
zra 2013/09/24 00:29:09 It's a little confusing that Float32x4 and Uint32x
Cutch 2013/09/24 16:00:05 I have cleaned up the MethodRecognizer name to be
2187 Uint32x4ToFloat32x4Instr* cast =
2188 new Uint32x4ToFloat32x4Instr(new Value(call->ArgumentAt(1)),
zra 2013/09/24 00:29:09 I guess you'd have to rename this to Float32x4From
2189 call->deopt_id());
2190 ReplaceCall(call, cast);
2191 return true;
2186 } 2192 }
2187 return false; 2193 return false;
2188 } 2194 }
2189 2195
2190 2196
2191 bool FlowGraphOptimizer::TryInlineUint32x4Constructor( 2197 bool FlowGraphOptimizer::TryInlineUint32x4Constructor(
2192 StaticCallInstr* call, 2198 StaticCallInstr* call,
2193 MethodRecognizer::Kind recognized_kind) { 2199 MethodRecognizer::Kind recognized_kind) {
2194 if (!ShouldInlineSimd()) { 2200 if (!ShouldInlineSimd()) {
2195 return false; 2201 return false;
2196 } 2202 }
2197 if (recognized_kind == MethodRecognizer::kUint32x4BoolConstructor) { 2203 if (recognized_kind == MethodRecognizer::kUint32x4BoolConstructor) {
2198 Uint32x4BoolConstructorInstr* con = new Uint32x4BoolConstructorInstr( 2204 Uint32x4BoolConstructorInstr* con = new Uint32x4BoolConstructorInstr(
2199 new Value(call->ArgumentAt(1)), 2205 new Value(call->ArgumentAt(1)),
2200 new Value(call->ArgumentAt(2)), 2206 new Value(call->ArgumentAt(2)),
2201 new Value(call->ArgumentAt(3)), 2207 new Value(call->ArgumentAt(3)),
2202 new Value(call->ArgumentAt(4)), 2208 new Value(call->ArgumentAt(4)),
2203 call->deopt_id()); 2209 call->deopt_id());
2204 ReplaceCall(call, con); 2210 ReplaceCall(call, con);
2205 return true; 2211 return true;
2212 } else if (recognized_kind == MethodRecognizer::kUint32x4Float32x4Bits) {
zra 2013/09/24 00:29:09 Similar here.
2213 Float32x4ToUint32x4Instr* cast =
2214 new Float32x4ToUint32x4Instr(new Value(call->ArgumentAt(1)),
2215 call->deopt_id());
2216 ReplaceCall(call, cast);
2217 return true;
2206 } 2218 }
2207 return false; 2219 return false;
2208 } 2220 }
2209 2221
2210 2222
2211 bool FlowGraphOptimizer::TryInlineFloat32x4Method( 2223 bool FlowGraphOptimizer::TryInlineFloat32x4Method(
2212 InstanceCallInstr* call, 2224 InstanceCallInstr* call,
2213 MethodRecognizer::Kind recognized_kind) { 2225 MethodRecognizer::Kind recognized_kind) {
2214 if (!ShouldInlineSimd()) { 2226 if (!ShouldInlineSimd()) {
2215 return false; 2227 return false;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 call->deopt_id(), 2378 call->deopt_id(),
2367 call->env(), 2379 call->env(),
2368 call); 2380 call);
2369 Float32x4ClampInstr* clamp = new Float32x4ClampInstr(new Value(left), 2381 Float32x4ClampInstr* clamp = new Float32x4ClampInstr(new Value(left),
2370 new Value(lower), 2382 new Value(lower),
2371 new Value(upper), 2383 new Value(upper),
2372 call->deopt_id()); 2384 call->deopt_id());
2373 ReplaceCall(call, clamp); 2385 ReplaceCall(call, clamp);
2374 return true; 2386 return true;
2375 } 2387 }
2376 case MethodRecognizer::kFloat32x4ToUint32x4: {
2377 Definition* left = call->ArgumentAt(0);
2378 // Type check left.
2379 AddCheckClass(left,
2380 ICData::ZoneHandle(
2381 call->ic_data()->AsUnaryClassChecksForArgNr(0)),
2382 call->deopt_id(),
2383 call->env(),
2384 call);
2385 Float32x4ToUint32x4Instr* cast =
2386 new Float32x4ToUint32x4Instr(new Value(left), call->deopt_id());
2387 ReplaceCall(call, cast);
2388 return true;
2389 }
2390 case MethodRecognizer::kFloat32x4Shuffle: { 2388 case MethodRecognizer::kFloat32x4Shuffle: {
2391 return InlineFloat32x4Getter(call, recognized_kind); 2389 return InlineFloat32x4Getter(call, recognized_kind);
2392 } 2390 }
2393 default: 2391 default:
2394 return false; 2392 return false;
2395 } 2393 }
2396 } 2394 }
2397 2395
2398 2396
2399 bool FlowGraphOptimizer::TryInlineUint32x4Method( 2397 bool FlowGraphOptimizer::TryInlineUint32x4Method(
(...skipping 25 matching lines...) Expand all
2425 call->env(), 2423 call->env(),
2426 call); 2424 call);
2427 Uint32x4SelectInstr* select = new Uint32x4SelectInstr( 2425 Uint32x4SelectInstr* select = new Uint32x4SelectInstr(
2428 new Value(mask), 2426 new Value(mask),
2429 new Value(trueValue), 2427 new Value(trueValue),
2430 new Value(falseValue), 2428 new Value(falseValue),
2431 call->deopt_id()); 2429 call->deopt_id());
2432 ReplaceCall(call, select); 2430 ReplaceCall(call, select);
2433 return true; 2431 return true;
2434 } 2432 }
2435 case MethodRecognizer::kUint32x4ToUint32x4: {
2436 Definition* left = call->ArgumentAt(0);
2437 // Type check left.
2438 AddCheckClass(left,
2439 ICData::ZoneHandle(
2440 call->ic_data()->AsUnaryClassChecksForArgNr(0)),
2441 call->deopt_id(),
2442 call->env(),
2443 call);
2444 Uint32x4ToFloat32x4Instr* cast =
2445 new Uint32x4ToFloat32x4Instr(new Value(left), call->deopt_id());
2446 ReplaceCall(call, cast);
2447 return true;
2448 }
2449 case MethodRecognizer::kUint32x4WithFlagX: 2433 case MethodRecognizer::kUint32x4WithFlagX:
2450 case MethodRecognizer::kUint32x4WithFlagY: 2434 case MethodRecognizer::kUint32x4WithFlagY:
2451 case MethodRecognizer::kUint32x4WithFlagZ: 2435 case MethodRecognizer::kUint32x4WithFlagZ:
2452 case MethodRecognizer::kUint32x4WithFlagW: { 2436 case MethodRecognizer::kUint32x4WithFlagW: {
2453 Definition* left = call->ArgumentAt(0); 2437 Definition* left = call->ArgumentAt(0);
2454 Definition* flag = call->ArgumentAt(1); 2438 Definition* flag = call->ArgumentAt(1);
2455 // Type check left. 2439 // Type check left.
2456 AddCheckClass(left, 2440 AddCheckClass(left,
2457 ICData::ZoneHandle( 2441 ICData::ZoneHandle(
2458 call->ic_data()->AsUnaryClassChecksForArgNr(0)), 2442 call->ic_data()->AsUnaryClassChecksForArgNr(0)),
(...skipping 5194 matching lines...) Expand 10 before | Expand all | Expand 10 after
7653 } 7637 }
7654 7638
7655 // Insert materializations at environment uses. 7639 // Insert materializations at environment uses.
7656 for (intptr_t i = 0; i < exits.length(); i++) { 7640 for (intptr_t i = 0; i < exits.length(); i++) {
7657 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); 7641 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields);
7658 } 7642 }
7659 } 7643 }
7660 7644
7661 7645
7662 } // namespace dart 7646 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698