From: Carol Eidt Date: Thu, 25 Aug 2016 23:55:22 +0000 (-0700) Subject: Fix DevDiv bug 255263 X-Git-Tag: submit/tizen/20210909.063632~11030^2~9557^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5bd6f94fdfd329ce3e2e43771beb8286e2a28438;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix DevDiv bug 255263 This issue arose because we were not considering punpckldq as one of the 3-operand AVX instructions (which require us to duplicate the source register when encoding an SSE 2-operand form). This bug showed up in managed C++, so the test is in IL. The test is failing in RyuJIT/x86, so issue dotnet/coreclr#6940 has been opened, and it is disabled for x86. Commit migrated from https://github.com/dotnet/coreclr/commit/e9d954bf1c6510c0831efbee7711c84e758fa567 --- diff --git a/src/coreclr/src/jit/emitxarch.cpp b/src/coreclr/src/jit/emitxarch.cpp index f9ab597..d43f766 100644 --- a/src/coreclr/src/jit/emitxarch.cpp +++ b/src/coreclr/src/jit/emitxarch.cpp @@ -75,7 +75,8 @@ bool emitter::IsThreeOperandBinaryAVXInstruction(instruction ins) ins == INS_maxss || ins == INS_maxsd || ins == INS_andnps || ins == INS_andnpd || ins == INS_paddb || ins == INS_paddw || ins == INS_paddd || ins == INS_paddq || ins == INS_psubb || ins == INS_psubw || ins == INS_psubd || ins == INS_psubq || ins == INS_pmuludq || ins == INS_pxor || ins == INS_pmaxub || - ins == INS_pminub || ins == INS_pmaxsw || ins == INS_pminsw || ins == INS_insertps || ins == INS_vinsertf128 + ins == INS_pminub || ins == INS_pmaxsw || ins == INS_pminsw || ins == INS_insertps || ins == INS_vinsertf128 || + ins == INS_punpckldq ); } diff --git a/src/coreclr/tests/issues.targets b/src/coreclr/tests/issues.targets index e40477c..5e2c8b2 100644 --- a/src/coreclr/tests/issues.targets +++ b/src/coreclr/tests/issues.targets @@ -311,6 +311,9 @@ 6553 + + 6940 + diff --git a/src/coreclr/tests/src/JIT/Regression/JitBlue/DevDiv_255263/DevDiv_255263.il b/src/coreclr/tests/src/JIT/Regression/JitBlue/DevDiv_255263/DevDiv_255263.il new file mode 100644 index 0000000..497cf6c --- /dev/null +++ b/src/coreclr/tests/src/JIT/Regression/JitBlue/DevDiv_255263/DevDiv_255263.il @@ -0,0 +1,99 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +.assembly extern legacy library mscorlib {} +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly initblk.exe{} + +.class public sealed Foo + extends [mscorlib]System.ValueType +{ + .field public int64 i1 + .field public int64 i2 + .field public int64 i3 + .field public uint8 b +} + +.class DevDiv_255263 { + + +// .data d = int32(0x00000000) + .field static valuetype Foo f + .field static float64 d + +//------------------------- +// Entry point - Main +//------------------------- +.method static int32 Main(class [mscorlib]System.String[]) +{ +.entrypoint + .maxstack 10 + .locals init (class [mscorlib]System.Random V_0, + float64 V_1, + float64 V_2, + int32 V_3) + + // Get some floating point values and keep them live to avoid + // ymm0 being available. + newobj instance void [mscorlib]System.Random::.ctor() + stloc.0 + ldloc.0 + callvirt instance float64 [mscorlib]System.Random::NextDouble() + stloc.1 + ldloc.0 + callvirt instance float64 [mscorlib]System.Random::NextDouble() + stloc.2 + + // -- init 25 bytes of memory to 0xAA + ldsflda valuetype Foo DevDiv_255263::f + ldc.i4 0xAA + ldc.i4 25 + unaligned. 0x1 + initblk + + // Now use the floating point values. + ldloc.1 + ldloc.2 + add + stsfld float64 DevDiv_255263::d + ldc.i4.s 100 + stloc.3 + + // -- load the 25 bytes of memory _and be sure they are all 0xAA + ldsflda valuetype Foo DevDiv_255263::f + ldfld int64 Foo::i1 + ldc.i8 0xAAAAAAAAAAAAAAAA + ceq + brfalse FAIL + + ldsflda valuetype Foo DevDiv_255263::f + ldfld int64 Foo::i2 + ldc.i8 0xAAAAAAAAAAAAAAAA + ceq + brfalse FAIL + ldsflda valuetype Foo DevDiv_255263::f + ldfld int64 Foo::i3 + ldc.i8 0xAAAAAAAAAAAAAAAA + ceq + brfalse FAIL + ldsflda valuetype Foo DevDiv_255263::f + ldfld uint8 Foo::b + ldc.i4 0x000000AA + ceq + brfalse FAIL + +//---------------- +PASS: + ldc.i4 0x64 + ret +//---------------- +FAIL: + ldc.i4 0xFFFFFFFF + ret +} +} diff --git a/src/coreclr/tests/src/JIT/Regression/JitBlue/DevDiv_255263/DevDiv_255263.ilproj b/src/coreclr/tests/src/JIT/Regression/JitBlue/DevDiv_255263/DevDiv_255263.ilproj new file mode 100644 index 0000000..bba6f00 --- /dev/null +++ b/src/coreclr/tests/src/JIT/Regression/JitBlue/DevDiv_255263/DevDiv_255263.ilproj @@ -0,0 +1,41 @@ + + + + + Debug + AnyCPU + $(MSBuildProjectName) + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + Properties + 512 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + $(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages + ..\..\ + 7a9bfb7d + + + + + + + + + False + + + + None + True + + + + + + + + + + +