فهرست منبع

Fix ARM-Assembler output for RRX-Shifterops

RRX (Rotate Right with eXtend) does a single bit right rotation through
the carry. So it does not take any arguments, neither constant nor
register.

Also remove redundant shiftmode2str and replace usage of it with gas_shiftmode2str.

git-svn-id: trunk@21685 -
masta 13 سال پیش
والد
کامیت
3566956389
1فایلهای تغییر یافته به همراه10 افزوده شده و 8 حذف شده
  1. 10 8
      compiler/arm/agarmgas.pas

+ 10 - 8
compiler/arm/agarmgas.pas

@@ -153,7 +153,10 @@ unit agarmgas;
 
                      s:=s+gas_regname(index);
 
-                     if shiftmode<>SM_None then
+                     {RRX always rotates by 1 bit and does not take an imm}
+                     if shiftmode = SM_RRX then
+                       s:=s+', rrx'
+                     else if shiftmode <> SM_None then
                        s:=s+', '+gas_shiftmode2str[shiftmode]+' #'+tostr(shiftimm);
                   end
                 else if offset<>0 then
@@ -171,10 +174,6 @@ unit agarmgas;
         getreferencestring:=s;
       end;
 
-
-    const
-      shiftmode2str: array[tshiftmode] of string[3] = ('','lsl','lsr','asr','ror','rrx');
-
     function getopstr(const o:toper) : string;
       var
         hs : string;
@@ -186,10 +185,13 @@ unit agarmgas;
             getopstr:=gas_regname(o.reg);
           top_shifterop:
             begin
-              if (o.shifterop^.rs<>NR_NO) and (o.shifterop^.shiftimm=0) then
-                getopstr:=shiftmode2str[o.shifterop^.shiftmode]+' '+gas_regname(o.shifterop^.rs)
+              {RRX is special, it only rotates by 1 and does not take any shiftervalue}
+              if o.shifterop^.shiftmode=SM_RRX then
+                getopstr:='rrx'
+              else if (o.shifterop^.rs<>NR_NO) and (o.shifterop^.shiftimm=0) then
+                getopstr:=gas_shiftmode2str[o.shifterop^.shiftmode]+' '+gas_regname(o.shifterop^.rs)
               else if (o.shifterop^.rs=NR_NO) then
-                getopstr:=shiftmode2str[o.shifterop^.shiftmode]+' #'+tostr(o.shifterop^.shiftimm)
+                getopstr:=gas_shiftmode2str[o.shifterop^.shiftmode]+' #'+tostr(o.shifterop^.shiftimm)
               else internalerror(200308282);
             end;
           top_const: