This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

A reload failure which I can't figure out


I have problems figuring out why reload gives up on this:

reload failure for reload 1
../../../cvssrc/gcc/gcc/libgcc2.c: In function '__moddi3':
../../../cvssrc/gcc/gcc/libgcc2.c:1101: error: unable to find a register to
spill in class 'DX_REGS'
../../../cvssrc/gcc/gcc/libgcc2.c:1101: error: these are the reloads for
insn # 425:
Reload 0: reload_in (HI) = (reg:HI 4 d [+2 ])
        reload_out (HI) = (reg:HI 0 c [199])
        AX_REGS, RELOAD_OTHER (opnum = 0)
        reload_in_reg: (reg:HI 4 d [+2 ])
        reload_out_reg: (reg:HI 0 c [199])
Reload 1: reload_out (HI) = (scratch:HI)
        DX_REGS, RELOAD_FOR_OUTPUT (opnum = 3)
        reload_out_reg: (scratch:HI)
../../../cvssrc/gcc/gcc/libgcc2.c:1101: error: this is the insn:
(insn 425 422 432 30 ../../../cvssrc/gcc/gcc/libgcc2.c:911 (parallel [
            (set (reg:HI 0 c [199])
                (mult:HI (reg:HI 4 d [+2 ])
                    (reg:HI 6 b [orig:629 __d0 ] [629])))
            (clobber (scratch:HI))
            (clobber (reg:CC 12 cc))
        ]) 309 {*mulhi3} (nil)
    (expr_list:REG_UNUSED (reg:CC 12 cc)
        (expr_list:REG_UNUSED (scratch:HI)
            (expr_list:REG_DEAD (reg:HI 4 d [+2 ])
                (expr_list:REG_UNUSED (reg:CC 12 cc)
                    (expr_list:REG_UNUSED (scratch:HI)
../../../cvssrc/gcc/gcc/libgcc2.c:1101: internal compiler error: in
spill_failure, at reload1.c:1915

The *mulhi3 pattern is this:
(define_insn "*mulhi3"
        [(set (match_operand:HI 0 "single_register_operand" "=a")
              (mult:HI (match_operand:HI 1 "single_register_operand" "%0")
                       (match_operand:HI 2 "general_operand" "rm")))
         (clobber (match_scratch:HI 3 "=d"))
         (clobber (reg:CC CC_REG))]

where the constraint "a" matches the register class AX_REGS consiting of
(reg:HI 2 a), the constraint "d" matches the register class DX_REGS
consiting of (reg:HI 4 d) and the predicate "single_register_operand" is:

(define_predicate "single_register_operand"
        (and (match_operand 0 "register_operand")
             (ior (not (match_code "subreg"))
                  (match_test "GET_MODE_SIZE (GET_MODE (SUBREG_REG (op)))
                               <= UNITS_PER_WORD")))

In other words, like "register_operand" register but reject subregs of
registers larger than a word - 16 bits.

The insn seems perfectly possible to reload:
(set (mem:HI stack-slot-d) (reg:HI 4 d))
(set (mem:HI stack-slot-a) (reg:HI 2 a))
(set (reg:HI 2 a) (mem:HI stack-slot-d))

(parallel [(set (reg:HI 2 a)
	        (mult:HI (reg:HI 2 a) (reg:HI 6 b)))
	   (clobber (reg:HI 4 d))
	   (clobber (reg:CC CC_REG))]

(set (reg:HI 0 c) (reg:HI 2 a))
(set (reg:HI a) (mem:HI stack-slot-a))
(set (reg:HI d) (mem:HI stack-slot-d))

What am I missing?

Rask Ingemann Lambertsen

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]