This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: emit_move_insn
- From: Hendrik Greving <hendrik dot greving dot intel at gmail dot com>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Tue, 27 Aug 2013 11:28:30 -0700
- Subject: Re: emit_move_insn
- Authentication-results: sourceware.org; auth=none
- References: <CANc4vhpRWJ+-HSH-rWw92LS400PpQY_zz7E++fD+nkc+-FPaLA at mail dot gmail dot com>
Apparently what happens is that in expand_value_return, return_reg is
(reg:QI 343 [ <retval> ]) (see C-code), while val is (subreg/s:QI
(reg:SI 342 [ D.1978 ]) 0). This looks fine to me(?).
On our machine, we define PROMOTE_MODE to SImode if possible. In
expand_value_return the compiler then calls
if (mode != old_mode)
val = convert_modes (mode, old_mode, val, unsignedp);
Which then makes the compiler call emit_move_insn from (reg:SI 342 [
D.1978 ]) to (reg:QI 343 [ <retval> ]) and asserts.
Is this promotion model defined by us wrong?
On Tue, Aug 27, 2013 at 10:05 AM, Hendrik Greving
<hendrik.greving.intel@gmail.com> wrote:
> In my backend (GCC 4.8.1), the compiler calls emit_move_insn from
> expand_value_return. The C-code is
>
> static char
> cnv(const char *str) {
> int i = strtol(str, ((void *)0), 10);
> if (i == -1)
> i = 127;
> return (char)i;
> }
>
> x is SImode and y is QImode (makes sense from looking at the C-code).
> Apparently the compiler doesn't call any sign or zero extend before
> that. I am running into the assertion in emit_move_insn
>
> gcc_assert (mode != BLKmode
> && (GET_MODE (y) == mode || GET_MODE (y) == VOIDmode));
>
> because mode(x) != mode(y).
>
> Any idea what could causing this?
>
> Regards,
> Thanks,
> Hendrik Greving