]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/doc/gccint/rtl-representation/vector-operations.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / doc / gccint / rtl-representation / vector-operations.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:: vector operations
7
8.. _vector-operations:
9
10Vector Operations
11*****************
12
13All normal RTL expressions can be used with vector modes; they are
14interpreted as operating on each part of the vector independently.
15Additionally, there are a few new expressions to describe specific vector
16operations.
17
18.. index:: vec_merge
19
20:samp:`(vec_merge:{m} {vec1} {vec2} {items})`
21 This describes a merge operation between two vectors. The result is a vector
22 of mode :samp:`{m}` ; its elements are selected from either :samp:`{vec1}` or
23 :samp:`{vec2}`. Which elements are selected is described by :samp:`{items}`, which
24 is a bit mask represented by a ``const_int`` ; a zero bit indicates the
25 corresponding element in the result vector is taken from :samp:`{vec2}` while
26 a set bit indicates it is taken from :samp:`{vec1}`.
27
28 .. index:: vec_select
29
30:samp:`(vec_select:{m} {vec1} {selection})`
31 This describes an operation that selects parts of a vector. :samp:`{vec1}` is
32 the source vector, and :samp:`{selection}` is a ``parallel`` that contains a
33 ``const_int`` (or another expression, if the selection can be made at
34 runtime) for each of the subparts of the result vector, giving the number of
35 the source subpart that should be stored into it. The result mode :samp:`{m}` is
36 either the submode for a single element of :samp:`{vec1}` (if only one subpart is
37 selected), or another vector mode with that element submode (if multiple
38 subparts are selected).
39
40 .. index:: vec_concat
41
42:samp:`(vec_concat:{m} {x1} {x2})`
43 Describes a vector concat operation. The result is a concatenation of the
44 vectors or scalars :samp:`{x1}` and :samp:`{x2}` ; its length is the sum of the
45 lengths of the two inputs.
46
47 .. index:: vec_duplicate
48
49:samp:`(vec_duplicate:{m} {x})`
50 This operation converts a scalar into a vector or a small vector into a
51 larger one by duplicating the input values. The output vector mode must have
52 the same submodes as the input vector mode or the scalar modes, and the
53 number of output parts must be an integer multiple of the number of input
54 parts.
55
56 .. index:: vec_series
57
58:samp:`(vec_series:{m} {base} {step})`
59 This operation creates a vector in which element :samp:`{i}` is equal to
3ed1b4ce 60 :samp:`{base} + {i}*{step}`. :samp:`{m}` must be a vector integer mode.