diff --git a/src/coreclr/jit/emit.h b/src/coreclr/jit/emit.h index 3c892ec072fd6e..94ded1df85fcdf 100644 --- a/src/coreclr/jit/emit.h +++ b/src/coreclr/jit/emit.h @@ -3930,6 +3930,19 @@ emitAttr emitter::emitGetBaseMemOpSize(instrDesc* id) const } } + case INS_psrlw: + case INS_psrld: + case INS_psrlq: + case INS_psraw: + case INS_psrad: + case INS_psllw: + case INS_pslld: + case INS_psllq: + { + // These always have 16-byte memory loads + return EA_16BYTE; + } + case INS_vpmovdb: case INS_vpmovdw: case INS_vpmovqb: diff --git a/src/coreclr/jit/emitxarch.cpp b/src/coreclr/jit/emitxarch.cpp index 980d40a47ac318..ba599c9e465ad0 100644 --- a/src/coreclr/jit/emitxarch.cpp +++ b/src/coreclr/jit/emitxarch.cpp @@ -14098,11 +14098,11 @@ BYTE* emitter::emitOutputCV(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc) { if (emitComp->compCodeOpt() == Compiler::SMALL_CODE) { - assert((reinterpret_cast(addr) & 3) == 0); + assert(IS_ALIGNED(addr, 4)); } else { - assert((reinterpret_cast(addr) & (byteSize - 1)) == 0); + assert(IS_ALIGNED(addr, byteSize)); } } #endif // DEBUG diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_91335/Runtime_91335.cs b/src/tests/JIT/Regression/JitBlue/Runtime_91335/Runtime_91335.cs new file mode 100644 index 00000000000000..b89d6c71d78ce5 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_91335/Runtime_91335.cs @@ -0,0 +1,90 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license.aa + +// Found by Antigen + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.Intrinsics; +using System.Runtime.Intrinsics.X86; +using Xunit; + +public class TestClass +{ + public struct S1 + { + public Vector64 v64_short_0; + public ulong ulong_1; + } + public struct S2 + { + public S1 s1_3; + } + static float s_float_13 = -1f; + static uint s_uint_16 = 1; + static ulong s_ulong_17 = 5; + static Vector128 s_v128_short_30 = Vector128.Create((short)2); + static Vector128 s_v128_ushort_31 = Vector128.AllBitsSet; + static Vector128 s_v128_int_32 = Vector128.CreateScalar(2); + static Vector128 s_v128_uint_33 = Vector128.Create((uint)1, 1, 1, 2); + static Vector128 s_v128_long_34 = Vector128.Create(-2, 2); + static Vector128 s_v128_ulong_35 = Vector128.Create((ulong)1); + static Vector128 s_v128_float_36 = Vector128.CreateScalar(0.1f); + static Vector128 s_v128_double_37 = Vector128.Create(1.0235294117647058, 2); + static Vector256 s_v256_byte_38 = Vector256.CreateScalar((byte)5); + static Vector256 s_v256_sbyte_39 = Vector256.Create(1, 0, -2, 2, 97, 97, -2, -5, 5, 5, -5, 1, 2, 1, 5, -2, 97, 2, 6, 2, 5, -5, 1, -2, 97, 2, 5, 5, 2, -2, 2, 5); + static Vector256 s_v256_short_40 = Vector256.CreateScalar((short)2); + static Vector256 s_v256_ushort_41 = Vector256.Create((ushort)97); + static Vector256 s_v256_int_42 = Vector256.Zero; + static Vector256 s_v256_uint_43 = Vector256.CreateScalar((uint)2); + static Vector256 s_v256_long_44 = Vector256.Create((long)-1); + static Vector256 s_v256_ulong_45 = Vector256.Zero; + static Vector256 s_v256_float_46 = Vector256.CreateScalar(-4.969697f); + static Vector256 s_v256_double_47 = Vector256.Create(97.03448275862068); + static Vector512 s_v512_byte_48 = Vector512.Create((byte)1); + static Vector512 s_v512_sbyte_49 = Vector512.Create((sbyte)5); + static Vector512 s_v512_short_50 = Vector512.AllBitsSet; + static Vector512 s_v512_ushort_51 = Vector512.AllBitsSet; + static Vector512 s_v512_int_52 = Vector512.AllBitsSet; + static Vector512 s_v512_uint_53 = Vector512.CreateScalar((uint)5); + static Vector512 s_v512_long_54 = Vector512.CreateScalar((long)2); + static Vector512 s_v512_ulong_55 = Vector512.Zero; + static S1 s_s1_61 = new S1(); + static S2 s_s2_62 = new S2(); + int int_69 = 2; + Vector128 v128_sbyte_88 = Vector128.Zero; + Vector128 v128_short_89 = Vector128.CreateScalar((short)97); + Vector128 v128_ushort_90 = Vector128.Zero; + Vector128 v128_long_93 = Vector128.AllBitsSet; + Vector128 v128_ulong_94 = Vector128.Zero; + Vector128 v128_float_95 = Vector128.Create(1.1153846f, 5f, 1.0232558f, 97.01786f); + Vector128 v128_double_96 = Vector128.Create(2.0375, 2); + Vector256 v256_byte_97 = Vector256.CreateScalar((byte)5); + Vector256 v256_short_99 = Vector256.CreateScalar((short)5); + Vector256 v256_ushort_100 = Vector256.Zero; + Vector256 v256_int_101 = Vector256.CreateScalar(97); + Vector256 v256_uint_102 = Vector256.Create((uint)97); + Vector256 v256_long_103 = Vector256.CreateScalar((long)2); + Vector256 v256_ulong_104 = Vector256.CreateScalar((ulong)2); + Vector256 v256_float_105 = Vector256.Create(5.0869565f); + Vector256 v256_double_106 = Vector256.Create(-1.9411764705882353); + S1 s1_120 = new S1(); + S2 s2_121 = new S2(); + + [MethodImpl(MethodImplOptions.NoInlining)] + public Vector256 Method31() + { + byte byte_929 = 2; + return s_v256_int_42 += v256_int_101 | v256_int_101 ^ v256_int_101 | + Vector256.AllBitsSet & s_v256_int_42 ^ (s_v256_int_42 *= v256_int_101) - (v256_int_101 ^ Vector256.Zero) & (v256_int_101 *= v256_int_101) - Avx2.ShiftRightLogical(v256_int_101, byte_929); + } + + [Fact] + public static void TestEntryPoint() + { + if (Avx2.IsSupported) + { + new TestClass().Method31(); + } + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_91335/Runtime_91335.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_91335/Runtime_91335.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_91335/Runtime_91335.csproj @@ -0,0 +1,8 @@ + + + True + + + + +