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

            Bug ID: 126043
           Summary: early phiopt should allow CMP, (cast)CMP, -(cast)CMP
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
            Blocks: 125672
  Target Milestone: ---

As mentioned here:
https://gcc.gnu.org/pipermail/gcc-patches/2026-June/721843.html

This will allow us to correctly prop the comparison instead of depending on
jump threading.

An example is:
```
void
f (float a, float b, float c, float d,
   int x0, int y0, int x1, int y1,
   int u0, int v0, int u1, int v1, int *o)
{
  int m0 = (a > b) ? -1 : 0;
  int m1 = (c > d) ? -1 : 0;
  o[0] = (m0 == -1) ? x0 : y0;
  o[1] = (m1 == -1) ? x1 : y1;
  o[2] = (m0 == -1) ? u0 : v0;
  o[3] = (m1 == -1) ? u1 : v1;
}
```


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125672
[Bug 125672] Jump threading hurts conditional select formation

Reply via email to