https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69619
--- Comment #2 from Wilco <wdijkstr at arm dot com> --- Changing to c = 3 generates code after a short time. The issue is recursive calls to expand_ccmp_expr during the 2 possible options tried to determine costs. That makes the algorithm exponential. A fix would be to expand the LHS and RHS of both gs0 and gs1 in expand_ccmp_expr_1 (and not in gen_ccmp_first) as these expansions will be identical no matter what order we choose to expand gs0 and gs1 in. It's not clear how easy that can be achieved using the existing interfaces though.