/
jit-uint.cs
82 lines (57 loc) · 1.08 KB
/
jit-uint.cs
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
public class TestJit {
public static uint test_call (uint a, uint b) {
return a+b;
}
public static int test_alu ()
{
uint a = 9, b = 6;
if ((a + b) != 15)
return 1;
if ((a - b) != 3)
return 1;
if ((a & 8) != 8)
return 1;
if ((a | 2) != 11)
return 1;
if ((a * b) != 54)
return 1;
if ((a / 4) != 2)
return 1;
if ((a % 4) != 1)
return 1;
b = 0;
if (~b != 0xffffffff)
return 1;
return 0;
}
public static int test_branch ()
{
uint a = 5, b = 5, t;
if (a == b) t = 1; else t = 0;
if (t != 1) return 1;
if (a != b) t = 0; else t = 1;
if (t != 1) return 1;
if (a >= b) t = 1; else t = 0;
if (t != 1) return 1;
if (a > b) t = 0; else t = 1;
if (t != 1) return 1;
if (a <= b) t = 1; else t = 0;
if (t != 1) return 1;
if (a < b) t = 0; else t = 1;
if (t != 1) return 1;
return 0;
}
public static int Main() {
int num = 1;
if (test_call (3, 5) != 8)
return num;
num++;
if (test_branch () != 0)
return num;
num++;
if (test_alu () != 0)
return num;
num++;
return 0;
}
}