Kazu Hirata wrote:
I have a question about having multiple insns for one operation. Take
m68k port for example. It has many SImode move insns like so:
Now, is it OK to have this many?
It isn't ideal. It can work if you aren't doing things that will cause
reload to fail. I suspect the real problem here is just that the
m68k.md file is very old, and hasn't been updated to reflect current
practices.
The movsi_const0 pattern for instance only has one constraint, and it is
"g" which matches any operand. So there is no chance of a reload
failure here. It would be better if this was part of the normal movsi
pattern. It looks like it used to be redundant up until the 68040
support was added.
The pushexthisi_const is actually a push insn not a move insn. Note
that we have both push_optab and mov_optab. So it is OK to have
patterns to match a push insn which are separate from patterns to match
a move insn, provided that both are complete. Nowadays, though, it
would probably be best to use a define_expand for a pushsi pattern
instead of a define_insn, thereby avoiding the need for two similar
patterns. The m68k.md port predates the existence of define_expand.
However, this isn't a named pushsi pattern anyways, so it isn't clear
why it is here. I would guess that it started life as a pushsi pattern,
was renamed to avoid its use, and never got cleaned up.
Separate patterns for lea are common, in the old way of doing things.
The i386.md file still has separate lea patterns for instance, though
they come before add in the i386.md file, and they appear after add in
the m68k.md file. The m68k.md one will probably only match for
complicated addressing modes, like indexed addresses. The mismatched
modes is curious and looks wrong. Maybe it will never match anymore?
--
Jim Wilson, GNU Tools Support, http://www.specifix.com