On Wed, Dec 21, 2016 at 01:58:18PM +0100, Georg-Johann Lay wrote: > $ avr-gcc > /gnu/gcc.gnu.org/trunk/gcc/testsuite/gcc.c-torture/compile/pr26833.c -S > -O1 -mmcu=avr4 -S -v > > /gnu/gcc.gnu.org/trunk/gcc/testsuite/gcc.c-torture/compile/pr26833.c: In > function 'yasm_lc3b__parse_insn': > /gnu/gcc.gnu.org/trunk/gcc/testsuite/gcc.c-torture/compile/pr26833.c:19:1: > error: insn does not satisfy its constraints: > } > ^ > (jump_insn 58 98 59 9 (set (pc) > (if_then_else (eq (and:HI (reg:HI 31 r31) > (const_int 1 [0x1])) > (const_int 0 [0])) > (label_ref 70) > (pc))) > "/gnu/gcc.gnu.org/trunk/gcc/testsuite/gcc.c-torture/compile/pr26833.c":11 > 415 {*sbrx_and_branchhi} > (int_list:REG_BR_PROB 375 (nil)) > -> 70)
> Combine comes up with the following insn: > (jump_insn 58 57 59 7 (set (pc) > (if_then_else (eq (and:HI (subreg:HI (mem:QI (reg/v/f:HI 75 [ > operands ]) [1 *operands_17(D)+0 S1 A8]) 0) > (const_int 1 [0x1])) > (const_int 0 [0])) > (label_ref 70) > (pc))) > "/home/georg/gnu/gcc.gnu.org/trunk/gcc/testsuite/gcc.c-torture/compile/pr26833.c":11 > > 415 {*sbrx_and_branchhi} > (int_list:REG_BR_PROB 375 (nil)) > -> 70) > > which cannot be correct because avr.md::*sbrx_and_branchhi reads: > > (define_insn "*sbrx_and_branch<mode>" > [(set (pc) > (if_then_else > (match_operator 0 "eqne_operator" > [(and:QISI > (match_operand:QISI 1 "register_operand" "r") > (match_operand:QISI 2 "single_one_operand" "n")) > (const_int 0)]) > (label_ref (match_operand 3 "" "")) > (pc)))] > "" { ... } ...) > > Hence we have a memory operand (subreg of mem)) where only a register is > allowed. Reg alloc then reloads the mem:QI into R31, but R31 is the > last hard reg, i.e. R31 cannot hold HImode. If you don't have instruction scheduling subregs of mem are allowed (and are counted as registers). Combine asks recog, and it think this is fine. Why does reload use r31 here? Why does it think that is valid for HImode? Segher