Re: problem on modifying gcc backend for riscv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for the replies.

I tried what Segher's approach:

(define_expand "mul<mode>3"
  [(match_operand:ANYF               0 "register_operand" "=f")
(match_operand:ANYF    1 "register_operand" " f")
(match_operand:ANYF 2 "register_operand" " f")]
  "TARGET_HARD_FLOAT"
{
rtx reg = gen_reg_rtx (SImode);
emit_insn(gen_modfloatmul_insn(SFmode, operands[0], operands[1],
operands[2]));
if( fpexception == 3)
{ emit_insn(gen_riscv_frflags(reg));}
DONE;
})

(define_insn "@mod<mode>floatmul_insn"
  [(set (match_operand:ANYF               0 "register_operand" "=f")
(mult:ANYF (match_operand:ANYF    1 "register_operand" " f")
     (match_operand:ANYF 2 "register_operand" " f")))]
  "TARGET_HARD_FLOAT"
  "fmul.<fmt>\t%0,%1,%2"
)

Build fails with messsage:

In file included from ../../../riscv-gcc/gcc/target.h:51:0,
                 from ../../../riscv-gcc/gcc/attribs.c:23:
./insn-codes.h:19:12: error: stray ‘@’ in program
   CODE_FOR_@modsffloatmul_insn = 17,
            ^
./insn-codes.h:20:12: error: stray ‘@’ in program
   CODE_FOR_@moddffloatmul_insn = 18,
            ^
In file included from ./tm.h:25:0,
                 from ../../../riscv-gcc/gcc/target.h:52,
                 from ../../../riscv-gcc/gcc/attribs.c:23:
./insn-flags.h:17:14: warning: missing whitespace after the macro name
 #define HAVE_@modsffloatmul_insn (TARGET_HARD_FLOAT)
              ^
./insn-flags.h:18:14: warning: missing whitespace after the macro name
 #define HAVE_@moddffloatmul_insn ((TARGET_HARD_FLOAT) &&
(TARGET_DOUBLE_FLOAT))
              ^
./insn-flags.h:18:0: warning: "HAVE_" redefined
 #define HAVE_@moddffloatmul_insn ((TARGET_HARD_FLOAT) &&
(TARGET_DOUBLE_FLOAT))
 ^
./insn-flags.h:17:0: note: this is the location of the previous definition
 #define HAVE_@modsffloatmul_insn (TARGET_HARD_FLOAT)
 ^
In file included from ./tm.h:25:0,
                 from ../../../riscv-gcc/gcc/target.h:52,
                 from ../../../riscv-gcc/gcc/attribs.c:23:
./insn-flags.h:232:23: error: stray ‘@’ in program
 extern rtx        gen_@modsffloatmul_insn       (rtx, rtx, rtx);
                       ^
./insn-flags.h:233:23: error: stray ‘@’ in program
 extern rtx        gen_@moddffloatmul_insn       (rtx, rtx, rtx);
                       ^
In file included from ../../../riscv-gcc/gcc/target.h:51:0,
                 from ../../../riscv-gcc/gcc/attribs.c:23:
./insn-codes.h:19:13: error: expected ‘}’ before ‘modsffloatmul_insn’
   CODE_FOR_@modsffloatmul_insn = 17,
             ^
./insn-codes.h:19:34: error: invalid conversion from ‘int’ to ‘insn_code’
[-fpermissive]
   CODE_FOR_@modsffloatmul_insn = 17,
                                  ^
./insn-codes.h:20:13: error: expected initializer before
‘moddffloatmul_insn’
   CODE_FOR_@moddffloatmul_insn = 18,
             ^
./insn-codes.h:224:1: error: expected declaration before ‘}’ token
 };
 ^
make[2]: *** [attribs.o] Error 1
make[1]: *** [all-gcc] Error 2
make: *** [stamps/build-gcc-newlib-stage1] Error 2

Note:

I know mul<mode>3 is a defined expansion pattern but for some reason, i
want to generate multiple RTL statements.. For that reason, i am using,
define_expand.
The original mul<mode>3 is now defined as  mod<mode>floatmul_insn (as
advised). In my new mul<mode>3, i generate this RTL using
emit_insn(gen_riscv_frflags(reg)).



On Fri, Jul 12, 2019 at 7:04 PM Segher Boessenkool <
segher@xxxxxxxxxxxxxxxxxxx> wrote:

> On Fri, Jul 12, 2019 at 12:36:47PM +0000, Richard Earnshaw wrote:
> >
> >
> > On 12/07/2019 12:23, Segher Boessenkool wrote:
> > > So you'll have something like
> > >
> > > (define_insn "*mul<mode>3"
> > >    ...
> >
> > Well mul<mode>3 for standard modes is a defined expansion pattern for
> > generating RTL from tree.  So I think you don't want the * in this case.
>
> Faisal added a new
>
> > >> (define_expand "mul<mode>3"
>
> so you cannot name the define_insn (that does a different thing, btw)
> the same.
>
>
> Segher
>




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux