Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Arm64] ASIMD InsertScalar #38137

Closed
echesakov opened this issue Jun 19, 2020 · 4 comments · Fixed by #38680
Closed

[Arm64] ASIMD InsertScalar #38137

echesakov opened this issue Jun 19, 2020 · 4 comments · Fixed by #38680
Assignees
Labels
api-approved API was approved in API review, it can be implemented arch-arm64 area-System.Runtime.Intrinsics
Milestone

Comments

@echesakov
Copy link
Contributor

echesakov commented Jun 19, 2020

These were omitted from #35037

class AdvSimd.Arm64
{
  // float64x2_t vcopyq_lane_f64 (float64x2_t a, const int lane1, float64x1_t b, const int lane2)
  //   A64: INS Vd.D[lane1], Vn.D[0]
  public static Vector128<double> InsertScalar(Vector128<double> result, byte resultIndex, Vector64<double> value);

  // int64x2_t vcopyq_lane_s64 (int64x2_t a, const int lane1, int64x1_t b, const int lane2)
  //   A64: INS Vd.D[lane1], Vn.D[0]
  public static Vector128<long> InsertScalar(Vector128<long> result, byte resultIndex, Vector64<long> value);

  // uint64x2_t vcopyq_lane_u64 (uint64x2_t a, const int lane1, uint64x1_t b, const int lane2)
  //   A64: INS Vd.D[lane1], Vn.D[0]
  public static Vector128<ulong> InsertScalar(Vector128<ulong> result, byte resultIndex, Vector64<ulong> value);
}

Motivation:
These would allow to implement Vector128.WithLower() as

AdvSimd.Arm64.InsertScalar(vector.AsUInt64(), 0, value.AsUInt64()).As<ulong, T>();

and Vector128.WithUpper() as

AdvSimd.InsertScalar(vector.AsUInt64(), 1, value.AsUInt64()).As<ulong, T>();

cc @CarolEidt @tannergooding @TamarChristinaArm

@ghost
Copy link

ghost commented Jun 19, 2020

Tagging subscribers to this area: @tannergooding
Notify danmosemsft if you want to be subscribed.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Jun 19, 2020
@echesakov echesakov added this to API design in Hardware Intrinsics Jun 19, 2020
@echesakov echesakov removed the untriaged New issue has not been triaged by the area owner label Jun 19, 2020
@TamarChristinaArm
Copy link
Contributor

Semantically speaking these intrinsics are implementable on Arm32 with a single instruction, They are all mov.I64 D{d,d+1},Dn.

We don't have them for A32 in ACLE because we don't define some of these x1_t types for AArch32.

@terrajobst terrajobst added api-approved API was approved in API review, it can be implemented and removed api-ready-for-review labels Jun 25, 2020
@terrajobst
Copy link
Member

terrajobst commented Jun 25, 2020

Video

namespace System.Runtime.Intrinsics.Arm
{
    public static class AdvSimd
    {
        public static Vector128<double> InsertScalar(Vector128<double> result, byte resultIndex, Vector64<double> value);
        public static Vector128<long>   InsertScalar(Vector128<long>   result, byte resultIndex, Vector64<long>   value);
        public static Vector128<ulong>  InsertScalar(Vector128<ulong>  result, byte resultIndex, Vector64<ulong>  value);
    }
}

@echesakov echesakov self-assigned this Jun 26, 2020
@echesakov echesakov moved this from API design to In progress in Hardware Intrinsics Jun 26, 2020
@echesakov
Copy link
Contributor Author

Semantically speaking these intrinsics are implementable on Arm32 with a single instruction, They are all mov.I64 D{d,d+1},Dn.

We don't have them for A32 in ACLE because we don't define some of these x1_t types for AArch32.

@TamarChristinaArm I meant to reply earlier on your message, but forgot. Thanks for your feedback! I will place the intrinsics under AdvSimd and alter the comment showing how to implement this on A32.

Hardware Intrinsics automation moved this from In progress to Done Jul 2, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-approved API was approved in API review, it can be implemented arch-arm64 area-System.Runtime.Intrinsics
Projects
Development

Successfully merging a pull request may close this issue.

4 participants