[lkml]   [2020]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [GIT PULL] x86/asm updates for v5.10
On Mon, Oct 12, 2020 at 10:57 PM Linus Torvalds
<> wrote:
> On Mon, Oct 12, 2020 at 1:22 PM Uros Bizjak <> wrote:
> >
> > No, this fact is not documented, although there are close to zero
> > chances it will ever change. High registers are independent from their
> > 8bit lowparts, but they still clobber corresponding 16bit, 32bit and
> > 64bit representations. I guess this limitation is so severe that the
> > compiler writers will be more than happy to document that %ah and %al
> > can't be independent.
> Ok, if we can get that agreed upon (and the clang people too), then I
> have no concerns about the patch.

The GCC's development documentation says:

--cut here--
When storing to a normal 'subreg' that is smaller than a
block, the other bits of the referenced block are usually left
in an undefined state. This laxity makes it easier to
generate efficient code for such instructions. To represent
an instruction that preserves all the bits outside of those in
the 'subreg', use 'strict_low_part' or 'zero_extract' around
the 'subreg'.
--cut here--

REG is divided into individually-addressable blocks in which each block has:


bytes. Usually the value is 'UNITS_PER_WORD'; that is, most targets
usually treat each word of a register as being independently

The 'block' is 32bits for i386 or 64bits for x86_64. When asm is
writing to %al, this effectively means that other bits of a register
are left in an undefined state. Please note that 'strict_low_part' and
'zero_extract' are internal representations, not available in asm

> Just so that we don't have any nasty surprises in the future where
> some clever compiler change ends up breaking this (very rare)
> exception case.

IMO the above documents that write to a partial register clobbers the
entire register.


 \ /
  Last update: 2020-10-13 10:02    [W:0.092 / U:4.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site