Hi! On Wed, Nov 14, 2018 at 09:35:30AM -0700, Jeff Law wrote: > + * optabs.c (expand_binop): Pass INT_MODE to operand_subword_force > + iff the operand is a constant.
This broke gcc.target/i386/pr80173.c testcase. The problem is that while operand_subword handles VOIDmode last argument just fine by using GET_MODE (op), so it is only important to use non-VOIDmode if op has VOIDmode. But, operand_subword_force actually has a different behavior, if mode is VOIDmode (or BLKmode), it acts just as operand_subword followed by assertion that it succeeded, rather than by trying to deal with failed operand_subword by forcing it into a pseudo. In the testcase, op is a hard register, on which operand_subword fails, but if it is forced into pseudo, it succeeds. The following patch arranges it by never passing VOIDmode to operand_subword_force, pass int_mode as previously if opN has VOIDmode, but instead of passing VOIDmode otherwise pass the actual mode of the opN operand. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2018-11-16 Jakub Jelinek <ja...@redhat.com> PR middle-end/88032 * optabs.c (expand_binop): For op0_mode use GET_MODE (op0), unless it is VOIDmode, in which case use int_mode. Similarly for op1_mode. --- gcc/optabs.c.jj 2018-11-14 17:42:53.044049213 +0100 +++ gcc/optabs.c 2018-11-15 15:45:35.949378049 +0100 @@ -1377,8 +1377,12 @@ expand_binop (machine_mode mode, optab b start_sequence (); /* Do the actual arithmetic. */ - enum machine_mode op0_mode = CONSTANT_P (op0) ? int_mode : VOIDmode; - enum machine_mode op1_mode = CONSTANT_P (op1) ? int_mode : VOIDmode; + enum machine_mode op0_mode = GET_MODE (op0); + enum machine_mode op1_mode = GET_MODE (op1); + if (op0_mode == VOIDmode) + op0_mode = int_mode; + if (op1_mode == VOIDmode) + op1_mode = int_mode; for (i = 0; i < GET_MODE_BITSIZE (int_mode) / BITS_PER_WORD; i++) { rtx target_piece = operand_subword (target, i, 1, int_mode); Jakub