Skip to content

Arm SVE: Add merge versions of CreateBreak APIs #117722

Open

Description

@a74nh

Background and motivation

Currently we have (approved in #98184)

        /// <summary>
        ///   <para>svbool_t svbrka[_b]_z(svbool_t pg, svbool_t op)</para>
        ///   <para>  BRKA Presult.B, Pg/Z, Pop.B</para>
        /// </summary>
        public static Vector<byte> CreateBreakAfterMask(Vector<byte> totalMask, Vector<byte> fromMask);

This uses the zeroing version of the instruction. ie: every lane in totalMask that is empty will be zeroed in the result.

If the user wanted to use the merging version, then they could do:

x = Sve.ConditionalSelect(mask, Sve.CreateBreakAfterMask(mask, op1), op1);

Alternatively, we could add new APIs.

For background see #104486 and #104184 (comment)

API Proposal

  /// T: sbyte, short, int, long, byte, ushort, uint, ulong
  public static unsafe Vector<T> CreateBreakAfterMaskMerging(Vector<T> mask, Vector<T> from); // BRKA // predicated

  /// T: sbyte, short, int, long, byte, ushort, uint, ulong
  public static unsafe Vector<T> CreateBreakAfterPropagateMaskMerging(Vector<T> mask, Vector<T> left, Vector<T> right); // BRKPA

  /// T: sbyte, short, int, long, byte, ushort, uint, ulong
  public static unsafe Vector<T> CreateBreakBeforeMaskMerging(Vector<T> mask, Vector<T> from); // BRKB // predicated

  /// T: sbyte, short, int, long, byte, ushort, uint, ulong
  public static unsafe Vector<T> CreateBreakBeforePropagateMaskMerging(Vector<T> mask, Vector<T> left, Vector<T> right); // BRKPB

These are identical to the existing CreateBreak APIs, except that they use the merge variants.

Activity

  1. added
    untriaged
    on Jul 16, 2025
  2. dotnet-policy-service commented on Jul 16, 2025

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics
    See info in area-owners.md if you want to be subscribed.

  3. added
    api-suggestion
    arm-sve
    and removed
    untriaged
    on Jul 16, 2025
  4. added this to the 11.0.0 milestone on Jul 26, 2025
  5. modified the milestones: 11.0.0, 12.0.0 on Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestionarea-System.Runtime.Intrinsicsarm-sve

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions