Browse Source

+ Xtensa: tcgcpu.a_load_ref_reg

git-svn-id: trunk@44334 -
florian 5 years ago
parent
commit
678ca16d95

+ 2 - 5
compiler/xtensa/agcpugas.pas

@@ -100,11 +100,8 @@ unit agcpugas;
               begin
                 s:=gas_regname(base);
                 if index<>NR_NO then
-                  begin
-                     s:=s+gas_regname(index);
-                  end
-                else if offset<>0 then
-                  s:=s+','+tostr(offset);
+                  Internalerror(2020030802);
+                s:=s+','+tostr(offset);
               end;
           end;
         getreferencestring:=s;

+ 26 - 1
compiler/xtensa/cgcpu.pas

@@ -227,8 +227,33 @@ implementation
 
     procedure tcgcpu.a_load_ref_reg(list : TAsmList; fromsize,tosize : tcgsize;
       const ref : TReference; reg : tregister);
+      var
+        href: treference;
+        op: TAsmOp;
+        tmpreg: TRegister;
       begin
-        list.Concat(taicpu.op_none(A_NOP));
+        href:=ref;
+        fixref(list,href);
+
+        case fromsize of
+          OS_8: op:=A_L8UI;
+          OS_16: op:=A_L16UI;
+          OS_S8: op:=A_L8UI;
+          OS_S16: op:=A_L16SI;
+
+          OS_64,OS_S64, { This only happens if tosize is smaller than fromsize }
+          { We can therefore only consider the low 32-bit of the 64bit value }
+          OS_32,
+          OS_S32: op:=A_L32I;
+        else
+          internalerror(2020030801);
+        end;
+
+        list.concat(taicpu.op_reg_ref(op,reg,href));
+        if (fromsize=OS_S8) and not(tosize in [OS_S8,OS_8]) then
+          list.concat(taicpu.op_reg_reg_const(A_SEXT,reg,reg,7));
+        if (fromsize<>tosize) and (not (tosize in [OS_SINT,OS_INT])) then
+          a_load_reg_reg(list,fromsize,tosize,reg,reg);
       end;
 
 

+ 3 - 0
compiler/xtensa/xtensaatt.inc

@@ -14,6 +14,9 @@
 'callx12',
 'entry',
 'extui',
+'l8ui',
+'l16si',
+'l16ui',
 'l32i',
 'l32r',
 'lsi',

+ 3 - 0
compiler/xtensa/xtensaop.inc

@@ -14,6 +14,9 @@ A_CALLX8,
 A_CALLX12,
 A_ENTRY,
 A_EXTUI,
+A_L8UI,
+A_L16SI,
+A_L16UI,
 A_L32I,
 A_L32R,
 A_LSI,