On Mon, Mar 03, 2025 at 12:20:00PM +0000, Richard Sandiford wrote: > I think we should instead go back to punting on comparisons whose inputs > are CC modes, as we did (indirectly, via comparison_code_valid_for_mode) > before r15-6777. Sorry, I'd forgotten/hadn't thought to exclude CC modes > explicitly when removing that function.
I believe that is not what was the case before r15-6777. We punted simply because comparison_to_mask returned for GE 6, for LT it returned 8, 6 | 8 is not 15, no optimization. There wasn't this all = 14 vs. 15 thing. comparison_code_valid_for_mode is actually checking mode which is the mode in which IOR is performed, e.g. SImode in the testcase. So, do you want a simpler if (GET_MODE (XEXP (op0, 0)) == MODE_CC || HONOR_NANS (GET_MODE (XEXP (op0, 0)))) all = 15; or if ((!INTEGRAL_MODE_P (GET_MODE (XEXP (op0, 0))) && !FLOAT_MODE_P (GET_MODE (XEXP (op0, 0))) && !VECTOR_MODE_P (GET_MODE (XEXP (op0, 0)))) || HONOR_NANS (GET_MODE (XEXP (op0, 0)))) all = 15; or something else? Jakub