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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like I only implemented this for do_store_flag which is good but it needs
to also implemented for do_jump too.

Take:
```
#define bool _Bool
bool j(void);
bool h(void);
bool f(bool a, bool b)
{
    if(a<b) return h();
    return j();
}
bool g(bool a, bool b)
{
  if (!a & b) return h();
  return j();
}
bool fi(signed char a, signed char b)
{
  if (a!=0&&a!=1) __builtin_unreachable();
  if (b!=0&&b!=1) __builtin_unreachable();
    if(a<b) return h();
    return j();
}
bool gi(signed char a, signed char b)
{
  if (a!=0&&a!=1) __builtin_unreachable();
  if (b!=0&&b!=1) __builtin_unreachable();
  if (!a & b) return h();
  return j();
}
```

on aarch64, we want f and g, and f and gi to produce the same code. But
currently only g and gi produce the best code of:
```
        bic     x0, x1, x0
        tbnz    x0, 0, .L13
```

It is even more interesting on x86, g produces two jumps while f and g produces
the best code:
```
        cmpb    %sil, %dil
        jb      .L4
```

Reply via email to