From df056a2a5cfa3939af508d1ca281d874a6f93823 Mon Sep 17 00:00:00 2001 From: Brian Sullivan Date: Fri, 9 Mar 2018 10:59:41 -0800 Subject: When value numbering an assignment we may need to insert an implicit cast operation Test case opt/CSE/NarrowStore.cs added --- tests/src/JIT/opt/CSE/NarrowStore.cs | 39 ++++++++++++++++++++++++++++++++ tests/src/JIT/opt/CSE/NarrowStore.csproj | 35 ++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 tests/src/JIT/opt/CSE/NarrowStore.cs create mode 100644 tests/src/JIT/opt/CSE/NarrowStore.csproj (limited to 'tests/src/JIT') diff --git a/tests/src/JIT/opt/CSE/NarrowStore.cs b/tests/src/JIT/opt/CSE/NarrowStore.cs new file mode 100644 index 0000000000..386a56c581 --- /dev/null +++ b/tests/src/JIT/opt/CSE/NarrowStore.cs @@ -0,0 +1,39 @@ +// 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. + +using System; + +namespace NarrowStore +{ + class Program + { + byte x01; + byte t01; + + int Test() + { + x01 = 3; + t01 = (byte)~x01; + if (t01 == 252) + { + Console.WriteLine("Pass"); + return 100; + } + else + { + Console.WriteLine("FAIL"); + return -1; + } + } + + static int Main(string[] args) + { + Program prog = new Program(); + + int result = prog.Test(); + return result; + } + } +} + diff --git a/tests/src/JIT/opt/CSE/NarrowStore.csproj b/tests/src/JIT/opt/CSE/NarrowStore.csproj new file mode 100644 index 0000000000..df5bf2351e --- /dev/null +++ b/tests/src/JIT/opt/CSE/NarrowStore.csproj @@ -0,0 +1,35 @@ + + + + + Debug + AnyCPU + $(MSBuildProjectName) + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + 0 + + + + + + + False + + + + None + True + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3