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

            Bug ID: 122880
           Summary: cmov with neg (or csinv) is not produced instead a
                    mult is produced
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
            Blocks: 122837
  Target Milestone: ---

Take:
```
int f(int a, int b, int c)
{
  int t = 1;
  if (a != b)
    t = -1;
  c+=a;
  return c*t;
}
```

This is the 1/-1 mult issue from PR 122837.

There should be no multiply here but rather a conditional move with a neg (or
in the case of aarch64 csinv)


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122837
[Bug 122837] Suboptimal codegen for std::midpoint

Reply via email to