Feng LI <nemoking...@gmail.com> writes:

> I'm trying to expand a builtin functions into assembles, with
> processing a little bit for the operands.
>
> Like for the builtin function:
> tcreate (arg0, arg1, arg2)
> I'm trying to generate the assemble code (pseudo):
> TCREATE arg0<<32|arg1, arg2
>
> but I got the following error:
> -----------------------------------------------------
> fib.c:38:1: error: unrecognizable insn:
> (insn 15 14 16 4 (set (reg:DI 100)
>         (ashift:DI (reg:DI 100)
>             (const_int 32 [0x20]))) fib.c:25 -1
>      (nil))
> -----------------------------------------------------
>
> Not sure why this happens,
>
> Here is the related source code for generating this insn:
>
>   switch (fcode)
>     {
>     case BUILT_IN_WSTREAM_DF_TCREATE:
>       arg0 = CALL_EXPR_ARG (exp, 0);
>       arg1 = CALL_EXPR_ARG (exp, 1);
>       arg2 = CALL_EXPR_ARG (exp, 2);
>
>       op0 = expand_normal (arg0);
>       op1 = expand_normal (arg1);
>       op2 = expand_normal (arg2);
>
>       op0 = copy_to_mode_reg (DImode,op0);
>       insn = emit_move_insn (op0, gen_rtx_ASHIFT (DImode, op0, GEN_INT (32)));
>       insn = emit_insn (gen_rtx_SET (VOIDmode, op0,
>                                    gen_rtx_PLUS (DImode, op0, op1)));
>       insn = emit_insn (gen_tstar_write (op2,op0,op2));
>       ... ...
>
> Any ideas?

Rather than building the shift by hand like this, do something like
    val = expand_simple_binop (DImode, ASHIFT, op0, GEN_INT (32), op0,
                               1, OPTAB_DIRECT);

Ian

Reply via email to