[Bug middle-end/88784] Middle end is missing some optimizations about unsigned

2019-05-06 Thread ffengqi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88784 Qi Feng changed: What|Removed |Added CC||ffengqi at gcc dot gnu.org --- Comment #2

[Bug middle-end/88784] Middle end is missing some optimizations about unsigned

2019-05-21 Thread ffengqi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88784 --- Comment #3 from Qi Feng --- I have extended the transformations as following, the first five are the original ones: * unsigned Use UINT_MAX for demonstration, similar for UCHAR_MAX, USHRT_MAX, UINT_MAX, ULONG_MAX, ULLONG_MAX x > y

[Bug middle-end/88784] Middle end is missing some optimizations about unsigned

2019-05-22 Thread ffengqi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88784 --- Comment #4 from Qi Feng --- The fourth to the last should be: x < y || x != INT_MAX --> x != UINT_MAX sorry for the typo.

[Bug middle-end/88784] Middle end is missing some optimizations about unsigned

2019-05-22 Thread ffengqi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88784 --- Comment #5 from Qi Feng --- (In reply to Qi Feng from comment #4) > The fourth to the last should be: > > x < y || x != INT_MAX --> x != UINT_MAX > > sorry for the typo. x < y || x != INT_MAX --> x != INT_MAX ty

[Bug middle-end/88784] Middle end is missing some optimizations about unsigned

2019-05-22 Thread ffengqi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88784 --- Comment #7 from Qi Feng --- I add some patterns in match.pd which handles the original 5 transformations. But I don't the language used in match.pd well, the patterns I wrote are very similar. And I haven't found predicates for constant valu

[Bug middle-end/88784] Middle end is missing some optimizations about unsigned

2019-05-22 Thread ffengqi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88784 --- Comment #9 from Qi Feng --- And there's another problem. Take `x > y && x != 0 --> x > y' for example, I would also like to do x < y && y != 0 --> x < y x != 0 && x > y --> x > y y != 0 && x < y --> x < y If t

[Bug middle-end/88784] Middle end is missing some optimizations about unsigned

2019-05-23 Thread ffengqi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88784 --- Comment #11 from Qi Feng --- I tried 2 patterns for the following test /* 1. x > y && x != 0 --> x > y */ /* 2. y < x && x != 0 --> y < x */ /* 3. x != 0 && x > y --> x > y */ /* 4. x != 0 && y <

[Bug middle-end/88784] Middle end is missing some optimizations about unsigned

2019-05-24 Thread ffengqi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88784 --- Comment #14 from Qi Feng --- Checking .original and .optimized file is just a quick method I use to check whether an optimization happened (if not happen in first and last pass, probably it didn't happen). I didn't mean or think the transfor

[Bug middle-end/88784] Middle end is missing some optimizations about unsigned

2019-05-26 Thread ffengqi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88784 --- Comment #18 from Qi Feng --- I only learned gcc for about 2 months, and I have to say that I don't fully understand what you guys were saying. Is match.pd the right place to fix this issue? Am I in the wrong direction?

[Bug middle-end/88784] Middle end is missing some optimizations about unsigned

2019-05-30 Thread ffengqi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88784 --- Comment #20 from Qi Feng --- I have tried to merge signed and unsigned together: /* x > y && x != ( 0 or XXX_MIN ) --> x > y */ (for and (truth_and bit_and) (simplify (and:c (gt:c@3 @0 @1) (ne @0 INTEGER_CST@2)) (if (INTEGRAL_T

[Bug middle-end/88784] Middle end is missing some optimizations about unsigned

2019-06-04 Thread ffengqi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88784 --- Comment #22 from Qi Feng --- Two more similar ones: x <= y && x == ( 0 or XXX_MIN ) --> x == ( 0 or XXX_MIN ) x >= y && x == ( UXXX_MAX or XXX_MAX ) --> x == ( UXXX_MAX or XXX_MAX )