forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathldfld_mul.cs
More file actions
67 lines (62 loc) · 2.02 KB
/
Copy pathldfld_mul.cs
File metadata and controls
67 lines (62 loc) · 2.02 KB
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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using Xunit;
namespace JitTest_ldfld_mul_unsigned_cs
{
public class Test
{
private ulong _op1,_op2;
private bool check(ulong product, bool overflow)
{
Console.Write("Multiplying {0} and {1}...", _op1, _op2);
try
{
if (unchecked(_op1 * _op2) != product)
return false;
Console.WriteLine();
return !overflow;
}
catch (OverflowException)
{
Console.WriteLine("overflow.");
return overflow;
}
}
[Fact]
[OuterLoop]
public static int TestEntryPoint()
{
Test app = new Test();
app._op1 = 0x00000000ffffffff;
app._op2 = 0x00000000ffffffff;
if (!app.check(0xfffffffe00000001, false))
goto fail;
app._op1 = 0x0000000100000000;
app._op2 = 0x00000000ffffffff;
if (!app.check(0xffffffff00000000, false))
goto fail;
app._op1 = 0x0000000100000000;
app._op2 = 0x0000000100000000;
if (!app.check(0x0000000000000000, false))
goto fail;
app._op1 = 0x7fffffffffffffff;
app._op2 = 0x0000000000000002;
if (!app.check(0xfffffffffffffffe, false))
goto fail;
app._op1 = 0x8000000000000000;
app._op2 = 0x0000000000000002;
if (!app.check(0x0000000000000000, false))
goto fail;
app._op1 = 0x0000000000100000;
app._op2 = 0x0000001000000000;
if (!app.check(0x0100000000000000, false))
goto fail;
Console.WriteLine("Test passed");
return 100;
fail:
Console.WriteLine("Test failed");
return 1;
}
}
}