Sfoglia il codice sorgente

--- Merging r33922 into '.':
U compiler/aarch64/cpupara.pas
A tests/webtbs/tw30207.pp
--- Recording mergeinfo for merge of r33922 into '.':
U .
--- Merging r34293 into '.':
G compiler/aarch64/cpupara.pas

git-svn-id: branches/fixes_3_0_ios@34964 -

Jonas Maebe 8 anni fa
parent
commit
381af40673
3 ha cambiato i file con 90 aggiunte e 23 eliminazioni
  1. 1 0
      .gitattributes
  2. 17 23
      compiler/aarch64/cpupara.pas
  3. 72 0
      tests/webtbs/tw30207.pp

+ 1 - 0
.gitattributes

@@ -14676,6 +14676,7 @@ tests/webtbs/tw3005.pp svneol=native#text/plain
 tests/webtbs/tw3010.pp svneol=native#text/plain
 tests/webtbs/tw3012.pp svneol=native#text/plain
 tests/webtbs/tw30166.pp svneol=native#text/plain
+tests/webtbs/tw30207.pp svneol=native#text/plain
 tests/webtbs/tw3023.pp svneol=native#text/plain
 tests/webtbs/tw3028.pp svneol=native#text/plain
 tests/webtbs/tw3038.pp svneol=native#text/plain

+ 17 - 23
compiler/aarch64/cpupara.pas

@@ -99,29 +99,23 @@ unit cpupara;
             begin
               if is_special_array(p) then
                 exit;
-              case tarraydef(p).elementdef.typ of
-                floatdef:
-                  begin
-                    { an array of empty records has no influence }
-                    if tarraydef(p).elementdef.size=0 then
-                      begin
-                        result:=true;
-                        exit
-                      end;
-                    tmpelecount:=0;
-                    if not is_hfa_internal(tarraydef(p).elementdef,basedef,tmpelecount) then
-                      exit;
-                    { tmpelecount now contains the number of hfa elements in a
-                      single array element (e.g. 2 if it's an array of a record
-                      containing two singles) -> multiply by number of elements
-                      in the array }
-                    inc(elecount,tarraydef(p).elecount*tmpelecount);
-                    if elecount>4 then
-                      exit;
-                  end;
-                else
-                  result:=is_hfa_internal(tarraydef(p).elementdef,basedef,elecount);
+              { an array of empty records has no influence }
+              if tarraydef(p).elementdef.size=0 then
+                begin
+                  result:=true;
+                  exit
                 end;
+              tmpelecount:=0;
+              if not is_hfa_internal(tarraydef(p).elementdef,basedef,tmpelecount) then
+                exit;
+              { tmpelecount now contains the number of hfa elements in a
+                single array element (e.g. 2 if it's an array of a record
+                containing two singles) -> multiply by number of elements
+                in the array }
+              inc(elecount,tarraydef(p).elecount*tmpelecount);
+              if elecount>4 then
+                exit;
+              result:=true;
             end;
           floatdef:
             begin
@@ -467,7 +461,7 @@ unit cpupara;
              begin;
                { every hfa element must be passed in a separate register }
                if (assigned(hfabasedef) and
-                   (curmmreg+(paralen div hfabasedef.size)>RS_LAST_MM_PARAM_SUPREG)) or
+                   (curmmreg+((paralen-1) div hfabasedef.size)>RS_LAST_MM_PARAM_SUPREG)) or
                   (curmmreg+((paralen-1) shr 3)>RS_LAST_MM_PARAM_SUPREG) then
                  begin
                    { not enough mm registers left -> no more register

+ 72 - 0
tests/webtbs/tw30207.pp

@@ -0,0 +1,72 @@
+{ %cpu=aarch64 }
+
+{$mode objfpc}
+
+type
+  trec = record
+    a1,a2,a3,a4,a5,a6,a7,a8,a9,a10: double;
+  end;
+  prec = ^trec;
+
+var
+  r: trec;
+
+procedure getdouble(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10: double; r: prec);
+assembler;
+asm
+  stur d0,[x0]
+  add x0, x0, #8
+
+  stur d1,[x0]
+  add x0, x0, #8
+
+  stur d2,[x0]
+  add x0, x0, #8
+
+  stur d3,[x0]
+  add x0, x0, #8
+
+  stur d4,[x0]
+  add x0, x0, #8
+
+  stur d5,[x0]
+  add x0, x0, #8
+
+  stur d6,[x0]
+  add x0, x0, #8
+
+  stur d7,[x0]
+  add x0, x0, #8
+
+  ldr  d0,[x29, #16]
+  stur d0,[x0]
+  add x0, x0, #8
+
+  ldr  d0,[x29, #24]
+  stur d0,[x0]
+end;
+       
+begin
+   getdouble(1,2,3,4,5,6,7,8,9,10,@r);
+
+   if r.a1<>1.0 then
+     halt(1);
+   if r.a2<>2.0 then
+     halt(2);
+   if r.a3<>3.0 then
+     halt(3);
+   if r.a4<>4.0 then
+     halt(4);
+   if r.a5<>5.0 then
+     halt(5);
+   if r.a6<>6.0 then
+     halt(6);
+   if r.a7<>7.0 then
+     halt(6);
+   if r.a8<>8.0 then
+     halt(8);
+   if r.a9<>9.0 then
+     halt(9);
+   if r.a10<>10.0 then
+     halt(10);
+end.