https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111114
--- Comment #4 from Lehua Ding <lehua.ding at rivai dot ai> --- (In reply to Andrew Pinski from comment #3) > (In reply to Lehua Ding from comment #2) > > (In reply to Andrew Pinski from comment #1) > > > There is a match pattern which handles the case where the convert (cast) > > > will fold both sides of the vec_cond now (since r14-3337-g70c50c87273d94). > > > > > > vect__5.14_56 = .MASK_LEN_LOAD (vectp_a.12_54, 8B, mask__24.11_52, _67, > > > 0); > > > > > > Is there a way to simplify that with the convert? > > > > > > Or maybe we want to it if one or the other conversion simplifies .... > > > > > > Confirmed. > > > > Thanks for the comments. Can we relax this match by removing the modifier > > "!"? > > I don't think so as we want to make sure we don't replace one operation > happening with 2. The check really should be if one side will fold. > > We can special case VECTOR_CST here knowing that the convert will fold the > CST always. > So something like: > ``` > (simplify > (convert (vec_cond:s @0 @1 @2)) > (if (VECTOR_TYPE_P (type) > && types_match (TREE_TYPE (@0), truth_type_for (type))) > (if (TREE_CODE (@1) == VECTOR_CST || TREE_CODE (@2) == VECTOR_CST) > (vec_cond @0 (convert @1) (convert @2) > (vec_cond @0 (convert! @1) (convert! @2))))) > ``` > We should do a similar trick to both the unary operator and view_convert too. Just to double check, are you saying something like the bellow? But I don't feel like the purpose is quite the same though. The match here was supposed to remove the CONVERT operation. Whereas I was hoping to reverse the order in order to combine them. ``` (simplify (convert (vec_cond:s @0 @1 @2)) (if (VECTOR_TYPE_P (type) && types_match (TREE_TYPE (@0), truth_type_for (type)) && (TREE_CODE (@1) == VECTOR_CST || TREE_CODE (@2) == VECTOR_CST)) (vec_cond @0 (convert @1) (convert @2)))) ```