summaryrefslogtreecommitdiff
path: root/tests/src/JIT/CodeGenBringUpTests/LngConv.cs
blob: b6f2c339afc61eee087e3bbe6f37ea5bd368e83e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// 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;
using System.Runtime.CompilerServices;
public class BringUpTest
{
    const int Pass = 100;
    const int Fail = -1;

    [MethodImplAttribute(MethodImplOptions.NoInlining)]
    public static int LngConv(long x, out int y) { return y = (int) x; }

    [MethodImplAttribute(MethodImplOptions.NoInlining)]
    public static UInt32 LngConv(long x, out UInt32 y) { return y = (UInt32) x; }

    [MethodImplAttribute(MethodImplOptions.NoInlining)]
    public static UInt16 LngConv(long x, out UInt16 y) { return y = (UInt16)x; }

    [MethodImplAttribute(MethodImplOptions.NoInlining)]
    public static byte LngConv(long x, out byte y) { return y = (byte)x; }

    //[MethodImplAttribute(MethodImplOptions.NoInlining)]
    //public static UInt16 LngConv(byte x) { return (UInt16)x; }

    [MethodImplAttribute(MethodImplOptions.NoInlining)]
    public static Int16 LngConv(long x, out Int16 y) { return y = (Int16)x; }

    [MethodImplAttribute(MethodImplOptions.NoInlining)]
    public static sbyte LngConv(long x, out sbyte y) { return y = (sbyte)x; }

    [MethodImplAttribute(MethodImplOptions.NoInlining)]
    public static uint LngConv() 
    {
        uint num6 = (uint)((IntPtr)0x4234abcdL);
        Console.WriteLine(num6);
        if (num6 != 0x4234abcd)
        {
            Console.WriteLine("CASE5 FAILED");
            return 1;
        }
        return num6;
    }


    public static int Main()
    {
        int a;
        UInt32 b;
        Int16 c;
        UInt16 d;
        sbyte e;
        byte f;
        long x = 3294168832L;

        LngConv();

        LngConv(x, out a);
        Console.WriteLine(a);
        if (a != -1000798464) return Fail;
        
        LngConv(x, out b);
        Console.WriteLine(b);
        if (b != 3294168832U) return Fail;

        LngConv(x, out c);
        Console.WriteLine(c);
        if (c != 1792) return Fail;

        LngConv(x, out d);
        Console.WriteLine(d);
        if (d != 1792) return Fail;
               
        LngConv(x, out e);
        Console.WriteLine(e);
        if (e != 0) return Fail;

        LngConv(x, out f);
        Console.WriteLine(f);
        if (f != 0) return Fail;

        return Pass;
    }
}