2
0
Эх сурвалжийг харах

* 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 -

Jonas Maebe 18 жил өмнө
parent
commit
6ba8db4dd4

+ 1 - 0
.gitattributes

@@ -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

+ 2 - 16
compiler/powerpc/cgcpu.pas

@@ -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 - 0
tests/tbs/tb0531.pp

@@ -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.