[Bug tree-optimization/112752] `~a - MIN<MIN<~a, ~b>, ~c>` is not optimized to `MAX<MAX<a,b>,c> - a`
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Nov 28 23:01:02 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112752
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
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.
More information about the Gcc-bugs
mailing list