Browse Source

* fix shift for 16bit from mazen

git-svn-id: trunk@7091 -
peter 18 years ago
parent
commit
d810064e48
1 changed files with 20 additions and 7 deletions
  1. 20 7
      compiler/sparc/cgcpu.pas

+ 20 - 7
compiler/sparc/cgcpu.pas

@@ -580,14 +580,27 @@ implementation
               begin
               begin
                 if tcgsize2size[tosize] > tcgsize2size[fromsize] then
                 if tcgsize2size[tosize] > tcgsize2size[fromsize] then
                   begin
                   begin
-                    list.concat(taicpu.op_reg_const_reg(A_SLL,reg1,24,reg2));
                     case fromsize of
                     case fromsize of
-                    OS_8,
-                    OS_16 :
-                      list.concat(taicpu.op_reg_const_reg(A_SRL,reg2,24,reg2));
-                    OS_S8,
-                    OS_S16 :
-                      list.concat(taicpu.op_reg_const_reg(A_SRA,reg2,24,reg2));
+                      OS_8:
+                        begin
+                          list.concat(taicpu.op_reg_const_reg(A_SLL,reg1,24,reg2));
+                          list.concat(taicpu.op_reg_const_reg(A_SRL,reg2,24,reg2));
+                        end;
+                      OS_16 :
+                        begin
+                          list.concat(taicpu.op_reg_const_reg(A_SLL,reg1,16,reg2));
+                          list.concat(taicpu.op_reg_const_reg(A_SRL,reg2,16,reg2));
+                        end;
+                      OS_S8:
+                        begin
+                          list.concat(taicpu.op_reg_const_reg(A_SLL,reg1,24,reg2));
+                          list.concat(taicpu.op_reg_const_reg(A_SRA,reg2,24,reg2));
+                        end;
+                      OS_S16 :
+                        begin
+                          list.concat(taicpu.op_reg_const_reg(A_SLL,reg1,16,reg2));
+                          list.concat(taicpu.op_reg_const_reg(A_SRA,reg2,16,reg2));
+                        end;
                     end;
                     end;
                   end
                   end
                 else
                 else