Skip to content
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

[release/9.0-rc1] JIT: update simd base type when combining simd nodes for bitwise ops #106520

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/coreclr/jit/lowerxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1430,10 +1430,9 @@ GenTree* Lowering::LowerHWIntrinsic(GenTreeHWIntrinsic* node)
const uint8_t B = 0xCC;
const uint8_t C = 0xAA;

var_types simdType = node->TypeGet();
CorInfoType simdBaseJitType = node->GetSimdBaseJitType();
var_types simdBaseType = node->GetSimdBaseType();
unsigned simdSize = node->GetSimdSize();
var_types simdType = node->TypeGet();
var_types simdBaseType = node->GetSimdBaseType();
unsigned simdSize = node->GetSimdSize();

GenTree* op1 = node->Op(1);
GenTree* op2 = node->Op(2);
Expand All @@ -1455,6 +1454,10 @@ GenTree* Lowering::LowerHWIntrinsic(GenTreeHWIntrinsic* node)
bool userIsScalar = false;
genTreeOps userOper = userIntrin->GetOperForHWIntrinsicId(&isScalar);

// userIntrin may have re-interpreted the base type
//
simdBaseType = userIntrin->GetSimdBaseType();

if (GenTreeHWIntrinsic::OperIsBitwiseHWIntrinsic(userOper))
{
if (isOperNot && (userOper == GT_AND))
Expand Down
28 changes: 28 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_106478/Runtime_106478.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

// Found by Antigen
// Reduced from 30.05 KB to 2.35 KB.
// Further redued by hand

using System;
using System.Runtime.Intrinsics;
using Xunit;

public class Runtime_106478
{
static Vector512<double> s_v512_double_46 = Vector512.Create(4, -4.971830985915493, -0.9789473684210527, -1.956043956043956, 2, 74.25, 1.0533333333333332, 4.033898305084746);
Vector512<int> v512_int_101 = Vector512<int>.Zero;
Vector512<int> p_v512_int_125 = Vector512<int>.Zero;

void Problem()
{
p_v512_int_125 = v512_int_101& Vector512.AsInt32(s_v512_double_46 ^ Vector512<double>.AllBitsSet);
}

[Fact]
public static void Test()
{
new Runtime_106478().Problem();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>
Loading