[Bug target/106724] logical-op-non-short-circuit maybe should be 1

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Aug 23 15:42:11 GMT 2022


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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Well branch cost should be more tuned too.
Here is an example where BRANCH_COST=4 is needed to get one branch:
```
int g(void);

int f(int a, int b, int c, int d)
{
  if (a > b && c > d)
    return g();
  return 1;
}

```


Note clang/LLVM produces much worse code (two xori which are not needed).


More information about the Gcc-bugs mailing list