summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/test/cg/tmul3264.pp
blob: 4cb8c03653d1a4f516dbffe678d4ee7dc8b3a8ee (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
var
  gl: longint;
  gc: cardinal;

procedure testsigned;
var
  l1, l2: longint;
  b1: byte;
  i: int64;
begin

  l1 := longint($80000000);
  gl := longint($80000000);
  l2 := $11;
  b1 := $11;

  i := int64(l1)*l2;
  if (i <> int64($fffffff780000000)) then
    halt(1);

  i := int64(l1)*$11;
  if (i <> int64($fffffff780000000)) then
    halt(2);

  i := int64(gl)*$11;
  if (i <> int64($fffffff780000000)) then
    halt(3);

  i := int64(gl)*b1;
  if (i <> int64($fffffff780000000)) then
    halt(4);
end;


procedure testunsigned;
var
  l1, l2: cardinal;
  b1: byte;
  i: qword;
begin

  l1 := $80000000;
  l2 := $11;
  gc := $80000000;
  b1 := $11;

  i := qword(l1)*l2;
  if (i <> $880000000) then
    halt(5);

  i := qword(l1)*$11;
  if (i <> $880000000) then
    halt(6);

  i := qword(gc)*$11;
  if (i <> $880000000) then
    halt(7);

  i := qword(gc)*b1;
  if (i <> $880000000) then
    halt(8);
end;


begin
  testsigned;
  testunsigned;
end.