Hi :
I am studying IRA right now (GCC4.4.1,mips32 target),
for following piece of code:

long long func(int a, int b)
{
  long long r = (long long)a * (long long)b;

  return r;
}

the asm generated on mips is like:
        
        mult    $5,$4
        mfhi    $5
        mflo    $2
        j       $31
        move    $3,$5   <----------unnecessary move insn

Please note the unnecessary move insn.

RTL list before subreg1 and IRA pass are like:

--------------------------------------------before subreg1
(insn 7 4 8 2 mult-problem.c:2 (set (reg:DI 196)
        (mult:DI (sign_extend:DI (reg/v:SI 195 [ b ]))
            (sign_extend:DI (reg/v:SI 194 [ a ])))) 50 {mulsidi3_32bit} (nil))

(insn 8 7 12 2 mult-problem.c:2 (set (reg:DI 193 [ <result> ])
        (reg:DI 196)) 282 {*movdi_32bit} (nil))

(insn 12 8 18 2 mult-problem.c:6 (set (reg/i:DI 2 $2)
        (reg:DI 193 [ <result> ])) 282 {*movdi_32bit} (nil))

--------------------------------------------before IRA
(insn 7 4 25 2 mult-problem.c:2 (set (reg:DI 196)
        (mult:DI (sign_extend:DI (reg:SI 5 $5 [ b ]))
            (sign_extend:DI (reg:SI 4 $4 [ a ])))) 50 {mulsidi3_32bit}
(expr_list:REG_DEAD (reg:SI 5 $5 [ b ])
        (expr_list:REG_DEAD (reg:SI 4 $4 [ a ])
            (nil))))

(insn 25 7 26 2 mult-problem.c:6 (set (reg:SI 2 $2)
        (subreg:SI (reg:DI 196) 0)) 287 {*movsi_internal} (nil))

(insn 26 25 18 2 mult-problem.c:6 (set (reg:SI 3 $3 [+4 ])
        (subreg:SI (reg:DI 196) 4)) 287 {*movsi_internal}
(expr_list:REG_DEAD (reg:DI 196)
        (nil)))
---end


Seems DImode split  prevents IRA allocating $2/$3 directly
by introducing conflicts between $196 and $2/3 in (insn 25/26).

Wondering whether possible to handle multi-word mode with more accuracy,
in either subreg or IRA pass?

Thanks in advance.

-- 
Best Regards.

Reply via email to