Skip to content
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
12 changes: 12 additions & 0 deletions src/coreclr/jit/emit.h
Original file line number Diff line number Diff line change
Expand Up @@ -4382,6 +4382,18 @@ emitAttr emitter::emitGetMemOpSize(instrDesc* id, bool ignoreEmbeddedBroadcast)
memSize = defaultSize / 2;
}
}
else if (tupleType == INS_TT_QUARTER)
{
// Embedded broadcast supported, so either loading scalar or quarter vector
if (!ignoreEmbeddedBroadcast && HasEmbeddedBroadcast(id))
{
memSize = GetInputSizeInBytes(id);
}
else
{
memSize = defaultSize / 4;
}
}
else if (tupleType == INS_TT_FULL_MEM)
{
// Embedded broadcast not supported, load full vector
Expand Down
18 changes: 17 additions & 1 deletion src/coreclr/jit/emitxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13130,6 +13130,7 @@ void emitter::emitDispIns(
break;
}

case INS_TT_QUARTER:
case INS_TT_QUARTER_MEM:
{
unsigned maskElemSize = XMM_REGSIZE_BYTES / CodeGenInterface::instKMaskBaseSize(ins);
Expand Down Expand Up @@ -17945,7 +17946,7 @@ bool emitter::TryEvexCompressDisp8Byte(instrDesc* id, ssize_t dsp, ssize_t* comp

case INS_TT_HALF:
{
assert(inputSize == 4);
assert((inputSize == 2) || (inputSize == 4));
if (isEmbBroadcast)
{
// N = input size in bytes
Expand All @@ -17959,6 +17960,21 @@ bool emitter::TryEvexCompressDisp8Byte(instrDesc* id, ssize_t dsp, ssize_t* comp
break;
}

case INS_TT_QUARTER:
{
if (isEmbBroadcast)
{
// N = input size in bytes
disp8Compression = inputSize;
}
else
{
// N = vector length in bytes
disp8Compression = vectorLength / 4;
}
break;
}

case INS_TT_FULL_MEM:
{
// N = vector length in bytes
Expand Down
10 changes: 10 additions & 0 deletions src/coreclr/jit/instr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,22 @@ const char* CodeGen::genInsDisplayName(emitter::instrDesc* id)
return GetFltCmpOpName("ps");
}

case INS_vcmpph:
{
return GetFltCmpOpName("ph");
}

case INS_cmpsd:
case INS_vcmpsd:
{
return GetFltCmpOpName("sd");
}

case INS_vcmpsh:
{
return GetFltCmpOpName("sh");
}

case INS_cmpss:
case INS_vcmpss:
{
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/jit/instr.h
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,8 @@ enum insTupleType : uint16_t
INS_TT_NONE = 0x0000,
INS_TT_FULL = 0x0001,
INS_TT_HALF = 0x0002,
INS_TT_IS_BROADCAST = static_cast<uint16_t>(INS_TT_FULL | INS_TT_HALF),
INS_TT_QUARTER = 0x0004,
INS_TT_IS_BROADCAST = static_cast<uint16_t>(INS_TT_FULL | INS_TT_HALF | INS_TT_QUARTER),
INS_TT_FULL_MEM = 0x0010,
INS_TT_TUPLE1_SCALAR = 0x0020,
INS_TT_TUPLE1_FIXED = 0x0040,
Expand Down
182 changes: 91 additions & 91 deletions src/coreclr/jit/instrsxarch.h

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/coreclr/jit/lowerxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7837,12 +7837,14 @@ void Lowering::ContainCheckStoreIndir(GenTreeStoreInd* node)
switch (tupleType)
{
case INS_TT_HALF_MEM:
case INS_TT_HALF:
{
memSize = simdSize / 2;
break;
}

case INS_TT_QUARTER_MEM:
case INS_TT_QUARTER:
{
memSize = simdSize / 4;
break;
Expand Down Expand Up @@ -8962,6 +8964,7 @@ bool Lowering::IsContainableHWIntrinsicOp(GenTreeHWIntrinsic* parentNode, GenTre
break;
}

case INS_TT_QUARTER:
Comment thread
tannergooding marked this conversation as resolved.
case INS_TT_QUARTER_MEM:
{
expectedSize /= 4;
Expand Down
44 changes: 44 additions & 0 deletions src/tests/JIT/Regression_2/Runtime_135844/Runtime_135844.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// 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.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
using Xunit;

[StructLayout(LayoutKind.Explicit)]
struct State
{
[FieldOffset(8)]
public ulong Coefficient;

[FieldOffset(16)]
public ulong Other;
}

public class Runtime_135844
{
[ConditionalFact(typeof(Avx512F), nameof(Avx512F.IsSupported))]
public static void TestEntryPoint()
{
State state = new() { Coefficient = 3, Other = 29 };
Vector512<uint> unsignedInput = Vector512.Create(2u);
Vector512<int> signedInput = Vector512.Create(2);

Vector512<ulong> unsignedResult = MultiplyUnsigned(ref state, unsignedInput);
Vector512<long> signedResult = MultiplySigned(ref state, signedInput);

Assert.Equal(Vector512.Create(6ul), unsignedResult);
Assert.Equal(Vector512.Create(6L), signedResult);
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static Vector512<ulong> MultiplyUnsigned(ref State state, Vector512<uint> input) =>
Avx512F.Multiply(input, Vector512.Create(state.Coefficient).AsUInt32());

[MethodImpl(MethodImplOptions.NoInlining)]
private static Vector512<long> MultiplySigned(ref State state, Vector512<int> input) =>
Avx512F.Multiply(input, Vector512.Create(unchecked((long)state.Coefficient)).AsInt32());
}
12 changes: 12 additions & 0 deletions src/tests/JIT/Regression_2/Runtime_135844/Runtime_135844.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Optimize>True</Optimize>
<DebugType>None</DebugType>
<CLRTestPriority>1</CLRTestPriority>
<RequiresProcessIsolation>true</RequiresProcessIsolation>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
<CLRTestEnvironmentVariable Include="DOTNET_TieredCompilation" Value="0" />
</ItemGroup>
</Project>
Loading