On Mon, May 31, 2021 at 10:21 PM Hongtao Liu via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > Hi: > This patch is about to simplify (view_convert:type ~a) < 0 to > (view_convert:type a) >= 0 when type is signed integer. Similar for > (view_convert:type ~a) >= 0. > Bootstrapped and regtested on x86_64-linux-gnu{-m32,}. > Ok for the trunk?
Why not just do instead: /* ((view_convert)~a) is just ~(view_convert)a . */ (simplify (view_convert (bit_not @0)) (if ((VECTOR_TYPE_P (type) && INTEGRAL_TYPE_P (TREE_TYPE (type))) || INTEGRAL_TYPE_P (type)) (bit_not (view_convert @0)))) And then the other patterns for converting ~a < 0 to a >= 0 should happen (if they don't add a few) (for wrapping types). Thanks, Andrew Pinski > > gcc/ChangeLog: > > PR middle-end/100738 > * match.pd ((view_convert ~a) < 0 --> (view_convert a) >= 0, > (view_convert ~a) >= 0 --> (view_convert a) < 0): New GIMPLE > simplification. > > gcc/testsuite/ChangeLog: > > PR middle-end/100738 > * g++.target/i386/avx2-pr100738-1.C: New test. > * g++.target/i386/sse4_1-pr100738-1.C: New test. > > -- > BR, > Hongtao