# Changeset View

Changeset View

# Standalone View

Standalone View

# llvm/docs/LangRef.rst

- This file is larger than 256 KB, so syntax highlighting is disabled by default.

Show First 20 Lines • Show All 17,262 Lines • ▼ Show 20 Lines | |||||

If the intrinsic call has the ``nnan`` fast-math flag, then the operation can | If the intrinsic call has the ``nnan`` fast-math flag, then the operation can | ||||

assume that NaNs are not present in the input vector. | assume that NaNs are not present in the input vector. | ||||

Arguments: | Arguments: | ||||

"""""""""" | """""""""" | ||||

The argument to this intrinsic must be a vector of floating-point values. | The argument to this intrinsic must be a vector of floating-point values. | ||||

'``llvm.experimental.vector.insert``' Intrinsic | '``llvm.vector.insert``' Intrinsic | ||||

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||||

Syntax: | Syntax: | ||||

""""""" | """"""" | ||||

This is an overloaded intrinsic. You can use ``llvm.experimental.vector.insert`` | This is an overloaded intrinsic. | ||||

to insert a fixed-width vector into a scalable vector, but not the other way | |||||

around. | |||||

:: | :: | ||||

declare <vscale x 4 x float> @llvm.experimental.vector.insert.nxv4f32.v4f32(<vscale x 4 x float> %vec, <4 x float> %subvec, i64 %idx) | ; Insert fixed type into scalable type | ||||

declare <vscale x 2 x double> @llvm.experimental.vector.insert.nxv2f64.v2f64(<vscale x 2 x double> %vec, <2 x double> %subvec, i64 %idx) | declare <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v4f32(<vscale x 4 x float> %vec, <4 x float> %subvec, i64 <idx>) | ||||

declare <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v2f64(<vscale x 2 x double> %vec, <2 x double> %subvec, i64 <idx>) | |||||

paulwalker-arm: For this and the other instances, please remove the `%` as idx must be a literal (as documented… | |||||

; Insert scalable type into scalable type | |||||

declare <vscale x 4 x float> @llvm.vector.insert.nxv4f64.nxv2f64(<vscale x 4 x float> %vec, <vscale x 2 x float> %subvec, i64 <idx>) | |||||

; Insert fixed type into fixed type | |||||

declare <4 x double> @llvm.vector.insert.v4f64.v2f64(<4 x double> %vec, <2 x double> %subvec, i64 <idx>) | |||||

Overview: | Overview: | ||||

""""""""" | """"""""" | ||||

The '``llvm.experimental.vector.insert.*``' intrinsics insert a vector into another vector | The '``llvm.vector.insert.*``' intrinsics insert a vector into another vector | ||||

starting from a given index. The return type matches the type of the vector we | starting from a given index. The return type matches the type of the vector we | ||||

insert into. Conceptually, this can be used to build a scalable vector out of | insert into. Conceptually, this can be used to build a scalable vector out of | ||||

non-scalable vectors. | non-scalable vectors, however this intrinsic can also be used on purely fixed | ||||

types. | |||||

Scalable vectors can only be inserted into other scalable vectors. | |||||

Not Done ReplyInline ActionsNow this comment makes it seems like you can't use it on purely scalable vectors. craig.topper: Now this comment makes it seems like you can't use it on purely scalable vectors. | |||||

Arguments: | Arguments: | ||||

Not Done ReplyInline ActionsTo answer Craig's point, I don't think it was clear before that you could use this intrinsic with purely scalable vectors before, either. I believe the confusion comes from these clarifications. If instead of explicitly stating valid options you exclude the invalid ones, there's no room for ambiguity. Something like:
jsetoain: To answer Craig's point, I don't think it was clear before that you could use this intrinsic… | |||||

"""""""""" | """""""""" | ||||

The ``vec`` is the vector which ``subvec`` will be inserted into. | The ``vec`` is the vector which ``subvec`` will be inserted into. | ||||

The ``subvec`` is the vector that will be inserted. | The ``subvec`` is the vector that will be inserted. | ||||

``idx`` represents the starting element number at which ``subvec`` will be | ``idx`` represents the starting element number at which ``subvec`` will be | ||||

inserted. ``idx`` must be a constant multiple of ``subvec``'s known minimum | inserted. ``idx`` must be a constant multiple of ``subvec``'s known minimum | ||||

vector length. If ``subvec`` is a scalable vector, ``idx`` is first scaled by | vector length. If ``subvec`` is a scalable vector, ``idx`` is first scaled by | ||||

the runtime scaling factor of ``subvec``. The elements of ``vec`` starting at | the runtime scaling factor of ``subvec``. The elements of ``vec`` starting at | ||||

``idx`` are overwritten with ``subvec``. Elements ``idx`` through (``idx`` + | ``idx`` are overwritten with ``subvec``. Elements ``idx`` through (``idx`` + | ||||

num_elements(``subvec``) - 1) must be valid ``vec`` indices. If this condition | num_elements(``subvec``) - 1) must be valid ``vec`` indices. If this condition | ||||

cannot be determined statically but is false at runtime, then the result vector | cannot be determined statically but is false at runtime, then the result vector | ||||

is undefined. | is undefined. | ||||

'``llvm.experimental.vector.extract``' Intrinsic | '``llvm.vector.extract``' Intrinsic | ||||

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||||

Syntax: | Syntax: | ||||

""""""" | """"""" | ||||

This is an overloaded intrinsic. You can use | This is an overloaded intrinsic. | ||||

``llvm.experimental.vector.extract`` to extract a fixed-width vector from a | |||||

scalable vector, but not the other way around. | |||||

:: | :: | ||||

declare <4 x float> @llvm.experimental.vector.extract.v4f32.nxv4f32(<vscale x 4 x float> %vec, i64 %idx) | ; Extract fixed type from scalable type | ||||

declare <2 x double> @llvm.experimental.vector.extract.v2f64.nxv2f64(<vscale x 2 x double> %vec, i64 %idx) | declare <4 x float> @llvm.vector.extract.v4f32.nxv4f32(<vscale x 4 x float> %vec, i64 <idx>) | ||||

declare <2 x double> @llvm.vector.extract.v2f64.nxv2f64(<vscale x 2 x double> %vec, i64 <idx>) | |||||

; Extract scalable type from scalable type | |||||

declare <vscale x 2 x float> @llvm.vector.extract.nxv2f32.nxv4f32(<vscale x 4 x float> %vec, i64 <idx>) | |||||

; Extract fixed type from fixed type | |||||

declare <2 x double> @llvm.vector.extract.v2f64.v4f64(<4 x double> %vec, i64 <idx>) | |||||

Overview: | Overview: | ||||

""""""""" | """"""""" | ||||

The '``llvm.experimental.vector.extract.*``' intrinsics extract a vector from | The '``llvm.vector.extract.*``' intrinsics extract a vector from within another | ||||

within another vector starting from a given index. The return type must be | vector starting from a given index. The return type must be explicitly | ||||

explicitly specified. Conceptually, this can be used to decompose a scalable | specified. Conceptually, this can be used to decompose a scalable vector into | ||||

vector into non-scalable parts. | non-scalable parts, however this intrinsic can also be used on purely fixed | ||||

Not Done ReplyInline ActionsSame here craig.topper: Same here | |||||

types. | |||||

Scalable vectors can only be extracted from other scalable vectors. | |||||

Arguments: | Arguments: | ||||

"""""""""" | """""""""" | ||||

The ``vec`` is the vector from which we will extract a subvector. | The ``vec`` is the vector from which we will extract a subvector. | ||||

The ``idx`` specifies the starting element number within ``vec`` from which a | The ``idx`` specifies the starting element number within ``vec`` from which a | ||||

subvector is extracted. ``idx`` must be a constant multiple of the known-minimum | subvector is extracted. ``idx`` must be a constant multiple of the known-minimum | ||||

▲ Show 20 Lines • Show All 7,841 Lines • Show Last 20 Lines |

For this and the other instances, please remove the

%as idx must be a literal (as documented below) but using%idxmakes it look like an arbitrary variable can be used.