Browse Source

* m68k: do not generate unnecessary unaligned load sequences for byte loads into registers, this fixes tcnvint1 test on plain 68000

Karoly Balogh 3 years ago
parent
commit
8f083f6342
1 changed files with 7 additions and 6 deletions
  1. 7 6
      compiler/m68k/cgcpu.pas

+ 7 - 6
compiler/m68k/cgcpu.pas

@@ -930,7 +930,13 @@ unit cgcpu;
        opsize: topsize;
        opsize: topsize;
        needsext: boolean;
        needsext: boolean;
       begin
       begin
-         if needs_unaligned(ref.alignment,fromsize) then
+         needsext:=tcgsize2size[fromsize]<tcgsize2size[tosize];
+         if needsext then
+           size:=fromsize
+         else
+           size:=tosize;
+
+         if needs_unaligned(ref.alignment,size) then
            begin
            begin
              //list.concat(tai_comment.create(strpnew('a_load_ref_reg calling unaligned')));
              //list.concat(tai_comment.create(strpnew('a_load_ref_reg calling unaligned')));
              a_load_ref_reg_unaligned(list,fromsize,tosize,ref,register);
              a_load_ref_reg_unaligned(list,fromsize,tosize,ref,register);
@@ -940,11 +946,6 @@ unit cgcpu;
          href:=ref;
          href:=ref;
          fixref(list,href,false);
          fixref(list,href,false);
 
 
-         needsext:=tcgsize2size[fromsize]<tcgsize2size[tosize];
-         if needsext then
-           size:=fromsize
-         else
-           size:=tosize;
          opsize:=TCGSize2OpSize[size];
          opsize:=TCGSize2OpSize[size];
          if isaddressregister(register) and not (opsize in [S_L]) then
          if isaddressregister(register) and not (opsize in [S_L]) then
            hreg:=getintregister(list,OS_ADDR)
            hreg:=getintregister(list,OS_ADDR)