Skip to content

Commit 0cc170c

Browse files
authored
Remove an assert from impHWIntrinsic (#72084)
1 parent 1a0c9ca commit 0cc170c

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

src/coreclr/jit/hwintrinsic.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,19 +770,19 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic,
770770

771771
if (HWIntrinsicInfo::IsMultiReg(intrinsic))
772772
{
773+
// We don't have generic multireg APIs
773774
assert(sizeBytes == 0);
774775
}
775776
else
776777
{
777-
assert(sizeBytes != 0);
778-
779778
// We want to return early here for cases where retType was TYP_STRUCT as per method signature and
780779
// rather than deferring the decision after getting the simdBaseJitType of arg.
781780
if (!isSupportedBaseType(intrinsic, simdBaseJitType))
782781
{
783782
return nullptr;
784783
}
785784

785+
assert(sizeBytes != 0);
786786
retType = getSIMDTypeForSize(sizeBytes);
787787
}
788788
}

src/mono/mono/mini/simd-intrinsics.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,8 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi
11291129
}
11301130
case SN_Create: {
11311131
MonoType *etype = get_vector_t_elem_type (fsig->ret);
1132+
if (!MONO_TYPE_IS_VECTOR_PRIMITIVE (etype))
1133+
return NULL;
11321134
if (fsig->param_count == 1 && mono_metadata_type_equal (fsig->params [0], etype))
11331135
return emit_simd_ins (cfg, klass, type_to_expand_op (etype), args [0]->dreg, -1);
11341136
else if (is_create_from_half_vectors_overload (fsig))
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System;
5+
using System.Runtime.CompilerServices;
6+
using System.Runtime.Intrinsics;
7+
8+
public class Runtime_72081
9+
{
10+
public static int Main()
11+
{
12+
try
13+
{
14+
Vector128<UInt128> d1 = default;
15+
Vector128<UInt128> d2 = Vector128.Create<UInt128>(111);
16+
Vector128<UInt128> x = d1 + d2 * d1;
17+
return d1.GetHashCode() + x.GetHashCode();
18+
}
19+
catch (NotSupportedException)
20+
{
21+
return 100;
22+
}
23+
}
24+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
<Optimize>True</Optimize>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<Compile Include="$(MSBuildProjectName).cs" />
8+
</ItemGroup>
9+
</Project>

0 commit comments

Comments
 (0)