[Bug tree-optimization/112752] `~a - MIN, ~c>` is not optimized to `MAX,c> - a`
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112752 --- Comment #2 from Andrew Pinski --- Here is a semi-reduced testcase: ``` #define byte unsigned char #define MIN(a, b) ((a) > (b)?(b):(a)) byte hh(byte r, byte g, byte b) { byte c = 255 - r; byte m = 255 - g; byte y = 255 - b; byte tmp = MIN(m, y); byte k = MIN(c, tmp); return m - k; } ``` Note matching this directly, the above might not fix the original testcase.
[Bug tree-optimization/112752] `~a - MIN, ~c>` is not optimized to `MAX,c> - a`
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112752 --- Comment #1 from Andrew Pinski --- I made a small mistake into what it should be optimized to: The MIN should be MAX (oops): that is: tmp = MAX(r, g); k = MAX(b, tmp);