https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50856
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|target |tree-optimization Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This is a generic issue and not really arm related. In phiopt4 for absolute_difference1 we have: _14 = (int) b_7(D); _12 = (int) a_6(D); if (a_6(D) > b_7(D)) goto <bb 3>; [50.00%] else goto <bb 4>; [50.00%] <bb 3> [local count: 536870913]: iftmp.0_9 = _12 - _14; goto <bb 5>; [100.00%] <bb 4> [local count: 536870913]: iftmp.0_8 = _14 - _12; <bb 5> [local count: 1073741824]: # iftmp.0_5 = PHI <iftmp.0_9(3), iftmp.0_8(4)> While for absolute_difference2 we have in phiopt1 tmp_4 = (int) a_3(D); _1 = (int) b_5(D); tmp_6 = tmp_4 - _1; if (tmp_6 < 0) goto <bb 3>; [INV] else goto <bb 4>; [INV] <bb 3> : tmp_8 = _1 - tmp_4; <bb 4> : # tmp_2 = PHI <tmp_6(2), tmp_8(3)> absolute_difference2 is easier to handle, let me try to handle both cases/ The second case we have: (a - b) < 0 ? (b - a) : (a - b) Or: (cond (lt (minus@0 @1 @2) zero_p) (minus @2 @1) @0) The first case we have is more complex.