Selaa lähdekoodia

--- Merging r49236 into '.':
U compiler/aarch64/hlcgcpu.pas
A tests/webtbs/tw38766.pp
--- Recording mergeinfo for merge of r49236 into '.':
U .

git-svn-id: branches/fixes_3_2@49237 -

Jonas Maebe 4 vuotta sitten
vanhempi
commit
acb59c7592
3 muutettua tiedostoa jossa 31 lisäystä ja 1 poistoa
  1. 1 0
      .gitattributes
  2. 2 1
      compiler/aarch64/hlcgcpu.pas
  3. 28 0
      tests/webtbs/tw38766.pp

+ 1 - 0
.gitattributes

@@ -17855,6 +17855,7 @@ tests/webtbs/tw3864.pp svneol=native#text/plain
 tests/webtbs/tw3865.pp svneol=native#text/plain
 tests/webtbs/tw3865.pp svneol=native#text/plain
 tests/webtbs/tw38695.pp svneol=native#text/pascal
 tests/webtbs/tw38695.pp svneol=native#text/pascal
 tests/webtbs/tw3870.pp svneol=native#text/plain
 tests/webtbs/tw3870.pp svneol=native#text/plain
+tests/webtbs/tw38766.pp svneol=native#text/plain
 tests/webtbs/tw3893.pp svneol=native#text/plain
 tests/webtbs/tw3893.pp svneol=native#text/plain
 tests/webtbs/tw3898.pp svneol=native#text/plain
 tests/webtbs/tw3898.pp svneol=native#text/plain
 tests/webtbs/tw3899.pp svneol=native#text/plain
 tests/webtbs/tw3899.pp svneol=native#text/plain

+ 2 - 1
compiler/aarch64/hlcgcpu.pas

@@ -212,7 +212,8 @@ implementation
       if slopt in [SL_SETZERO,SL_SETMAX] then
       if slopt in [SL_SETZERO,SL_SETMAX] then
         inherited
         inherited
       else if not(sreg.bitlen in [32,64]) or
       else if not(sreg.bitlen in [32,64]) or
-              (sreg.startbit<>0) then
+              (sreg.startbit<>0) or
+              (getsubreg(fromreg)<getsubreg(sreg.subsetreg)) then
         begin
         begin
           makeregssamesize(list,def_cgsize(fromsize),sreg.subsetregsize,fromreg,sreg.subsetreg,fromreg,toreg);
           makeregssamesize(list,def_cgsize(fromsize),sreg.subsetregsize,fromreg,sreg.subsetreg,fromreg,toreg);
           list.concat(taicpu.op_reg_reg_const_const(A_BFI,toreg,fromreg,sreg.startbit,sreg.bitlen))
           list.concat(taicpu.op_reg_reg_const_const(A_BFI,toreg,fromreg,sreg.startbit,sreg.bitlen))

+ 28 - 0
tests/webtbs/tw38766.pp

@@ -0,0 +1,28 @@
+{$mode objfpc}
+
+type
+  trec = record
+    x, y: longint;
+  end;
+
+function max(x,y: longint): longint;
+begin
+  if x>y then
+    result:=x
+  else
+    result:=y;
+end;
+
+function test: trec; inline;
+begin
+ result.x:=1;
+ result.y:=2;
+ result.x:=max(result.x,result.y);
+end;
+    
+begin
+  if test.x<>2 then
+    halt(1);
+  if test.y<>2 then
+    halt(2);
+end.