Re: problem on modifying gcc backend for riscv

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

 



[sorry to those on direct CC who received multiple copies]

On 12/07/2019 12:23, Segher Boessenkool wrote:
Hi Faisal,

On Fri, Jul 12, 2019 at 10:47:10AM +0530, Faisal Riyaz wrote:
(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 (operands[0], operands[1], operands[2]));
if( fpexception == 3)
{ emit_insn(gen_riscv_frflags(reg));}
DONE;
})

(define_insn "modfloatmul"
    [(set (match_operand:ANYF               0 "register_operand" "=f")
(mult:ANYF (match_operand:ANYF    1 "register_operand" " f")
       (match_operand:ANYF 2 "register_operand" " f")))(use (match_operand:SI
3 ""))]
    "TARGET_HARD_FLOAT"
    "fmul.<fmt>\t%0,%1,%2"
    [(set_attr "type" "fmul")
     (set_attr "mode" "<UNITMODE>")])

The build fails with the message:
../../../riscv-gcc/gcc/config/riscv/riscv.md:578:1: duplicate definition of
'modfloatmul'.

An iterator like ANYF creates multiple patterns, one for each mode in
this case.  You should name the patterns starting with a * so that the
name is just a comment, and/or use <mode> in the pattern name.

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.



But if you want to call its gen_, you can do something like

(define_insn "@mul<mode>3_insn"
    ...

where you then would call
    gen_mul3_insn (mode, rest of arguments);


Segher


R.



[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