fpc/tests/tbs/tb0531.pp
Jonas Maebe 6ba8db4dd4 * fixed a_op_const_reg(_reg)(OP_OR/OP_XOR,OS_S8/OS_S16) for ppc32
(is ok for ppc64)

git-svn-id: trunk@6756 -
2007-03-09 15:51:09 +00:00

110 lines
1.4 KiB
ObjectPascal

procedure testshort;
var
s1,s2: shortint;
l: longint;
begin
s1 := -1;
s1 := s1 xor -1;
l := -65536;
l := l + s1;
if (l <> -65536) then
halt(1);
s1 := 127;
s1 := s1 or -128;
l := -65536;
l := l + s1;
if (l <> -65536-1) then
halt(2);
s1 := -1;
s1 := s1 xor -128;
l := -65536;
l := l + s1;
if (l <> -65536+127) then
halt(3);
s1 := 127;
s1 := s1 or -128;
l := -65536;
l := l + s1;
if (l <> -65536-1) then
halt(4);
s1 := -1;
s2 := -128;
s1 := s1 xor s2;
l := 0;
l := l + s1;
if l <> 127 then
halt(5);
s1 := 126;
s2 := -128;
s1 := s1 or s2;
l := 0;
l := l + s1;
if l <> -2 then
halt(6);
end;
procedure testsmall;
var
s1,s2: smallint;
l: longint;
begin
s1 := -1;
s1 := s1 xor -1;
l := -65536;
l := l + s1;
if (l <> -65536) then
halt(1+6);
s1 := 32767;
s1 := s1 or -32678;
l := -65536;
l := l + s1;
if (l <> -65536-1) then
halt(2+6);
s1 := -1;
s1 := s1 xor -32768;
l := -65536;
l := l + s1;
if (l <> -65536+32767) then
halt(3+6);
s1 := 32767;
s1 := s1 or -32768;
l := -65536;
l := l + s1;
if (l <> -65536-1) then
halt(4+6);
s1 := -1;
s2 := -32768;
s1 := s1 xor s2;
l := 0;
l := l + s1;
if l <> 32767 then
halt(5+6);
s1 := 32766;
s2 := -32768;
s1 := s1 or s2;
l := 0;
l := l + s1;
if l <> -2 then
halt(6+6);
end;
begin
testshort;
testsmall;
end.