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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So this is not handled by
https://gcc.gnu.org/pipermail/gcc-patches/2025-July/689515.html because we
don't handle PLUS_EXPR matching with MINUS_EXPR.

It should not be handle to expand to handle that case here too.
```
  if (b_9 < 1.0e+1)
    goto <bb 4>; [50.00%]
  else
    goto <bb 5>; [50.00%]

  <bb 4> [local count: 531502204]:
  a_11 = b_9 + a_15;
  goto <bb 6>; [100.00%]

  <bb 5> [local count: 531502204]:
  a_10 = a_15 - b_9;

  <bb 6> [local count: 1063004408]:
  # a_4 = PHI <a_11(4), a_10(5)>
```

Basically in factor_out_operators, you need to handle the case where
`arg1_op.code != arg0_op.code` and one is MINUS_EXPR and the other is
PLUS_EXPR. (FMA vs FMS too I think). And then you have the MINUS_EXPR turn
itself into a PLUS_EXPR with an additional statement for the NEGATE_EXPR. For
types which have undefined overflow, you need to convert to unsigned first and
for FLOAT types I think this can only be done for !rounding_math .

Reply via email to