881 return NULL; // No progress
882 }
883
884 //------------------------------Identity---------------------------------------
885 // If stride == 1 return limit node.
886 Node *LoopLimitNode::Identity( PhaseTransform *phase ) {
887 int stride_con = phase->type(in(Stride))->is_int()->get_con();
888 if (stride_con == 1 || stride_con == -1)
889 return in(Limit);
890 return this;
891 }
892
893 //=============================================================================
894 //----------------------match_incr_with_optional_truncation--------------------
895 // Match increment with optional truncation:
896 // CHAR: (i+1)&0x7fff, BYTE: ((i+1)<<8)>>8, or SHORT: ((i+1)<<16)>>16
897 // Return NULL for failure. Success returns the increment node.
898 Node* CountedLoopNode::match_incr_with_optional_truncation(
899 Node* expr, Node** trunc1, Node** trunc2, const TypeInt** trunc_type) {
900 // Quick cutouts:
901 if (expr == NULL || expr->req() != 3) return false;
902
903 Node *t1 = NULL;
904 Node *t2 = NULL;
905 const TypeInt* trunc_t = TypeInt::INT;
906 Node* n1 = expr;
907 int n1op = n1->Opcode();
908
909 // Try to strip (n1 & M) or (n1 << N >> N) from n1.
910 if (n1op == Op_AndI &&
911 n1->in(2)->is_Con() &&
912 n1->in(2)->bottom_type()->is_int()->get_con() == 0x7fff) {
913 // %%% This check should match any mask of 2**K-1.
914 t1 = n1;
915 n1 = t1->in(1);
916 n1op = n1->Opcode();
917 trunc_t = TypeInt::CHAR;
918 } else if (n1op == Op_RShiftI &&
919 n1->in(1) != NULL &&
920 n1->in(1)->Opcode() == Op_LShiftI &&
921 n1->in(2) == n1->in(1)->in(2) &&
|
881 return NULL; // No progress
882 }
883
884 //------------------------------Identity---------------------------------------
885 // If stride == 1 return limit node.
886 Node *LoopLimitNode::Identity( PhaseTransform *phase ) {
887 int stride_con = phase->type(in(Stride))->is_int()->get_con();
888 if (stride_con == 1 || stride_con == -1)
889 return in(Limit);
890 return this;
891 }
892
893 //=============================================================================
894 //----------------------match_incr_with_optional_truncation--------------------
895 // Match increment with optional truncation:
896 // CHAR: (i+1)&0x7fff, BYTE: ((i+1)<<8)>>8, or SHORT: ((i+1)<<16)>>16
897 // Return NULL for failure. Success returns the increment node.
898 Node* CountedLoopNode::match_incr_with_optional_truncation(
899 Node* expr, Node** trunc1, Node** trunc2, const TypeInt** trunc_type) {
900 // Quick cutouts:
901 if (expr == NULL || expr->req() != 3) return NULL;
902
903 Node *t1 = NULL;
904 Node *t2 = NULL;
905 const TypeInt* trunc_t = TypeInt::INT;
906 Node* n1 = expr;
907 int n1op = n1->Opcode();
908
909 // Try to strip (n1 & M) or (n1 << N >> N) from n1.
910 if (n1op == Op_AndI &&
911 n1->in(2)->is_Con() &&
912 n1->in(2)->bottom_type()->is_int()->get_con() == 0x7fff) {
913 // %%% This check should match any mask of 2**K-1.
914 t1 = n1;
915 n1 = t1->in(1);
916 n1op = n1->Opcode();
917 trunc_t = TypeInt::CHAR;
918 } else if (n1op == Op_RShiftI &&
919 n1->in(1) != NULL &&
920 n1->in(1)->Opcode() == Op_LShiftI &&
921 n1->in(2) == n1->in(1)->in(2) &&
|