-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JIT: Fix LowerHWIntrinsicGetElement for xarch (#104987)
Ensure we don't reorder evaluation and change exceptional behavior. Closes #89565. Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
- Loading branch information
1 parent
c95095e
commit 2d17105
Showing
3 changed files
with
100 additions
and
2 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
55 changes: 55 additions & 0 deletions
55
src/tests/JIT/Regression/JitBlue/Runtime_89565/Runtime_89565.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,55 @@ | ||
// 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.Runtime.CompilerServices; | ||
using System.Runtime.Intrinsics; | ||
using Xunit; | ||
|
||
public class Runtime_89565 | ||
{ | ||
[Fact] | ||
public static unsafe int Test() | ||
{ | ||
int result = 0; | ||
try | ||
{ | ||
Foo(null); | ||
} | ||
catch (NullReferenceException) | ||
{ | ||
result += 50; | ||
} | ||
catch | ||
{ | ||
|
||
} | ||
|
||
try | ||
{ | ||
Bar(null, 0); | ||
} | ||
catch (DivideByZeroException) | ||
{ | ||
result += 50; | ||
} | ||
catch | ||
{ | ||
|
||
} | ||
|
||
return result; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static unsafe float Foo(Vector256<float>* v) | ||
{ | ||
return (*v)[8]; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static unsafe float Bar(Vector256<float>* v, int x) | ||
{ | ||
return (*v)[8/x]; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/tests/JIT/Regression/JitBlue/Runtime_89565/Runtime_89565.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,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |