https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114999

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |113265

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
`X / -X is -1.` is PR 113265

```
int f(int a, int b, int x)
{
  x = a - b;
  int y = -x;
  return (x >= y ? x : y);
}
```
MAX<a, -a> -> ABS<x>

```
int f(int a, int b, int x)
{
  x = a - b;
  int y = -x;
  return (x >= y ? y : x);
}
```
MIN<a, -a> -> -ABS<x>

```
unsigned f(unsigned a, unsigned b, unsigned X, unsigned Y)
{
  X = a - b;
  unsigned t = -X;
return (X + 1) > Y ? t : 1;
}
```
// `(X + 1) > Y ? -X : 1` -> `X >= Y ? -X : 1` (unsigned)


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113265
[Bug 113265] [11/12/13/14/15 Regression] Missed optimization for redundancy
computation elimination may be due to constant propagation about 0 too late

Reply via email to