mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-04 04:17:53 +01:00
* 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 -
This commit is contained in:
parent
3cc1c1bd2e
commit
6ba8db4dd4
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -6220,6 +6220,7 @@ tests/tbs/tb0526.pp -text
|
||||
tests/tbs/tb0527.pp svneol=native#text/plain
|
||||
tests/tbs/tb0528.pp svneol=native#text/x-pascal
|
||||
tests/tbs/tb0530.pp svneol=native#text/plain
|
||||
tests/tbs/tb0531.pp svneol=native#text/plain
|
||||
tests/tbs/ub0060.pp svneol=native#text/plain
|
||||
tests/tbs/ub0069.pp svneol=native#text/plain
|
||||
tests/tbs/ub0119.pp svneol=native#text/plain
|
||||
|
||||
@ -515,23 +515,9 @@ const
|
||||
begin
|
||||
case op of
|
||||
OP_OR:
|
||||
case size of
|
||||
OS_8, OS_S8:
|
||||
list.concat(taicpu.op_reg_const(A_LI,dst,255));
|
||||
OS_16, OS_S16:
|
||||
a_load_const_reg(list,OS_16,65535,dst);
|
||||
else
|
||||
list.concat(taicpu.op_reg_const(A_LI,dst,-1));
|
||||
end;
|
||||
list.concat(taicpu.op_reg_const(A_LI,dst,-1));
|
||||
OP_XOR:
|
||||
case size of
|
||||
OS_8, OS_S8:
|
||||
list.concat(taicpu.op_reg_reg_const(A_XORI,dst,src,255));
|
||||
OS_16, OS_S16:
|
||||
list.concat(taicpu.op_reg_reg_const(A_XORI,dst,src,65535));
|
||||
else
|
||||
list.concat(taicpu.op_reg_reg(A_NOT,dst,src));
|
||||
end;
|
||||
list.concat(taicpu.op_reg_reg(A_NOT,dst,src));
|
||||
OP_AND:
|
||||
a_load_reg_reg(list,size,size,src,dst);
|
||||
end;
|
||||
|
||||
109
tests/tbs/tb0531.pp
Normal file
109
tests/tbs/tb0531.pp
Normal file
@ -0,0 +1,109 @@
|
||||
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.
|
||||
Loading…
Reference in New Issue
Block a user