On Fri, Apr 27, 2007 at 08:24:11AM -0700, Richard Henderson wrote:
> On Fri, Apr 27, 2007 at 04:00:13PM +0200, Rask Ingemann Lambertsen wrote:
> >    I don't see how emit_move_complex_push() can ever generate a push
> > instruction. Here's a backtrace:
> 
>   emit_move_insn (gen_rtx_MEM (submode, XEXP (x, 0)),
>                   read_complex_part (y, imag_first));
>   return emit_move_insn (gen_rtx_MEM (submode, XEXP (x, 0)),
>                          read_complex_part (y, !imag_first));
> 
> Note that we're replacing (pre_dec:CSI sp) with two
> instances of (pre_dec:SI sp).

   It's not working the way it is supposed to. Here is an example
(testitcs() from gcc.dg/compat/scalar-return-4_x.c) where
emit_move_complex_push() is called with CHImode:

(gdb) bt
#0  add_insn (insn=0xb7f75a50) at ../../../cvssrc/gcc/gcc/emit-rtl.c:3404
#1  0x08177709 in emit_insn (x=0xb7f88180) at 
../../../cvssrc/gcc/gcc/emit-rtl.c:4353
#2  0x08532de4 in gen_movhi (operand0=0xb7f88174, operand1=0xb7ee1210) at 
../../../cvssrc/gcc/gcc/config/ia16/ia16.md:203
#3  0x081b7bb9 in emit_move_insn_1 (x=0xb7f88174, y=0xb7ee1210) at 
../../../cvssrc/gcc/gcc/expr.c:3260
#4  0x081b7e95 in emit_move_insn (x=0xb7f88174, y=0xb7ee1210) at 
../../../cvssrc/gcc/gcc/expr.c:3351
#5  0x081bdc58 in emit_move_complex_push (mode=CHImode, x=0xb7f88168, 
y=0xb7f8815c) at ../../../cvssrc/gcc/gcc/expr.c:3025
#6  0x081b7d75 in emit_move_insn_1 (x=0xb7f88168, y=0xb7f8815c) at 
../../../cvssrc/gcc/gcc/expr.c:3061
#7  0x081b7e95 in emit_move_insn (x=0xb7f88168, y=0xb7f8815c) at 
../../../cvssrc/gcc/gcc/expr.c:3351
#8  0x081bb478 in emit_single_push_insn (mode=CHImode, x=0xb7f8815c, 
type=0xb7f82000) at ../../../cvssrc/gcc/gcc/expr.c:3582
#9  0x081c03ff in emit_push_insn (x=0xb7f8815c, mode=CHImode, type=0xb7f82000, 
size=0x0, align=16, partial=0, reg=0x0, extra=0, args_addr=0x0,
    args_so_far=0xb7ee1220, reg_parm_stack_space=0, alignment_pad=0xb7ee1210) 
at ../../../cvssrc/gcc/gcc/expr.c:3852
#10 0x081143c7 in store_one_arg (arg=0xbf9f4c00, argblock=0x0, flags=0, 
variable_size=0, reg_parm_stack_space=0) at ../../../cvssrc/gcc/gcc/calls.c:4239
#11 0x0811904f in expand_call (exp=0xb7f8523c, target=0x0, ignore=1) at 
../../../cvssrc/gcc/gcc/calls.c:2652
#12 0x081a71ff in expand_expr_real_1 (exp=0xb7f8523c, target=0x0, 
tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at 
../../../cvssrc/gcc/gcc/expr.c:7789
#13 0x081b689b in expand_expr_real (exp=0xb7f8523c, target=0xb7ee1210, 
tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0)
    at ../../../cvssrc/gcc/gcc/expr.c:6789
#14 0x08355a2c in expand_expr_stmt (exp=0xb7f8523c) at 
../../../cvssrc/gcc/gcc/expr.h:504
[snip]

(gdb) frame 5
#5  0x081bdc58 in emit_move_complex_push (mode=CHImode, x=0xb7f88168, 
y=0xb7f8815c) at ../../../cvssrc/gcc/gcc/expr.c:3025
3025      emit_move_insn (gen_rtx_MEM (submode, XEXP (x, 0)),
(gdb) call debug_rtx(x)
(mem/s:CHI (pre_dec:HI (reg/f:HI 12 sp)) [0 S4 A16])
(gdb) call debug_rtx(y)
(mem/s:CHI (symbol_ref/f:HI ("*.LC0") [flags 0x2] <complex_cst 0xb7f8a000>) [0 
S4 A16])

(gdb) frame 4
#4  0x081b7e95 in emit_move_insn (x=0xb7f88174, y=0xb7ee1210) at 
../../../cvssrc/gcc/gcc/expr.c:3351
3351      last_insn = emit_move_insn_1 (x, y);
(gdb) call debug_rtx(x)
(mem:HI (pre_dec:HI (reg/f:HI 12 sp)) [0 S2 A8])
(gdb) call debug_rtx(y)
(const_int 0 [0x0])

(gdb) frame 2
#2  0x08532de4 in gen_movhi (operand0=0xb7f88174, operand1=0xb7ee1210) at 
../../../cvssrc/gcc/gcc/config/ia16/ia16.md:203
203             (match_operand:EQ16 1 "general_operand" "rm,Ri"))]
(gdb) call debug_rtx(operand0)
(mem:HI (pre_dec:HI (reg/f:HI 12 sp)) [0 S2 A8])
(gdb) call debug_rtx(operand1)
(const_int 0 [0x0])

   The push operand is passed to the movhi expander. From the GCC Internals
manual, section "Standard Names":

   `pushm1'

        Output a push instruction. Operand 0 is value to push. Used only
        when PUSH_ROUNDING is defined. For historical reason, this pattern
        may be missing and in such case an mov expander is used instead,
        with a MEM expression forming the push operation. The mov expander
        method is deprecated.

   If you agree that it is a bug to pass the push operand to the movhi
expander (instead of passing it to the pushhi expander), then I'll submit a
patch for it.

-- 
Rask Ingemann Lambertsen

Reply via email to