comparison src/share/vm/opto/matcher.cpp @ 4761:65149e74c706

7121648: Use 3-operands SIMD instructions on x86 with AVX Summary: Use 3-operands SIMD instructions in C2 generated code for machines with AVX. Reviewed-by: never
author kvn
date Tue, 20 Dec 2011 00:55:02 -0800
parents 670a74b863fc
children 8c92982cbbc4
comparison
equal deleted inserted replaced
4760:669f6a7d5b70 4761:65149e74c706
1363 // as part of the current match tree. 1363 // as part of the current match tree.
1364 static bool match_into_reg( const Node *n, Node *m, Node *control, int i, bool shared ) { 1364 static bool match_into_reg( const Node *n, Node *m, Node *control, int i, bool shared ) {
1365 1365
1366 const Type *t = m->bottom_type(); 1366 const Type *t = m->bottom_type();
1367 1367
1368 if( t->singleton() ) { 1368 if (t->singleton()) {
1369 // Never force constants into registers. Allow them to match as 1369 // Never force constants into registers. Allow them to match as
1370 // constants or registers. Copies of the same value will share 1370 // constants or registers. Copies of the same value will share
1371 // the same register. See find_shared_node. 1371 // the same register. See find_shared_node.
1372 return false; 1372 return false;
1373 } else { // Not a constant 1373 } else { // Not a constant
1374 // Stop recursion if they have different Controls. 1374 // Stop recursion if they have different Controls.
1375 // Slot 0 of constants is not really a Control. 1375 Node* m_control = m->in(0);
1376 if( control && m->in(0) && control != m->in(0) ) { 1376 // Control of load's memory can post-dominates load's control.
1377 // So use it since load can't float above its memory.
1378 Node* mem_control = (m->is_Load()) ? m->in(MemNode::Memory)->in(0) : NULL;
1379 if (control && m_control && control != m_control && control != mem_control) {
1377 1380
1378 // Actually, we can live with the most conservative control we 1381 // Actually, we can live with the most conservative control we
1379 // find, if it post-dominates the others. This allows us to 1382 // find, if it post-dominates the others. This allows us to
1380 // pick up load/op/store trees where the load can float a little 1383 // pick up load/op/store trees where the load can float a little
1381 // above the store. 1384 // above the store.
1382 Node *x = control; 1385 Node *x = control;
1383 const uint max_scan = 6; // Arbitrary scan cutoff 1386 const uint max_scan = 6; // Arbitrary scan cutoff
1384 uint j; 1387 uint j;
1385 for( j=0; j<max_scan; j++ ) { 1388 for (j=0; j<max_scan; j++) {
1386 if( x->is_Region() ) // Bail out at merge points 1389 if (x->is_Region()) // Bail out at merge points
1387 return true; 1390 return true;
1388 x = x->in(0); 1391 x = x->in(0);
1389 if( x == m->in(0) ) // Does 'control' post-dominate 1392 if (x == m_control) // Does 'control' post-dominate
1390 break; // m->in(0)? If so, we can use it 1393 break; // m->in(0)? If so, we can use it
1391 } 1394 if (x == mem_control) // Does 'control' post-dominate
1392 if( j == max_scan ) // No post-domination before scan end? 1395 break; // mem_control? If so, we can use it
1396 }
1397 if (j == max_scan) // No post-domination before scan end?
1393 return true; // Then break the match tree up 1398 return true; // Then break the match tree up
1394 } 1399 }
1395 if (m->is_DecodeN() && Matcher::narrow_oop_use_complex_address()) { 1400 if (m->is_DecodeN() && Matcher::narrow_oop_use_complex_address()) {
1396 // These are commonly used in address expressions and can 1401 // These are commonly used in address expressions and can
1397 // efficiently fold into them on X64 in some cases. 1402 // efficiently fold into them on X64 in some cases.