blob: 53a30e5fae47737e9508f54ba250b7bad8288bed (
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
// 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 'add'{
//This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration:
//[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )]
}
.class explicit _add {
.field [0] int32 global0
.field [4] int32 global1
.method public void .ctor()
{
ret
}
//-------------------------
// Entry point - Main -
//-------------------------
.method static int32 main(class [mscorlib]System.String[]) {
.entrypoint
.maxstack 6
.locals init (class _add target)
//----------------
// begin testing -
//----------------
// creating new instance of _add and storing it
newobj instance void _add::.ctor()
stloc.0
// -- I4 + I2 -- Make sure we can _add smaller types to larger types
ldc.i4 0xAABB
conv.i2
ldc.i4 0x1111
add
ldc.i4 0xFFFFBBCC
ceq
brfalse FAIL
// -- I4 + I4 --
ldc.i4 0x11223344
ldc.i4 0x11111111
add
ldc.i4 0x22334455
ceq
brfalse FAIL
// -- I4 + & -- Managed ptr
// -- I4 + * -- Unmanaged ptr
ldloc target
ldflda int32 _add::global0
ldc.i4 0xAAAAAAAA
unaligned. 0x1
stind.i4
ldloc target
ldflda int32 _add::global1
ldc.i4 0x44444444
unaligned. 0x1
stind.i4
ldloc target
ldflda int32 _add::global0
ldc.i4 0x4
add
unaligned. 0x1
ldind.i4
ldc.i4 0x44444444
ceq
brfalse FAIL
// -- I8 + I8 --
ldc.i8 0x0011223344556677
ldc.i8 0x7766554433221100
add
ldc.i8 0x7777777777777777
ceq
brfalse FAIL
// -- R4 + R4 --
ldc.r4 float32(0x3F800000)
ldc.r4 float32(0x00000000)
add
ldc.r4 float32(0x3F800000)
ceq
brfalse FAIL
// -- R8 + R8 --
ldc.r8 float64(0xBFF0000000000000)
ldc.r8 float64(0x0000000000000000)
add
ldc.r8 float64(0xBFF0000000000000)
ceq
brfalse FAIL
//----------------
PASS:
ldstr "Test SUCCESS"
call void [System.Console]System.Console::WriteLine(string)
ldc.i4 0x64
ret
//----------------
FAIL:
ldstr "Test FAILED"
call void [System.Console]System.Console::WriteLine(string)
ldc.i4 0x0
ret
}
}
|