Browse Source

+ Aarch64: read register sets with ranges properly
+ tests

florian 3 năm trước cách đây
mục cha
commit
d708bef92f

+ 25 - 7
compiler/aarch64/racpugas.pas

@@ -840,14 +840,32 @@ Unit racpugas;
               oper.opr.typ:=OPR_REGSET;
               oper.opr.basereg:=parsereg;
               oper.opr.nregs:=1;
-              while (oper.opr.nregs<4) and
-                    (actasmtoken=AS_COMMA) do
+
+              while (actasmtoken<>AS_RSBRACKET) and (oper.opr.nregs<4) do
                 begin
-                  consume(AS_COMMA);
-                  tempreg:=parsereg;
-                  if getsupreg(tempreg)<>((getsupreg(oper.opr.basereg)+oper.opr.nregs) mod 32) then
-                    Message(asmr_e_a64_invalid_regset);
-                  inc(oper.opr.nregs);
+                  if actasmtoken=AS_MINUS then
+                    begin
+                      consume(AS_MINUS);
+                      tempreg:=parsereg;
+
+                      if (getsupreg(tempreg)-getsupreg(oper.opr.basereg))>=4 then
+                        Message(asmr_e_a64_regset_too_large);
+                      oper.opr.nregs:=getsupreg(tempreg)-getsupreg(oper.opr.basereg)+1;
+                      if actasmtoken<>AS_COMMA then
+                        break;
+                    end;
+                  if actasmtoken=AS_COMMA then
+                    begin
+                      consume(AS_COMMA);
+                      tempreg:=parsereg;
+                      if (getsupreg(tempreg)-getsupreg(oper.opr.basereg))>=4 then
+                        Message(asmr_e_a64_regset_too_large);
+                      if getsupreg(tempreg)<>((getsupreg(oper.opr.basereg)+oper.opr.nregs) mod 32) then
+                        Message(asmr_e_a64_invalid_regset);
+                      inc(oper.opr.nregs);
+                    end
+                  else
+                    break;
                 end;
               consume(AS_RSBRACKET);
               if actasmtoken=AS_LBRACKET then

+ 2 - 1
compiler/msg/errore.msg

@@ -2590,7 +2590,7 @@ cg_w_interrupt_does_not_save_registers=06062_W_The target CPU does not support p
 #
 # Assembler reader
 #
-# 07146 is the last used one
+# 07147 is the last used one
 #
 asmr_d_start_reading=07000_DL_Starting $1 styled assembler parsing
 % This informs you that an assembler block is being parsed
@@ -2935,6 +2935,7 @@ asmr_e_a64_invalid_regset=07144_E_Registers in a register set must be consecutiv
 asmr_e_unknown_field=07145_E_Unknown field identifier
 % The internal assembler read cannot find the passed field identifier.
 asmr_e_not_supported_combination_attsuffix_memrefsize_type=07146_E_Not supported combination opcode: $1 - att-suffix-type {$2} and memrefsize-type {$3}
+asmr_e_a64_regset_too_large=07147_E_Too many registers in register set.
 #
 # Assembler/binary writers
 #

+ 3 - 2
compiler/msgidx.inc

@@ -862,6 +862,7 @@ const
   asmr_e_a64_invalid_regset=07144;
   asmr_e_unknown_field=07145;
   asmr_e_not_supported_combination_attsuffix_memrefsize_type=07146;
+  asmr_e_a64_regset_too_large=07147;
   asmw_f_too_many_asm_files=08000;
   asmw_f_assembler_output_not_supported=08001;
   asmw_f_comp_not_supported=08002;
@@ -1145,9 +1146,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 88831;
+  MsgTxtSize = 88875;
 
   MsgIdxMax : array[1..20] of longint=(
-    28,109,361,131,99,63,147,37,223,69,
+    28,109,361,131,99,63,148,37,223,69,
     65,20,30,1,1,1,1,1,1,1
   );

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 271 - 270
compiler/msgtxt.inc


+ 9 - 0
tests/tbf/tb0281.pp

@@ -0,0 +1,9 @@
+{ %fail }
+{ %cpu=aarch64 }
+{ %opt=-s }  { the compiler must throw the error }
+
+begin
+  asm
+    ld1 {v20.4s-v21.4s,v23.4s},[x3]
+  end;
+end.

+ 9 - 0
tests/tbf/tb0282.pp

@@ -0,0 +1,9 @@
+{ %fail }
+{ %cpu=aarch64 }
+{ %opt=-s }  { the compiler must throw the error }
+
+begin
+  asm
+    ld1 {v20.4s-v21.4s,v22.4s,},[x3]
+  end;
+end.

+ 9 - 0
tests/tbf/tb0283.pp

@@ -0,0 +1,9 @@
+{ %fail }
+{ %cpu=aarch64 }
+{ %opt=-s }  { the compiler must throw the error }
+
+begin
+  asm
+    ld1 {v20.4s-v25.4s},[x3]
+  end;
+end.

+ 9 - 0
tests/tbf/tb0284.pp

@@ -0,0 +1,9 @@
+{ %fail }
+{ %cpu=aarch64 }
+{ %opt=-s }  { the compiler must throw the error }
+
+begin
+  asm
+    ld1 {v20.4s-v23.4s,v24.4s},[x3]
+  end;
+end.

+ 11 - 0
tests/tbs/tb0687.pp

@@ -0,0 +1,11 @@
+{ %cpu=aarch64 }
+{ %norun }
+
+begin
+  asm
+    ld1 {v20.4s-v21.4s,v22.4s},[x3]
+    ld1 {v20.4s-v23.4s},[x3]
+    ld1 {v20.4s-v22.4s,v23.4s},[x3]
+    ld1 {v20.4s-v21.4s,v22.4s},[x3]
+  end;
+end.

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác