-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that we don't try to constant fold BSF(0) or BSR(0) (#81516)
* Ensure that we don't try to constant fold BSF(0) or BSR(0) * Ensure the test returns 100 and has correct usings * Apply formatting patch
- Loading branch information
1 parent
60fa29b
commit 4354abd
Showing
3 changed files
with
62 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
25 changes: 25 additions & 0 deletions
25
src/tests/JIT/Regression/JitBlue/Runtime_81460/Runtime_81460.cs
This file contains 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,25 @@ | ||
// 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.Runtime.CompilerServices; | ||
|
||
public static class FloatingPointHelper<TSelf> | ||
where TSelf : IFloatingPoint<TSelf> | ||
{ | ||
public static int GetExponentShortestBitLength(TSelf value) | ||
=> value.GetExponentShortestBitLength(); | ||
} | ||
|
||
class Runtime_81460 | ||
{ | ||
static int Main() | ||
{ | ||
return (Test() == 0) ? 100 : 0; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
public static int Test() => | ||
FloatingPointHelper<double>.GetExponentShortestBitLength(1.0); | ||
} |
9 changes: 9 additions & 0 deletions
9
src/tests/JIT/Regression/JitBlue/Runtime_81460/Runtime_81460.csproj
This file contains 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,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |