Skip to content

Commit 37acea2

Browse files
authored
Obsolete invalid AdvSimd.ShiftRightLogicalRoundedNarrowingSaturate* overloads (#99985)
1 parent 11b53b2 commit 37acea2

File tree

6 files changed

+31
-9
lines changed

6 files changed

+31
-9
lines changed

docs/project/list-of-diagnostics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ The PR that reveals the implementation of the `<IncludeInternalObsoleteAttribute
109109
| __`SYSLIB0052`__ | This API supports obsolete mechanisms for Regex extensibility. It is not supported. |
110110
| __`SYSLIB0053`__ | AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size. |
111111
| __`SYSLIB0054`__ | Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead. |
112+
| __`SYSLIB0055`__ | The underlying hardware instruction does not perform a signed saturate narrowing operation, and it always returns an unsigned result. Use the unsigned overload instead. |
112113

113114
## Analyzer Warnings
114115

src/libraries/Common/src/System/Obsoletions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,5 +174,8 @@ internal static class Obsoletions
174174

175175
internal const string ThreadVolatileReadWriteMessage = "Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.";
176176
internal const string ThreadVolatileReadWriteDiagId = "SYSLIB0054";
177+
178+
internal const string ArmIntrinsicPerformsUnsignedOperationMessage = "The underlying hardware instruction does not perform a signed saturate narrowing operation, and it always returns an unsigned result. Use the unsigned overload instead.";
179+
internal const string ArmIntrinsicPerformsUnsignedOperationDiagId = "SYSLIB0055";
177180
}
178181
}

src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/AdvSimd.PlatformNotSupported.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3502,18 +3502,21 @@ internal Arm64() { }
35023502
/// uint16_t vqrshrns_n_u32 (uint32_t a, const int n)
35033503
/// A64: UQRSHRN Hd, Sn, #n
35043504
/// </summary>
3505+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
35053506
public static Vector64<short> ShiftRightLogicalRoundedNarrowingSaturateScalar(Vector64<int> value, [ConstantExpected(Min = 1, Max = (byte)(16))] byte count) { throw new PlatformNotSupportedException(); }
35063507

35073508
/// <summary>
35083509
/// uint32_t vqrshrnd_n_u64 (uint64_t a, const int n)
35093510
/// A64: UQRSHRN Sd, Dn, #n
35103511
/// </summary>
3512+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
35113513
public static Vector64<int> ShiftRightLogicalRoundedNarrowingSaturateScalar(Vector64<long> value, [ConstantExpected(Min = 1, Max = (byte)(8))] byte count) { throw new PlatformNotSupportedException(); }
35123514

35133515
/// <summary>
35143516
/// uint8_t vqrshrnh_n_u16 (uint16_t a, const int n)
35153517
/// A64: UQRSHRN Bd, Hn, #n
35163518
/// </summary>
3519+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
35173520
public static Vector64<sbyte> ShiftRightLogicalRoundedNarrowingSaturateScalar(Vector64<short> value, [ConstantExpected(Min = 1, Max = (byte)(32))] byte count) { throw new PlatformNotSupportedException(); }
35183521

35193522
/// <summary>
@@ -15470,20 +15473,23 @@ internal Arm64() { }
1547015473
/// A32: VQRSHRN.U32 Dd, Qm, #n
1547115474
/// A64: UQRSHRN Vd.4H, Vn.4S, #n
1547215475
/// </summary>
15476+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
1547315477
public static Vector64<short> ShiftRightLogicalRoundedNarrowingSaturateLower(Vector128<int> value, [ConstantExpected(Min = 1, Max = (byte)(32))] byte count) { throw new PlatformNotSupportedException(); }
1547415478

1547515479
/// <summary>
1547615480
/// uint32x2_t vqrshrn_n_u64 (uint64x2_t a, const int n)
1547715481
/// A32: VQRSHRN.U64 Dd, Qm, #n
1547815482
/// A64: UQRSHRN Vd.2S, Vn.2D, #n
1547915483
/// </summary>
15484+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
1548015485
public static Vector64<int> ShiftRightLogicalRoundedNarrowingSaturateLower(Vector128<long> value, [ConstantExpected(Min = 1, Max = (byte)(16))] byte count) { throw new PlatformNotSupportedException(); }
1548115486

1548215487
/// <summary>
1548315488
/// uint8x8_t vqrshrn_n_u16 (uint16x8_t a, const int n)
1548415489
/// A32: VQRSHRN.U16 Dd, Qm, #n
1548515490
/// A64: UQRSHRN Vd.8B, Vn.8H, #n
1548615491
/// </summary>
15492+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
1548715493
public static Vector64<sbyte> ShiftRightLogicalRoundedNarrowingSaturateLower(Vector128<short> value, [ConstantExpected(Min = 1, Max = (byte)(64))] byte count) { throw new PlatformNotSupportedException(); }
1548815494

1548915495
/// <summary>
@@ -15512,20 +15518,23 @@ internal Arm64() { }
1551215518
/// A32: VQRSHRN.U32 Dd+1, Dn, #n
1551315519
/// A64: UQRSHRN2 Vd.8H, Vn.4S, #n
1551415520
/// </summary>
15521+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
1551515522
public static Vector128<short> ShiftRightLogicalRoundedNarrowingSaturateUpper(Vector64<short> lower, Vector128<int> value, [ConstantExpected(Min = 1, Max = (byte)(32))] byte count) { throw new PlatformNotSupportedException(); }
1551615523

1551715524
/// <summary>
1551815525
/// uint32x4_t vqrshrn_high_n_u64 (uint32x2_t r, uint64x2_t a, const int n)
1551915526
/// A32: VQRSHRN.U64 Dd+1, Dn, #n
1552015527
/// A64: UQRSHRN2 Vd.4S, Vn.2D, #n
1552115528
/// </summary>
15529+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
1552215530
public static Vector128<int> ShiftRightLogicalRoundedNarrowingSaturateUpper(Vector64<int> lower, Vector128<long> value, [ConstantExpected(Min = 1, Max = (byte)(16))] byte count) { throw new PlatformNotSupportedException(); }
1552315531

1552415532
/// <summary>
1552515533
/// uint8x16_t vqrshrn_high_n_u16 (uint8x8_t r, uint16x8_t a, const int n)
1552615534
/// A32: VQRSHRN.U16 Dd+1, Dn, #n
1552715535
/// A64: UQRSHRN2 Vd.16B, Vn.8H, #n
1552815536
/// </summary>
15537+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
1552915538
public static Vector128<sbyte> ShiftRightLogicalRoundedNarrowingSaturateUpper(Vector64<sbyte> lower, Vector128<short> value, [ConstantExpected(Min = 1, Max = (byte)(64))] byte count) { throw new PlatformNotSupportedException(); }
1553015539

1553115540
/// <summary>

src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/AdvSimd.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3500,18 +3500,21 @@ internal Arm64() { }
35003500
/// uint16_t vqrshrns_n_u32 (uint32_t a, const int n)
35013501
/// A64: UQRSHRN Hd, Sn, #n
35023502
/// </summary>
3503+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
35033504
public static Vector64<short> ShiftRightLogicalRoundedNarrowingSaturateScalar(Vector64<int> value, [ConstantExpected(Min = 1, Max = (byte)(16))] byte count) => ShiftRightLogicalRoundedNarrowingSaturateScalar(value, count);
35043505

35053506
/// <summary>
35063507
/// uint32_t vqrshrnd_n_u64 (uint64_t a, const int n)
35073508
/// A64: UQRSHRN Sd, Dn, #n
35083509
/// </summary>
3510+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
35093511
public static Vector64<int> ShiftRightLogicalRoundedNarrowingSaturateScalar(Vector64<long> value, [ConstantExpected(Min = 1, Max = (byte)(8))] byte count) => ShiftRightLogicalRoundedNarrowingSaturateScalar(value, count);
35103512

35113513
/// <summary>
35123514
/// uint8_t vqrshrnh_n_u16 (uint16_t a, const int n)
35133515
/// A64: UQRSHRN Bd, Hn, #n
35143516
/// </summary>
3517+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
35153518
public static Vector64<sbyte> ShiftRightLogicalRoundedNarrowingSaturateScalar(Vector64<short> value, [ConstantExpected(Min = 1, Max = (byte)(32))] byte count) => ShiftRightLogicalRoundedNarrowingSaturateScalar(value, count);
35163519

35173520
/// <summary>
@@ -15467,20 +15470,23 @@ internal Arm64() { }
1546715470
/// A32: VQRSHRN.U32 Dd, Qm, #n
1546815471
/// A64: UQRSHRN Vd.4H, Vn.4S, #n
1546915472
/// </summary>
15473+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
1547015474
public static Vector64<short> ShiftRightLogicalRoundedNarrowingSaturateLower(Vector128<int> value, [ConstantExpected(Min = 1, Max = (byte)(32))] byte count) => ShiftRightLogicalRoundedNarrowingSaturateLower(value, count);
1547115475

1547215476
/// <summary>
1547315477
/// uint32x2_t vqrshrn_n_u64 (uint64x2_t a, const int n)
1547415478
/// A32: VQRSHRN.U64 Dd, Qm, #n
1547515479
/// A64: UQRSHRN Vd.2S, Vn.2D, #n
1547615480
/// </summary>
15481+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
1547715482
public static Vector64<int> ShiftRightLogicalRoundedNarrowingSaturateLower(Vector128<long> value, [ConstantExpected(Min = 1, Max = (byte)(16))] byte count) => ShiftRightLogicalRoundedNarrowingSaturateLower(value, count);
1547815483

1547915484
/// <summary>
1548015485
/// uint8x8_t vqrshrn_n_u16 (uint16x8_t a, const int n)
1548115486
/// A32: VQRSHRN.U16 Dd, Qm, #n
1548215487
/// A64: UQRSHRN Vd.8B, Vn.8H, #n
1548315488
/// </summary>
15489+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
1548415490
public static Vector64<sbyte> ShiftRightLogicalRoundedNarrowingSaturateLower(Vector128<short> value, [ConstantExpected(Min = 1, Max = (byte)(64))] byte count) => ShiftRightLogicalRoundedNarrowingSaturateLower(value, count);
1548515491

1548615492
/// <summary>
@@ -15509,20 +15515,23 @@ internal Arm64() { }
1550915515
/// A32: VQRSHRN.U32 Dd+1, Dn, #n
1551015516
/// A64: UQRSHRN2 Vd.8H, Vn.4S, #n
1551115517
/// </summary>
15518+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
1551215519
public static Vector128<short> ShiftRightLogicalRoundedNarrowingSaturateUpper(Vector64<short> lower, Vector128<int> value, [ConstantExpected(Min = 1, Max = (byte)(32))] byte count) => ShiftRightLogicalRoundedNarrowingSaturateUpper(lower, value, count);
1551315520

1551415521
/// <summary>
1551515522
/// uint32x4_t vqrshrn_high_n_u64 (uint32x2_t r, uint64x2_t a, const int n)
1551615523
/// A32: VQRSHRN.U64 Dd+1, Dn, #n
1551715524
/// A64: UQRSHRN2 Vd.4S, Vn.2D, #n
1551815525
/// </summary>
15526+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
1551915527
public static Vector128<int> ShiftRightLogicalRoundedNarrowingSaturateUpper(Vector64<int> lower, Vector128<long> value, [ConstantExpected(Min = 1, Max = (byte)(16))] byte count) => ShiftRightLogicalRoundedNarrowingSaturateUpper(lower, value, count);
1552015528

1552115529
/// <summary>
1552215530
/// uint8x16_t vqrshrn_high_n_u16 (uint8x8_t r, uint16x8_t a, const int n)
1552315531
/// A32: VQRSHRN.U16 Dd+1, Dn, #n
1552415532
/// A64: UQRSHRN2 Vd.16B, Vn.8H, #n
1552515533
/// </summary>
15534+
[Obsolete(Obsoletions.ArmIntrinsicPerformsUnsignedOperationMessage, DiagnosticId = Obsoletions.ArmIntrinsicPerformsUnsignedOperationDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
1552615535
public static Vector128<sbyte> ShiftRightLogicalRoundedNarrowingSaturateUpper(Vector64<sbyte> lower, Vector128<short> value, [ConstantExpected(Min = 1, Max = (byte)(64))] byte count) => ShiftRightLogicalRoundedNarrowingSaturateUpper(lower, value, count);
1552715536

1552815537
/// <summary>

0 commit comments

Comments
 (0)