Repository navigation
Closed
Labels
Milestone
Description
With #62436 we added a new ConstantExpectedAttribute to express that only constant value is expected for a parameter. Now we need to apply that parameter to the APIs parameters needs it. This issue is for tracking the APIs needs this attribute
As far as I know, we need to add this to the byte count parameter for the following APIs:
runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx2.cs
Lines 2137 to 2162 in 4427c56
| public static Vector256<short> ShiftLeftLogical(Vector256<short> value, byte count) => ShiftLeftLogical(value, count); | |
| /// <summary> | |
| /// __m256i _mm256_slli_epi16 (__m256i a, int imm8) | |
| /// VPSLLW ymm, ymm, imm8 | |
| /// </summary> | |
| public static Vector256<ushort> ShiftLeftLogical(Vector256<ushort> value, byte count) => ShiftLeftLogical(value, count); | |
| /// <summary> | |
| /// __m256i _mm256_slli_epi32 (__m256i a, int imm8) | |
| /// VPSLLD ymm, ymm, imm8 | |
| /// </summary> | |
| public static Vector256<int> ShiftLeftLogical(Vector256<int> value, byte count) => ShiftLeftLogical(value, count); | |
| /// <summary> | |
| /// __m256i _mm256_slli_epi32 (__m256i a, int imm8) | |
| /// VPSLLD ymm, ymm, imm8 | |
| /// </summary> | |
| public static Vector256<uint> ShiftLeftLogical(Vector256<uint> value, byte count) => ShiftLeftLogical(value, count); | |
| /// <summary> | |
| /// __m256i _mm256_slli_epi64 (__m256i a, int imm8) | |
| /// VPSLLQ ymm, ymm, imm8 | |
| /// </summary> | |
| public static Vector256<long> ShiftLeftLogical(Vector256<long> value, byte count) => ShiftLeftLogical(value, count); | |
| /// <summary> | |
| /// __m256i _mm256_slli_epi64 (__m256i a, int imm8) | |
| /// VPSLLQ ymm, ymm, imm8 | |
| /// </summary> | |
| public static Vector256<ulong> ShiftLeftLogical(Vector256<ulong> value, byte count) => ShiftLeftLogical(value, count); |
@GrabYourPitchforks @tannergooding please add the other APIs/parameters needs the attribute.
See @stephentoub's comment in #62436 (comment)
Activity
wzchua commentedon May 29, 2022
If I'm not mistaken the intrinsic that has imm8 would need the attribute
wzchua commentedon Jul 30, 2022
I have looked into this as part of testing the analyzer in dotnet/roslyn-analyzers#5766
what I have at the moment https://github.com/wzchua/runtime/commits/constantexpected
buyaa-n commentedon Aug 2, 2022
@tannergooding please check @wzchua's commits that applying the attributes, or do you want them to raise a PR? Probably that is easier for review and discuss if needed
tannergooding commentedon Jul 23, 2026
We've applied this to all the relevant intrinsics already