]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/doc/gccint/rtl-representation/bit-fields.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / doc / gccint / rtl-representation / bit-fields.rst
CommitLineData
c63539ff
ML
1..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6.. index:: bit-fields
7
8.. _bit-fields:
9
10Bit-Fields
11**********
12
13Special expression codes exist to represent bit-field instructions.
14
15.. index:: sign_extract, BITS_BIG_ENDIAN, effect on sign_extract
16
17:samp:`(sign_extract:{m} {loc} {size} {pos})`
18 This represents a reference to a sign-extended bit-field contained or
19 starting in :samp:`{loc}` (a memory or register reference). The bit-field
20 is :samp:`{size}` bits wide and starts at bit :samp:`{pos}`. The compilation
21 option ``BITS_BIG_ENDIAN`` says which end of the memory unit
22 :samp:`{pos}` counts from.
23
24 If :samp:`{loc}` is in memory, its mode must be a single-byte integer mode.
25 If :samp:`{loc}` is in a register, the mode to use is specified by the
26 operand of the ``insv`` or ``extv`` pattern
27 (see :ref:`standard-names`) and is usually a full-word integer mode,
28 which is the default if none is specified.
29
30 The mode of :samp:`{pos}` is machine-specific and is also specified
31 in the ``insv`` or ``extv`` pattern.
32
33 The mode :samp:`{m}` is the same as the mode that would be used for
34 :samp:`{loc}` if it were a register.
35
36 A ``sign_extract`` cannot appear as an lvalue, or part thereof,
37 in RTL.
38
39 .. index:: zero_extract
40
41:samp:`(zero_extract:{m} {loc} {size} {pos})`
42 Like ``sign_extract`` but refers to an unsigned or zero-extended
43 bit-field. The same sequence of bits are extracted, but they
44 are filled to an entire word with zeros instead of by sign-extension.
45
46 Unlike ``sign_extract``, this type of expressions can be lvalues
47 in RTL; they may appear on the left side of an assignment, indicating
3ed1b4ce 48 insertion of a value into the specified bit-field.