On 11/06/2015 08:09 PM, Kyrill Tkachov wrote:

On 06/11/15 17:07, Nikolai Bozhenov wrote:
On 11/06/2015 04:46 PM, Ramana Radhakrishnan wrote:
Hi!

I faced the same issue but I had somewhat different RTL for the consumer:

     (insn 20 15 21 2 (set (reg/i:SI 0 r0)
             (minus:SI (subreg:SI (reg:DI 117) 4)
                 (mult:SI (reg:SI 123)
                     (reg:SI 114)))) gasman.c:4 48 {*mulsi3subsi})

where (reg:DI 117) is produced by umulsidi3_v6 instruction. Is it
really true that (subreg:SI (reg:DI 117) 4) may be forwarded in one
cycle in this case?
If the accumulator can be forwarded (i.e. a SImode register), there isn't a reason why a subreg:SI (reg:DI) will not get forwarded.

The subreg:SI is an artifact before register allocation, thus it's a representation issue that the patch is fixing here unless I misunderstand your question.

I mean, in my example it is not the multiplication result that is
forwarded but its upper part. So, shouldn't we check that offset in a
subreg expression is zero? Or is it ok to forward only the upper part
of a multiplication?

Could you please post the full RTL instruction we're talking about here as it appears in the scheduler dump?
So that we're all on the same page about which case we're talking about.


Sure. I'm talking about a sequence like this:

    (insn 8 13 11 2 (set (reg:DI 117)
            (mult:DI (zero_extend:DI (reg:SI 116))
                (zero_extend:DI (reg:SI 118)))) test.c:2 54 {*umulsidi3_v6}
         (expr_list:REG_DEAD (reg:SI 118)
            (expr_list:REG_DEAD (reg:SI 116)
                (expr_list:REG_EQUAL (mult:DI (zero_extend:DI (reg:SI 116))
                        (const_int 1374400 [0x14f8c0]))
                    (nil)))))
    (insn 11 8 12 2 (set (reg:DI 120)
            (mult:DI (zero_extend:DI (subreg:SI (reg:DI 117) 4))
                (zero_extend:DI (reg:SI 121)))) test.c:2 54 {*umulsidi3_v6}
         (expr_list:REG_DEAD (reg:SI 121)
(expr_list:REG_EQUAL (mult:DI (zero_extend:DI (subreg:SI (reg:DI 117) 4))
                    (const_int 3435973837 [0xcccccccd]))
                (nil))))
    (insn 12 11 20 2 (set (reg:SI 114)
            (lshiftrt:SI (subreg:SI (reg:DI 120) 4)
                (const_int 3 [0x3]))) test.c:2 126 {*arm_shiftsi3}
         (expr_list:REG_DEAD (reg:DI 120)
            (expr_list:REG_EQUAL (udiv:SI (subreg:SI (reg:DI 117) 4)
                    (const_int 10 [0xa]))
                (nil))))
    (insn 20 12 21 2 (set (reg/i:SI 0 r0)
            (minus:SI (subreg:SI (reg:DI 117) 4)
                (mult:SI (reg:SI 123)
                    (reg:SI 114)))) test.c:3 48 {*mulsi3subsi}
         (expr_list:REG_DEAD (reg:SI 123)
            (expr_list:REG_DEAD (reg:DI 117)
                (expr_list:REG_DEAD (reg:SI 114)
                    (nil)))))

The last insn is a MLA-like operation which is tested by
aarch_accumulator_forwarding if it is a valid forwarding consumer.

Thanks,
Nikolai

Reply via email to