This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
SUBREG questions
- To: <gcc at gcc dot gnu dot org>
- Subject: SUBREG questions
- From: Michael Matz <matzmich at cs dot tu-berlin dot de>
- Date: Thu, 22 Feb 2001 20:21:43 +0100 (MET)
Hi,
in the new-regalloc branch I want to handle SUBREG's more strict. Now I
stumbled over a mismatch between documentation and actual use of these.
On x86 __muldi3 contains this sequence (edited to be more readable):
(parallel[
(set (subreg:SI (reg/v:DI 47) 0)
(asm_operands:SI ("mull %3") ("=a") 0 [subregs's ] [asm_input's ]))
(set (reg:SI 49)
(asm_operands:SI ("mull %3") ("=d") 1 [ subregs ] [ asm_input's ]))
])
(set (subreg:SI (reg/v:DI 47) 1) (reg:SI 49))
The semantic is clear. The final DI pseudo 47 should hold the result of
the "mull" insn, which places it into %eax/%edx. For that first lo(47) is
identified with %eax, %edx is copied into 49, which later is copied into
hi(47).
The mismatch is this: It's documented that stores into SUBREG's with a
smaller mode, leave the other bits in undefined state:
"Storing in a non-paradoxical `subreg' has undefined results for
bits belonging to the same word as the `subreg'." (from docu of
subreg RTL pattern), and
"Likewise, if
LVAL is a `subreg' whose machine mode is narrower than the mode of
the register, the rest of the register can be changed in an
undefined way." (from docu to (set LVAL X) RTL pattern)
This would mean, the second insn above would overwrite the former setting
of lo(47), which clearly is not (and should not be) done. Normally both
settings of subreg:SI(reg:DI 47) should be wrapped into a
strict_low_part(). Why is this not done? I for one would like more, that
storing into subreg's clearly used to extract a reg from a multi-word
pseudo (those subregs in SImode), does _not_ destroy the other subreg's
(and also documented as such), and also, that reading such a subreg does
not require the whole multi-word REG to be live. Can someone clarify
this?
Ciao,
Michael.