This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Unable to reload subreg
- From: René Willemink <rene dot Willemink at dspfactory dot ch>
- To: <gcc at gcc dot gnu dot org>
- Date: Tue, 10 Feb 2004 16:30:39 +0100
- Subject: Unable to reload subreg
Compiling the following code with my cross-compiler generates an error:
long long var1 = 10, var2 = 20;
long long result = var1 + var2;
This should perform a double word addition (HImode on my target). Since I haven't defined an addhi3 instruction, gcc tries to solve this problem with addqi3, and uses (subreg:QI (reg:HI)) to access the low and high part of this double word value.
The problem I run into is that in my cross compiler seems not to be able to reload the destination (subreg:QI (reg:HI)) into a QImode register. This happens when I adjust the constraints to force the result into a register. When I allow the result in memory, no error occurs.
I get the following error:
test.c:35: error: unable to generate reloads for:
(insn 14 13 15 0 0x4019e440 (parallel [
(set (subreg:QI (reg:HI 85) 0)
(plus:QI (subreg:QI (reg:HI 83) 0)
(subreg:QI (reg:HI 84) 0)))
(clobber (cc0))
]) 16 {addqi3_normal} (nil)
(nil))
test.c:35: internal compiler error: in find_reloads, at reload.c:3629
This doesn't work:
(define_insn "addqi3_normal"
[(set
(match_operand:QI 0 "register_operand" "=r")
(plus:QI
(match_operand:QI 1 "register_operand" "r")
(match_operand:QI 2 "register_operand" "r"))
)
(clobber (cc0))]
This does work, but I don't want the result to be in memory
(define_insn "addqi3_normal"
[(set
(match_operand:QI 0 "register_operand" "=m")
(plus:QI
(match_operand:QI 1 "register_operand" "r")
(match_operand:QI 2 "register_operand" "r"))
)
(clobber (cc0))]
My question is, how can I get gcc to reload the destination subreg into a register.
Rene Willemink