This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] Curious REG_EQUAL note for multiplication
Kaz Kojima wrote:
> Michael Matz <firstname.lastname@example.org> wrote:
>> Yeah, too much I think. The usage of ashl is just an artifact of how the
>> multiplication by a constant is carried out. It could also be something
>> else, substraction or the like. The note is attached to the last insn of
>> the whole sequence (as only then the full target contains the value that
>> the note claims), so that is also were a potential new place for that note
>> would need to be emitted. And you don't want to have (set x x) insns all
>> over just because something emitted a ashldi3.
> I see. It seems to be a cure worse than the disease. So my
> patch in http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01036.html
> might be the only one workaround I can imagine ATM.
I've run into trouble before with REG_EQUAL vs. subword SETs and CSE:
I thought that had been resolved, or at any rate the problematic code wasn't
there any more last time I looked, but maybe it is cropping up in another
> (insn 87 86 88 ice.i:6 (parallel [
> (set (subreg:SI (reg:DI 220) 0)
> (ashift:SI (subreg:SI (reg:DI 218) 0)
> (const_int 9 [0x9])))
> (clobber (scratch:SI))
> ]) -1 (expr_list:REG_EQUAL (mult:DI (reg:DI 169)
> (const_int 1000000000 [0x3b9aca00]))
The REG_EQUAL is problematic, because it contains the value of the whole
DImode register, when CSE thinks it refers only to the value of the subword
part of the register that is the dest of the set. If I grokked it correctly
at the time, that is.
Tagging the correct note onto a nop-move sequence was suggested at the time
as a possible solution. I think I tried it and it didn't work first time and
I never had a chance to track it any further at the time.