armhf-fix-vstr-vld-offset
authorPascal Packaging Team <pkg-pascal-devel@lists.alioth.debian.org>
Mon, 30 Oct 2017 19:32:33 +0000 (19:32 +0000)
committerPaul Gevers <elbrus@debian.org>
Mon, 30 Oct 2017 19:32:33 +0000 (19:32 +0000)
Gbp-Pq: Name armhf-fix-vstr-vld-offset.patch

fpcsrc/compiler/arm/rgcpu.pas

index be21c685f7e5bdb230005d55cfeac56ebee4d114..25cfb14dda6e923d888755e9584599ea144997ce 100644 (file)
@@ -189,7 +189,7 @@ unit rgcpu;
 
       { Lets remove the bits we can fold in later and check if the result can be easily with an add or sub }
       a:=abs(spilltemp.offset);
-      if GenerateThumbCode then
+      if GenerateThumbCode or (getregtype(tempreg)=R_MMREGISTER) then
         begin
           {$ifdef DEBUG_SPILLING}
           helplist.concat(tai_comment.create(strpnew('Spilling: Use a_load_const_reg to fix spill offset')));
@@ -243,9 +243,10 @@ unit rgcpu;
     end;
 
 
-   function fix_spilling_offset(offset : ASizeInt) : boolean;
+   function fix_spilling_offset(regtype : TRegisterType;offset : ASizeInt) : boolean;
      begin
        result:=(abs(offset)>4095) or
+         ((regtype=R_MMREGISTER) and (abs(offset)>1020)) or
           ((GenerateThumbCode) and ((offset<0) or (offset>1020)));
      end;
 
@@ -255,7 +256,7 @@ unit rgcpu;
         { don't load spilled register between
           mov lr,pc
           mov pc,r4
-          but befure the mov lr,pc
+          but before the mov lr,pc
         }
         if assigned(pos.previous) and
           (pos.typ=ait_instruction) and
@@ -266,7 +267,7 @@ unit rgcpu;
           (taicpu(pos).oper[1]^.reg=NR_PC) then
           pos:=tai(pos.previous);
 
-        if fix_spilling_offset(spilltemp.offset) then
+        if fix_spilling_offset(getregtype(tempreg),spilltemp.offset) then
           spilling_create_load_store(list, pos, spilltemp, tempreg, false)
         else
           inherited do_spill_read(list,pos,spilltemp,tempreg);
@@ -275,7 +276,7 @@ unit rgcpu;
 
     procedure trgcpu.do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);
       begin
-        if fix_spilling_offset(spilltemp.offset) then
+        if fix_spilling_offset(getregtype(tempreg),spilltemp.offset) then
           spilling_create_load_store(list, pos, spilltemp, tempreg, true)
         else
           inherited do_spill_written(list,pos,spilltemp,tempreg);