Skip to content

Commit

Permalink
Describe reinterpret intrinsics for vector and vector tuple types
Browse files Browse the repository at this point in the history
Change-Id: Iba0e37d8b12debe34edae3bb8350bb1ef80a616a
  • Loading branch information
momchil-velikov committed Oct 19, 2023
1 parent db46654 commit 06914fd
Showing 1 changed file with 53 additions and 12 deletions.
65 changes: 53 additions & 12 deletions main/acle.md
Original file line number Diff line number Diff line change
Expand Up @@ -5927,18 +5927,6 @@ definition of `bfloat16_t` (see [Scalar types defined by
`<arm_sve.h>`](#scalar-types-defined-by-arm_sve.h)). The other
types are available unconditionally.

ACLE provides two sets of intrinsics for converting between vector types:

* The [`svreinterpret`](https://developer.arm.com/architectures/instruction-sets/intrinsics/#q=svreinterpret)
intrinsics simply reinterpret a vector of one type as a vector of another
type, without changing any of the bits.

* The [`svcvt`](https://developer.arm.com/architectures/instruction-sets/intrinsics/#q=svcvt_)
intrinsics instead perform numerical conversion from one type to another,
such as converting integers to floating-point values.

To avoid any ambiguity between the two operations, ACLE does not allow
C-style casting from one vector type to another.

[`<arm_sve.h>`](#arm_sve.h) also defines tuples of two, three, and four
vectors, as follows:
Expand Down Expand Up @@ -5998,6 +5986,59 @@ vectors using [`svundef`](https://developer.arm.com/architectures/instruction-se
[`svundef3`](https://developer.arm.com/architectures/instruction-sets/intrinsics/#q=svundef3) and
[`svundef4`](https://developer.arm.com/architectures/instruction-sets/intrinsics/#q=svundef4).

ACLE provides two sets of intrinsics for converting between vector types:

* The [`svreinterpret`](https://developer.arm.com/architectures/instruction-sets/intrinsics/#q=svreinterpret)
intrinsics simply reinterpret a vector of one type as a vector of another
type, without changing any of the bits.

* The [`svcvt`](https://developer.arm.com/architectures/instruction-sets/intrinsics/#q=svcvt_)
intrinsics instead perform numerical conversion from one type to another,
such as converting integers to floating-point values.

To avoid any ambiguity between the two operations, ACLE does not allow
C-style casting from one vector type to another.

The `svreinterpret` intrinsics for vector types take the form

```
sv<dst>_t svreinterpret_<dst>_<src>(sv<src>_t op);
```

where `<src>` denotes the source type and `<dst>` denotes the destination type,
across all pairs choosen from `{s8, u8, s16, u16, s32, u32, s64, u64, bf16, f16, f32, f64}`

A shorter, overloaded form is also available in which the destintion type is spelled explicitly
and the source type is deduced from the argument:

```
sv<dst>_t svreinterpret_<dst>(sv<src>_t op);
```

The `svreinterpret` intrinsics for vector tuple types take the form

```
sv<dst>x<N>_t svreinterpret_<dst>_<src>_x<N>(sv<src>x<N>_t op)
```

where <src> and <dst> is as for above for vector type and `<N>` denotes the number of tuple
element, 2 or 4.

A shorter, overloaded form is also available in which the destintion type is spelled explicitly
and the source type is deduced from the argument:

```
sv<dst>x<N>_t svreinterpret_<dst>(sv<src>x<N>_t op)
```

For example:
``` c
svuin16_t svreinterpret_u16_s32(svint32_t op);
svuin16_t svreinterpret_u16(svint32_t op);
svuin16x2_t svreinterpret_u16_s32_x2(svint32x2_t op);
svuin16x2_t svreinterpret_u16(svint32x2_t op);
```

### SVE predicate types

[`<arm_sve.h>`](#arm_sve.h) defines a single sizeless predicate type
Expand Down

0 comments on commit 06914fd

Please sign in to comment.