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

--- Comment #3 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Note I think there is a missing scalar optimization which also leads to bad
vectorization too.

In ifcvt we have:
```
  _820 = lane$v$0_921 < _1348;
  _821 = (int) _820;
  _822 = -_821;
...
  _808 = _144 == 0;
  _809 = (int) _808;
...
  _159 = _809 * _822;
...
  _1178 = _159 == -1;
  iftmp.8_176 = _1178 ? _172 : 0.0;
```

But this should be simplified into:
```
  _820 = lane$v$0_921 < _1348;
...
  _808 = _144 == 0;
...
  _1178 = _820 & _808
...
  iftmp.8_176 = _1178 ? _172 : 0.0;
```

So one thing would be:
/* zero_one_0 * -zero_one_1 == -1 -> (zero_one_0 & zero_one_1) */
(simplify
 (eq (mult (negate zero_one_valued_p@0) zero_one_valued_p@1)
integer_minus_onep)
 (convert (bit_and @0 @1))

Though if we don't want to do that fancy then:
/* zero_one_0 * -zero_one_1 -> -(zero_one_0 & zero_one_1) */
(simplify
 (mult (negate zero_one_valued_p@0) zero_one_valued_p@1))
 (negate (bit_and @0 @1))

Would also work

Reply via email to