- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.2k
Arm64 SVE: Fix conditionalselect with constant arguments #116852
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
          
     Merged
      
      
    
  
     Merged
                    Changes from 8 commits
      Commits
    
    
            Show all changes
          
          
            29 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      7835f72
              
                Arm64 SVE: Fix conditionalselect with constant arguments
              
              
                a74nh 18340c8
              
                Make masked EvaluateBinaryInPlace() Arm64 only
              
              
                a74nh 0d60a5e
              
                Check significantBit in EvaluateSimdVectorToPattern()
              
              
                a74nh 0a36025
              
                fix set checks in EvaluateSimdVectorToPattern
              
              
                a74nh 59107d0
              
                Use masks in EvalHWIntrinsicFunTernary() for SVE conditionalselect
              
              
                a74nh b923b28
              
                Check all of a vector lane when converting to mask
              
              
                a74nh c01bc22
              
                Add testing for EvalHWIntrinsicFunTernary changes
              
              
                a74nh f9c6dd6
              
                whitespace
              
              
                a74nh 802ae0d
              
                Revert "Check all of a vector lane when converting to mask"
              
              
                a74nh 3c3cb8f
              
                rename significantBit to leastSignificantBit
              
              
                a74nh c96e38c
              
                Use LSB of vector when converting from vector to mask
              
              
                a74nh 9d2cebd
              
                Add LowerCnsMask
              
              
                a74nh 70d601d
              
                Add testcase
              
              
                a74nh 5428e1d
              
                Remove EvaluateSimdMaskToPattern
              
              
                a74nh a2d7aea
              
                Revert "Use LSB of vector when converting from vector to mask"
              
              
                a74nh c65fd38
              
                formatting
              
              
                a74nh f513c84
              
                fix assert check
              
              
                a74nh 3bf4d1e
              
                GenTree for gtNewSimdCvtVectorToMaskNode()
              
              
                a74nh cd27a7c
              
                Split NI_Sve_ConditionalSelect into it's own case
              
              
                a74nh 7856b87
              
                Remove mask version of EvaluateBinaryInPlace
              
              
                a74nh 84d0408
              
                remove assert
              
              
                a74nh ed633f3
              
                Check all bits in EvaluateSimdCvtVectorToMask
              
              
                a74nh a53e4d1
              
                Add ConstantVectors test
              
              
                a74nh 860ff75
              
                merge main
              
              
                a74nh cd52ec1
              
                No need for DOTNET_EnableHWIntrinsic in csproj
              
              
                a74nh 748d297
              
                Use IsMaskZero
              
              
                a74nh 090523a
              
                Remove EvaluateBinarySimdAndMask
              
              
                a74nh e7034bd
              
                In lowering, default the mask type to byte
              
              
                a74nh f14fc8e
              
                In lowering, convert mask using byte basetype
              
              
                a74nh File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|  | ||
| using System; | ||
| using System.Numerics; | ||
| using System.Collections.Generic; | ||
| using System.Runtime.CompilerServices; | ||
| using System.Runtime.Intrinsics; | ||
| using System.Runtime.Intrinsics.Arm; | ||
| using Xunit; | ||
|  | ||
| public class ConditionalSelectConstants | ||
| { | ||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| [Fact] | ||
| public static int TestConditionalSelectConstants() | ||
| { | ||
| bool fail = false; | ||
|  | ||
| if (Sve.IsSupported) | ||
| { | ||
| var r1 = Sve.AddAcross(ConditionalSelect1CC()); | ||
| Console.WriteLine(r1[0]); | ||
| if (r1[0] != 15) | ||
| { | ||
| fail = true; | ||
| } | ||
|  | ||
| var r2 = Sve.AddAcross(ConditionalSelect1FT()); | ||
| Console.WriteLine(r2[0]); | ||
| if (r2[0] != -3) | ||
| { | ||
| fail = true; | ||
| } | ||
|  | ||
| var r3 = Sve.AddAcross(ConditionalSelect16TF()); | ||
| Console.WriteLine(r3[0]); | ||
| if (r3[0] != 4080) | ||
| { | ||
| fail = true; | ||
| } | ||
|  | ||
| var r4 = Sve.AddAcross(ConditionalSelect2CT()); | ||
| Console.WriteLine(r4[0]); | ||
| if (r4[0] != 16) | ||
| { | ||
| fail = true; | ||
| } | ||
|  | ||
| var r5 = ConditionalSelectConsts(); | ||
| Console.WriteLine(r5); | ||
| if (r5 != 5) | ||
| { | ||
| fail = true; | ||
| } | ||
| } | ||
|  | ||
| if (fail) | ||
| { | ||
| return 101; | ||
| } | ||
| return 100; | ||
| } | ||
|  | ||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| static Vector<int> ConditionalSelect1CC() | ||
| { | ||
| return Sve.ConditionalSelect( | ||
| Sve.CreateTrueMaskInt32(SveMaskPattern.VectorCount1), | ||
| Vector.Create<int>(3), | ||
| Vector.Create<int>(4) | ||
| ); | ||
| } | ||
|  | ||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| static Vector<int> ConditionalSelect1FT() | ||
| { | ||
| return Sve.ConditionalSelect( | ||
| Sve.CreateTrueMaskInt32(SveMaskPattern.VectorCount1), | ||
| Sve.CreateFalseMaskInt32(), | ||
| Sve.CreateTrueMaskInt32() | ||
| ); | ||
| } | ||
|  | ||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| static Vector<byte> ConditionalSelect16TF() | ||
| { | ||
| return Sve.ConditionalSelect( | ||
| Sve.CreateTrueMaskByte(SveMaskPattern.VectorCount16), | ||
| Sve.CreateTrueMaskByte(), | ||
| Sve.CreateFalseMaskByte() | ||
| ); | ||
| } | ||
|  | ||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| static Vector<int> ConditionalSelect2CT() | ||
| { | ||
| return Sve.ConditionalSelect( | ||
| Sve.CreateTrueMaskInt32(SveMaskPattern.VectorCount2), | ||
| Vector.Create<int>(9), | ||
| Sve.CreateTrueMaskInt32() | ||
| ); | ||
| } | ||
|  | ||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| static sbyte ConditionalSelectConsts() | ||
| { | ||
| var vec = Sve.ConditionalSelect(Vector128.CreateScalar((sbyte)49).AsVector(), | ||
| Vector128.CreateScalar((sbyte)0).AsVector(), | ||
| Vector.Create<sbyte>(107)); | ||
| return Sve.ConditionalExtractLastActiveElement(Vector128.CreateScalar((sbyte)0).AsVector(), 5, vec); | ||
| } | ||
| } | 
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.