3791 } else if (mNode2->_rChild) {
3792 return false; // I have NULL right child, mNode2 has non-NULL right child.
3793 }
3794
3795 // We've made it through the gauntlet.
3796 return true;
3797 }
3798
3799 //-------------------------- has_commutative_op -------------------------------
3800 // Recursively check for commutative operations with subtree operands
3801 // which could be swapped.
3802 void MatchNode::count_commutative_op(int& count) {
3803 static const char *commut_op_list[] = {
3804 "AddI","AddL","AddF","AddD",
3805 "AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
3806 "AndI","AndL",
3807 "AndV",
3808 "MaxI","MinI","MaxF","MinF","MaxD","MinD",
3809 "MaxV", "MinV",
3810 "MulI","MulL","MulF","MulD",
3811 "MulVS","MulVI","MulVL","MulVF","MulVD",
3812 "OrI","OrL",
3813 "OrV",
3814 "XorI","XorL",
3815 "XorV"
3816 };
3817 int cnt = sizeof(commut_op_list)/sizeof(char*);
3818
3819 if( _lChild && _rChild && (_lChild->_lChild || _rChild->_lChild) ) {
3820 // Don't swap if right operand is an immediate constant.
3821 bool is_const = false;
3822 if( _rChild->_lChild == NULL && _rChild->_rChild == NULL ) {
3823 FormDict &globals = _AD.globalNames();
3824 const Form *form = globals[_rChild->_opType];
3825 if ( form ) {
3826 OperandForm *oper = form->is_operand();
3827 if( oper && oper->interface_type(globals) == Form::constant_interface )
3828 is_const = true;
3829 }
3830 }
3831 if( !is_const ) {
4158 }
4159 return false;
4160 }
4161
4162
4163 Form::DataType MatchRule::is_ideal_load() const {
4164 Form::DataType ideal_load = Form::none;
4165
4166 if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
4167 const char *opType = _rChild->_opType;
4168 ideal_load = is_load_from_memory(opType);
4169 }
4170
4171 return ideal_load;
4172 }
4173
4174 bool MatchRule::is_vector() const {
4175 static const char *vector_list[] = {
4176 "AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
4177 "SubVB","SubVS","SubVI","SubVL","SubVF","SubVD",
4178 "MulVS","MulVI","MulVL","MulVF","MulVD",
4179 "CMoveVD", "CMoveVF",
4180 "DivVF","DivVD",
4181 "AbsVF","AbsVD",
4182 "NegVF","NegVD",
4183 "SqrtVD","SqrtVF",
4184 "AndV" ,"XorV" ,"OrV",
4185 "MaxV", "MinV",
4186 "AddReductionVI", "AddReductionVL",
4187 "AddReductionVF", "AddReductionVD",
4188 "MulReductionVI", "MulReductionVL",
4189 "MulReductionVF", "MulReductionVD",
4190 "MulAddVS2VI",
4191 "LShiftCntV","RShiftCntV",
4192 "LShiftVB","LShiftVS","LShiftVI","LShiftVL",
4193 "RShiftVB","RShiftVS","RShiftVI","RShiftVL",
4194 "URShiftVB","URShiftVS","URShiftVI","URShiftVL",
4195 "MaxReductionV", "MinReductionV",
4196 "ReplicateB","ReplicateS","ReplicateI","ReplicateL","ReplicateF","ReplicateD",
4197 "LoadVector","StoreVector",
4198 "FmaVD", "FmaVF","PopCountVI",
4199 // Next are not supported currently.
4200 "PackB","PackS","PackI","PackL","PackF","PackD","Pack2L","Pack2D",
4201 "ExtractB","ExtractUB","ExtractC","ExtractS","ExtractI","ExtractL","ExtractF","ExtractD"
|
3791 } else if (mNode2->_rChild) {
3792 return false; // I have NULL right child, mNode2 has non-NULL right child.
3793 }
3794
3795 // We've made it through the gauntlet.
3796 return true;
3797 }
3798
3799 //-------------------------- has_commutative_op -------------------------------
3800 // Recursively check for commutative operations with subtree operands
3801 // which could be swapped.
3802 void MatchNode::count_commutative_op(int& count) {
3803 static const char *commut_op_list[] = {
3804 "AddI","AddL","AddF","AddD",
3805 "AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
3806 "AndI","AndL",
3807 "AndV",
3808 "MaxI","MinI","MaxF","MinF","MaxD","MinD",
3809 "MaxV", "MinV",
3810 "MulI","MulL","MulF","MulD",
3811 "MulVB","MulVS","MulVI","MulVL","MulVF","MulVD",
3812 "OrI","OrL",
3813 "OrV",
3814 "XorI","XorL",
3815 "XorV"
3816 };
3817 int cnt = sizeof(commut_op_list)/sizeof(char*);
3818
3819 if( _lChild && _rChild && (_lChild->_lChild || _rChild->_lChild) ) {
3820 // Don't swap if right operand is an immediate constant.
3821 bool is_const = false;
3822 if( _rChild->_lChild == NULL && _rChild->_rChild == NULL ) {
3823 FormDict &globals = _AD.globalNames();
3824 const Form *form = globals[_rChild->_opType];
3825 if ( form ) {
3826 OperandForm *oper = form->is_operand();
3827 if( oper && oper->interface_type(globals) == Form::constant_interface )
3828 is_const = true;
3829 }
3830 }
3831 if( !is_const ) {
4158 }
4159 return false;
4160 }
4161
4162
4163 Form::DataType MatchRule::is_ideal_load() const {
4164 Form::DataType ideal_load = Form::none;
4165
4166 if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
4167 const char *opType = _rChild->_opType;
4168 ideal_load = is_load_from_memory(opType);
4169 }
4170
4171 return ideal_load;
4172 }
4173
4174 bool MatchRule::is_vector() const {
4175 static const char *vector_list[] = {
4176 "AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
4177 "SubVB","SubVS","SubVI","SubVL","SubVF","SubVD",
4178 "MulVB","MulVS","MulVI","MulVL","MulVF","MulVD",
4179 "CMoveVD", "CMoveVF",
4180 "DivVF","DivVD",
4181 "AbsVB","AbsVS","AbsVI","AbsVL","AbsVF","AbsVD",
4182 "NegVF","NegVD",
4183 "SqrtVD","SqrtVF",
4184 "AndV" ,"XorV" ,"OrV",
4185 "MaxV", "MinV",
4186 "AddReductionVI", "AddReductionVL",
4187 "AddReductionVF", "AddReductionVD",
4188 "MulReductionVI", "MulReductionVL",
4189 "MulReductionVF", "MulReductionVD",
4190 "MulAddVS2VI",
4191 "LShiftCntV","RShiftCntV",
4192 "LShiftVB","LShiftVS","LShiftVI","LShiftVL",
4193 "RShiftVB","RShiftVS","RShiftVI","RShiftVL",
4194 "URShiftVB","URShiftVS","URShiftVI","URShiftVL",
4195 "MaxReductionV", "MinReductionV",
4196 "ReplicateB","ReplicateS","ReplicateI","ReplicateL","ReplicateF","ReplicateD",
4197 "LoadVector","StoreVector",
4198 "FmaVD", "FmaVF","PopCountVI",
4199 // Next are not supported currently.
4200 "PackB","PackS","PackI","PackL","PackF","PackD","Pack2L","Pack2D",
4201 "ExtractB","ExtractUB","ExtractC","ExtractS","ExtractI","ExtractL","ExtractF","ExtractD"
|