Skip to content

Conversation

@amilendra
Copy link
Contributor


name: Pull request
about: Technical issues, document format problems, bugs in scripts or feature proposal.


Thank you for submitting a pull request!

If this PR is about a bugfix:

Please use the bugfix label and make sure to go through the checklist below.

If this PR is about a proposal:

We are looking forward to evaluate your proposal, and if possible to
make it part of the Arm C Language Extension (ACLE) specifications.

We would like to encourage you reading through the contribution
guidelines
, in particular the section on submitting
a proposal
.

Please use the proposal label.

As for any pull request, please make sure to go through the below
checklist.

Checklist: (mark with X those which apply)

  • If an issue reporting the bug exists, I have mentioned it in the
    PR (do not bother creating the issue if all you want to do is
    fixing the bug yourself).
  • I have added/updated the SPDX-FileCopyrightText lines on top
    of any file I have edited. Format is SPDX-FileCopyrightText: Copyright {year} {entity or name} <{contact informations}>
    (Please update existing copyright lines if applicable. You can
    specify year ranges with hyphen , as in 2017-2019, and use
    commas to separate gaps, as in 2018-2020, 2022).
  • I have updated the Copyright section of the sources of the
    specification I have edited (this will show up in the text
    rendered in the PDF and other output format supported). The
    format is the same described in the previous item.
  • I have run the CI scripts (if applicable, as they might be
    tricky to set up on non-*nix machines). The sequence can be
    found in the contribution
    guidelines
    . Don't
    worry if you cannot run these scripts on your machine, your
    patch will be automatically checked in the Actions of the pull
    request.
  • I have added an item that describes the changes I have
    introduced in this PR in the section Changes for next
    release
    of the section Change Control/Document history
    of the document. Create Changes for next release if it does
    not exist. Notice that changes that are not modifying the
    content and rendering of the specifications (both HTML and PDF)
    do not need to be listed.
  • When modifying content and/or its rendering, I have checked the
    correctness of the result in the PDF output (please refer to the
    instructions on how to build the PDFs
    locally
    ).
  • The variable draftversion is set to true in the YAML header
    of the sources of the specifications I have modified.
  • Please DO NOT add my GitHub profile to the list of contributors
    in the README page of the project.

@AlfieRichardsArm
Copy link
Contributor

AlfieRichardsArm commented Sep 18, 2025

This seems to be missing
- the zeroing forms of all the unary instructions added in S(M|V)E2p2? Such as NOT (zeroing) and REVB (zeroing) and lots more.
- FRECPX
- FSQRT

Will they be added separately?

Corrected offline that these intrinsics are all already present, and will just be simplified by the new instructions.

main/acle.md Outdated
[`<arm_sve.h>`](#arm_sve.h) or [`<arm_sme.h>`](#arm_sme.h)
when `__ARM_FEATURE_SVE2p2` or `__ARM_FEATURE_SME2p2` is defined, respectively.

These intrinsics can only be called from non-streaming code if
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is not correct. These instruction can be called in non-streaming mode if we have sme2p2 and sve as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For FIRSTP and LASTP you can also run them in streaming mode if you have sve2p2 and sme.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the conditions. Please can you have another look?

@amilendra amilendra force-pushed the 2025-acle-sve-sme2p2 branch from 137ff03 to 7de9269 Compare October 1, 2025 15:02
@amilendra amilendra changed the title Add support for COMPACT/EXPAND and FIRSTP/LASTP intrinsics Add intrinsics for the FEAT_SVE2p2/FEAT_SME2p2 features introduced by the 2024 dpISA Oct 2, 2025
Copy link
Contributor

@Lukacma Lukacma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

main/acle.md Outdated
`__ARM_FEATURE_SME2p2` feature macro is defined.

They can be called from non-streaming code if the `__ARM_FEATURE_SVE2p2` feature
macro is defined or both the `__ARM_FEATURE_SVE` and `__ARM_FEATURE_SME2p2`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this is correct:
__ARM_FEATURE_SVE and __ARM_FEATURE_SME2p2
should it be:
__ARM_FEATURE_SME and __ARM_FEATURE_SME2p2
Why are you writing that it needs SVE, have you seeing this in the pseudo code from the instruction?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Actually that is something I understood from the pseudocode.

For example the psuedocode of COMPACT checks for SVE

It was not immediately obvious to me either, and was pointed out by @Lukacma

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The size that is now available also in sme2p2 and sve is Word and doubleword.
You are adding new ones that are only available for sve2p2 or sme2p2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed those conditions because it is simply repeating information already available in the ISA docs.

main/acle.md Outdated

Scalar index of first/last true predicate element (predicated).

These intrinsics can be called from streaming mode if either of the feature
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is incorrect. Can you remove these sentences?
They need sve2p2 or sme2p2, there is nothing saying about sve or sme.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to COMPACT, this is also something I understood from the CheckSVEEnabled pseudocode used by FIRSTP

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is when the instructions is defined:
if !IsFeatureImplemented(FEAT_SVE2p2) && !IsFeatureImplemented(FEAT_SME2p2) then
CheckSVEEnabled is how it will run, in streaming mode or sve.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed those conditions because it is simply repeating information already available in the ISA docs.

main/acle.md Outdated

Copy active vector elements to/from lower-numbered elements.

These intrinsics can be called from streaming code only if the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this sentence are applied to all sve2p2 and sme2p2 instruction you can move it up. After line 13601

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed those conditions because it is simply repeating information already available in the ISA docs.

@amilendra amilendra force-pushed the 2025-acle-sve-sme2p2 branch from ff8fbf9 to 777686d Compare October 7, 2025 15:48

``` c
// Variants are also available for:
// [_single_f32_x2]
Copy link
Contributor

@Lukacma Lukacma Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should split this into x2 and x4 variants. I think this might confuse users as to what type to use for arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've split them up. Does this look okay?

These instructions are available under features FEAT_SVE2p2 or FEAT_SME2p2.

COMPACT: Copy Active vector elements to lower-numbered elements (Byte/Halfword variants)
EXPAND: Copy lower-numbered vector elements to Active elements (Byte/Halfword/Word/Doubleword variants)
FIRSTP: Scalar index of first true predicate element (predicated) (Byte/Halfword/Word/Doubleword variants)
LASTP: Scalar index of last true predicate element (predicated) (Byte/Halfword/Word/Doubleword variants)
FMUL (multiple and single vector): Multi-vector floating-point multiply by vector
FMUL (multiple vectors): Multi-vector floating-point multiply
1. Change firstp/lastp parameter names to match the register names: op -> pn
2. split the x2 and x4 variants of the FMUL intrinsics
@amilendra amilendra force-pushed the 2025-acle-sve-sme2p2 branch from 5f3e66f to 29f8554 Compare October 24, 2025 12:42
extended in the future.

The intrinsics in this section are defined by the header file
[`<arm_sme.h>`](#arm_sme.h) when `__ARM_FEATURE_SME2p2` is defined.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these instructions do not operate on ZA array, I think they should be in arm_sve.h.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After internal discusion this whole system of specifying header files will be overhauled, so no changes necessary here until then

@CarolineConcatto
Copy link
Contributor

We need to add these new instructions also:
FRINT32X
FRINT32Z
FRINT64X
FRINT64Z
They are sve2p2 as well

main/acle.md Outdated
```c

// Variant is available for _f64
svfloat32_t frint32x[_f32]_z(svbool_t pg, svfloat32_t zn);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should be:
s /frint/svrint/g

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

main/acle.md Outdated
// _f32_f64, _bf16_f32
svfloat16_t svcvtnt_f16[_f32]_z (svfloat16_t even, svbool_t pg, svfloat32_t op)

svfloat32_t svcvtxnt_f32[_f64]_z (svfloat32_t even, svbool_t pg, svfloat64_t op);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: space between the function name and the parameters

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

CarolineConcatto added a commit to CarolineConcatto/llvm-project that referenced this pull request Nov 26, 2025
This patch add supports in Clang for these assembly intrinsics:

FRINT32X
FRINT32Z
FRINT64X
FRINT64Z

By adding support for these intrinsics:

// Variant is available for _f64
svfloat32_t svrint32x[_f32]_z(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint32x[_f32]_x(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint32x[_f32]_m(svfloat32_t inactive, svbool_t pg, svfloat32_t zn);

// Variant is available for _f64
svfloat32_t svrint32z[_f32]_z(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint32z[_f32]_x(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint32z[_f32]_m(svfloat32_t inactive, svbool_t pg, svfloat32_t zn);

// Variant is available for _f64
svfloat32_t svrint64x[_f32]_z(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint64x[_f32]_x(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint64x[_f32]_m(svfloat32_t inactive, svbool_t pg, svfloat32_t zn);

// Variant is available for _f64
svfloat32_t svrint64z[_f32]_z(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint64z[_f32]_x(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint64z[_f32]_m(svfloat32_t inactive, svbool_t pg, svfloat32_t zn);
```
according to the ACLE[1]

[1]ARM-software/acle#412
CarolineConcatto added a commit to CarolineConcatto/llvm-project that referenced this pull request Nov 26, 2025
This patch add supports in Clang for these assembly intrinsics:

FRINT32X
FRINT32Z
FRINT64X
FRINT64Z

By adding support for these intrinsics:

// Variant is available for _f64
svfloat32_t svrint32x[_f32]_z(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint32x[_f32]_x(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint32x[_f32]_m(svfloat32_t inactive, svbool_t pg, svfloat32_t zn);

// Variant is available for _f64
svfloat32_t svrint32z[_f32]_z(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint32z[_f32]_x(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint32z[_f32]_m(svfloat32_t inactive, svbool_t pg, svfloat32_t zn);

// Variant is available for _f64
svfloat32_t svrint64x[_f32]_z(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint64x[_f32]_x(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint64x[_f32]_m(svfloat32_t inactive, svbool_t pg, svfloat32_t zn);

// Variant is available for _f64
svfloat32_t svrint64z[_f32]_z(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint64z[_f32]_x(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint64z[_f32]_m(svfloat32_t inactive, svbool_t pg, svfloat32_t zn);
```
according to the ACLE[1]

[1]ARM-software/acle#412
CarolineConcatto added a commit to CarolineConcatto/llvm-project that referenced this pull request Nov 26, 2025
This patch add supports in Clang for these assembly intrinsics:

FRINT32X
FRINT32Z
FRINT64X
FRINT64Z

By adding support for these intrinsics:

// Variant is available for _f64
svfloat32_t svrint32x[_f32]_z(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint32x[_f32]_x(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint32x[_f32]_m(svfloat32_t inactive, svbool_t pg, svfloat32_t zn);

// Variant is available for _f64
svfloat32_t svrint32z[_f32]_z(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint32z[_f32]_x(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint32z[_f32]_m(svfloat32_t inactive, svbool_t pg, svfloat32_t zn);

// Variant is available for _f64
svfloat32_t svrint64x[_f32]_z(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint64x[_f32]_x(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint64x[_f32]_m(svfloat32_t inactive, svbool_t pg, svfloat32_t zn);

// Variant is available for _f64
svfloat32_t svrint64z[_f32]_z(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint64z[_f32]_x(svbool_t pg, svfloat32_t zn);
// Variant is available for _f64
svfloat32_t svrint64z[_f32]_m(svfloat32_t inactive, svbool_t pg, svfloat32_t zn);
```
according to the ACLE[1]

[1]ARM-software/acle#412
main/acle.md Outdated

// Variants are available for:
// _f32_f64, _bf16_f32
svfloat16_t svcvtnt_f16[_f32]_z (svfloat16_t even, svbool_t pg, svfloat32_t op)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing comma at the end of the intrinsic

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

CarolineConcatto added a commit to CarolineConcatto/llvm-project that referenced this pull request Dec 2, 2025
…rinsics

This patch adds support in Clang for these assembly instructions
FCVTXNT, FCVTLT, {B}FCVTNT
By implementing these prototypes:

// Variant is available for _f64_f32
svfloat32_t	svcvtlt_f32[_f16]_z	(svbool_t pg, svfloat16_t op);

// Variants are available for:
// _f32_f64, _bf16_f32
svfloat16_t	svcvtnt_f16[_f32]_z	(svfloat16_t even, svbool_t pg, svfloat32_t op);

svfloat32_t	svcvtxnt_f32[_f64]_z (svfloat32_t even, svbool_t pg, svfloat64_t op);

according to the ACLE[1]

[1] ARM-software/acle#412
Lukacma added a commit to llvm/llvm-project that referenced this pull request Dec 9, 2025
This patch adds intrinsics for multi-vector FMUL instructions introduced
in armv9.6, based on
[this](ARM-software/acle#412) ACLE proposal.

Depends on #163536

Intrinsics implemented:

//BFMUL:
svbfloat16x2_t svmul[_bf16_x2](svbfloat16x2_t zd, svbfloat16x2_t zm) __arm_streaming;
svbfloat16x2_t svmul[_single_bf16_x2](svbfloat16x2_t zd, svbfloat16_t zm) __arm_streaming;
svbfloat16x4_t svmul[_bf16_x4](svbfloat16x4_t zd, svbfloat16x4_t zm) __arm_streaming;
svbfloat16x4_t svmul[_single_bf16_x4](svbfloat16x4_t zd, svbfloat16_t zm) __arm_streaming;
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Dec 9, 2025
…63397)

This patch adds intrinsics for multi-vector FMUL instructions introduced
in armv9.6, based on
[this](ARM-software/acle#412) ACLE proposal.

Depends on #163536

Intrinsics implemented:

//BFMUL:
svbfloat16x2_t svmul[_bf16_x2](svbfloat16x2_t zd, svbfloat16x2_t zm) __arm_streaming;
svbfloat16x2_t svmul[_single_bf16_x2](svbfloat16x2_t zd, svbfloat16_t zm) __arm_streaming;
svbfloat16x4_t svmul[_bf16_x4](svbfloat16x4_t zd, svbfloat16x4_t zm) __arm_streaming;
svbfloat16x4_t svmul[_single_bf16_x4](svbfloat16x4_t zd, svbfloat16_t zm) __arm_streaming;
CarolineConcatto added a commit to CarolineConcatto/llvm-project that referenced this pull request Dec 10, 2025
…rinsics

This patch adds support in Clang for these assembly instructions
FCVTXNT, FCVTLT, {B}FCVTNT
By implementing these prototypes:

// Variant is available for _f64_f32
svfloat32_t	svcvtlt_f32[_f16]_z	(svbool_t pg, svfloat16_t op);

// Variants are available for:
// _f32_f64, _bf16_f32
svfloat16_t	svcvtnt_f16[_f32]_z	(svfloat16_t even, svbool_t pg, svfloat32_t op);

svfloat32_t	svcvtxnt_f32[_f64]_z (svfloat32_t even, svbool_t pg, svfloat64_t op);

according to the ACLE[1]

[1] ARM-software/acle#412
Lukacma added a commit to llvm/llvm-project that referenced this pull request Dec 16, 2025
This patch add intrinsics for SVE2p2 instructions defined in
[this](ARM-software/acle#412) ACLE proposal.
Intrinsics added:

```
  // Variants are available for:
  // _s8, _s16, _u16, _mf8, _bf16, _f16
  svuint8_t svcompact[_u8](svbool_t pg, svuint8_t zn);

  // Variants are available for:
  // _s8, _s16, _u16, _s32, _u32, _s64, _u64
  // _mf8, _bf16, _f16, _f32, _f64
  svuint8_t svexpand[_u8](svbool_t pg, svuint8_t zn);

  // Variants are available for:
  // _b16, _b32, _b64
  int64_t svfirstp_b8(svbool_t pg, svbool_t pn);

  // Variants are available for:
  // _b16, _b32, _b64
  int64_t svlastp_b8(svbool_t pg, svbool_t pn);
```

It also generates Sema tests using aarch64_builtins_test_generator
script for some previously merged intrinsics patches, which were merged
without regenerating.

---------

Co-authored-by: Kerry McLaughlin <kerry.mclaughlin@arm.com>
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Dec 16, 2025
…#163575)

This patch add intrinsics for SVE2p2 instructions defined in
[this](ARM-software/acle#412) ACLE proposal.
Intrinsics added:

```
  // Variants are available for:
  // _s8, _s16, _u16, _mf8, _bf16, _f16
  svuint8_t svcompact[_u8](svbool_t pg, svuint8_t zn);

  // Variants are available for:
  // _s8, _s16, _u16, _s32, _u32, _s64, _u64
  // _mf8, _bf16, _f16, _f32, _f64
  svuint8_t svexpand[_u8](svbool_t pg, svuint8_t zn);

  // Variants are available for:
  // _b16, _b32, _b64
  int64_t svfirstp_b8(svbool_t pg, svbool_t pn);

  // Variants are available for:
  // _b16, _b32, _b64
  int64_t svlastp_b8(svbool_t pg, svbool_t pn);
```

It also generates Sema tests using aarch64_builtins_test_generator
script for some previously merged intrinsics patches, which were merged
without regenerating.

---------

Co-authored-by: Kerry McLaughlin <kerry.mclaughlin@arm.com>
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Dec 19, 2025
This patch add intrinsics for SVE2p2 instructions defined in
[this](ARM-software/acle#412) ACLE proposal.
Intrinsics added:

```
  // Variants are available for:
  // _s8, _s16, _u16, _mf8, _bf16, _f16
  svuint8_t svcompact[_u8](svbool_t pg, svuint8_t zn);

  // Variants are available for:
  // _s8, _s16, _u16, _s32, _u32, _s64, _u64
  // _mf8, _bf16, _f16, _f32, _f64
  svuint8_t svexpand[_u8](svbool_t pg, svuint8_t zn);

  // Variants are available for:
  // _b16, _b32, _b64
  int64_t svfirstp_b8(svbool_t pg, svbool_t pn);

  // Variants are available for:
  // _b16, _b32, _b64
  int64_t svlastp_b8(svbool_t pg, svbool_t pn);
```

It also generates Sema tests using aarch64_builtins_test_generator
script for some previously merged intrinsics patches, which were merged
without regenerating.

---------

Co-authored-by: Kerry McLaughlin <kerry.mclaughlin@arm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants