浏览代码

+ RiscV: support ZMMUL extension

florian 8 月之前
父节点
当前提交
95c2a5a2d7

+ 1 - 1
compiler/riscv/cgrv.pas

@@ -316,7 +316,7 @@ unit cgrv;
               end
               end
             else
             else
 {$endif RISCV64}
 {$endif RISCV64}
-            if (op in [OP_IMUL,OP_MUL]) and not(CPURV_HAS_MUL in cpu_capabilities[current_settings.cputype]) then
+            if (op in [OP_IMUL,OP_MUL]) and ([CPURV_HAS_MUL,CPURV_HAS_ZMMUL]*cpu_capabilities[current_settings.cputype]=[]) then
               begin
               begin
                 case size of
                 case size of
                   OS_8:
                   OS_8:

+ 3 - 3
compiler/riscv/nrvadd.pas

@@ -213,7 +213,7 @@ implementation
 
 
     function trvaddnode.use_mul_helper: boolean;
     function trvaddnode.use_mul_helper: boolean;
       begin
       begin
-        if (nodetype=muln) and not(CPURV_HAS_MUL in cpu_capabilities[current_settings.cputype]) then
+        if (nodetype=muln) and ([CPURV_HAS_MUL,CPURV_HAS_ZMMUL]*cpu_capabilities[current_settings.cputype]=[]) then
           result:=true
           result:=true
         else
         else
           Result:=inherited use_mul_helper;
           Result:=inherited use_mul_helper;
@@ -279,7 +279,7 @@ implementation
       begin
       begin
         if (nodetype=muln) and
         if (nodetype=muln) and
            (left.resultdef.typ=orddef) and (left.resultdef.typ=orddef) and
            (left.resultdef.typ=orddef) and (left.resultdef.typ=orddef) and
-           (CPURV_HAS_MUL in cpu_capabilities[current_settings.cputype])
+           ([CPURV_HAS_MUL,CPURV_HAS_ZMMUL]*cpu_capabilities[current_settings.cputype]<>[])
 {$ifdef cpu32bitalu}
 {$ifdef cpu32bitalu}
            and (not (is_64bit(left.resultdef) or
            and (not (is_64bit(left.resultdef) or
                      is_64bit(right.resultdef)))
                      is_64bit(right.resultdef)))
@@ -294,7 +294,7 @@ implementation
             expectloc:=LOC_REGISTER;
             expectloc:=LOC_REGISTER;
           end
           end
         else if (nodetype=muln) and
         else if (nodetype=muln) and
-           (not (CPURV_HAS_MUL in cpu_capabilities[current_settings.cputype])) and
+           ([CPURV_HAS_MUL,CPURV_HAS_ZMMUL]*cpu_capabilities[current_settings.cputype]=[]) and
            (is_64bit(left.resultdef) or
            (is_64bit(left.resultdef) or
             is_64bit(right.resultdef)) then
             is_64bit(right.resultdef)) then
           begin
           begin

+ 2 - 0
compiler/riscv/nrvutil.pas

@@ -87,6 +87,8 @@ implementation
             attr_arch:=attr_arch+'_zicrs2p0';
             attr_arch:=attr_arch+'_zicrs2p0';
           if CPURV_HAS_FETCH_FENCE in cpu_capabilities[current_settings.cputype] then
           if CPURV_HAS_FETCH_FENCE in cpu_capabilities[current_settings.cputype] then
             attr_arch:=attr_arch+'_zifencei2p0';
             attr_arch:=attr_arch+'_zifencei2p0';
+          if CPURV_HAS_ZMMUL in cpu_capabilities[current_settings.cputype] then
+            attr_arch:=attr_arch+'_zmmul1p0';
           if CPURV_HAS_ZFA in cpu_capabilities[current_settings.cputype] then
           if CPURV_HAS_ZFA in cpu_capabilities[current_settings.cputype] then
             attr_arch:=attr_arch+'_zfa1p0';
             attr_arch:=attr_arch+'_zfa1p0';
           if CPURV_HAS_ZBA in cpu_capabilities[current_settings.cputype] then
           if CPURV_HAS_ZBA in cpu_capabilities[current_settings.cputype] then

+ 2 - 1
compiler/riscv32/cpuinfo.pas

@@ -225,7 +225,8 @@ Const
        CPURV_HAS_ZDINX,
        CPURV_HAS_ZDINX,
        CPURV_HAS_ZHINX,
        CPURV_HAS_ZHINX,
        CPURV_HAS_ZHINXMIN,
        CPURV_HAS_ZHINXMIN,
-       CPURV_HAS_ZICOND
+       CPURV_HAS_ZICOND,
+       CPURV_HAS_ZMMUL
       );
       );
 
 
  const
  const

+ 2 - 1
compiler/riscv64/cpuinfo.pas

@@ -143,7 +143,8 @@ Const
        CPURV_HAS_ZDINX,
        CPURV_HAS_ZDINX,
        CPURV_HAS_ZHINX,
        CPURV_HAS_ZHINX,
        CPURV_HAS_ZHINXMIN,
        CPURV_HAS_ZHINXMIN,
-       CPURV_HAS_ZICOND
+       CPURV_HAS_ZICOND,
+       CPURV_HAS_ZMMUL
       );
       );
 
 
  const
  const

+ 2 - 2
compiler/riscv64/nrv64add.pas

@@ -57,7 +57,7 @@ unit nrv64add;
       begin
       begin
         if (nodetype=muln) and
         if (nodetype=muln) and
            (left.resultdef.typ=orddef) and (left.resultdef.typ=orddef) and
            (left.resultdef.typ=orddef) and (left.resultdef.typ=orddef) and
-           (CPURV_HAS_MUL in cpu_capabilities[current_settings.cputype]) then
+           ([CPURV_HAS_MUL,CPURV_HAS_ZMMUL]*cpu_capabilities[current_settings.cputype]<>[]) then
           begin
           begin
             result:=nil;
             result:=nil;
 
 
@@ -67,7 +67,7 @@ unit nrv64add;
             expectloc:=LOC_REGISTER;
             expectloc:=LOC_REGISTER;
           end
           end
         else if (nodetype=muln) and
         else if (nodetype=muln) and
-           (not (CPURV_HAS_MUL in cpu_capabilities[current_settings.cputype])) and
+           ([CPURV_HAS_MUL,CPURV_HAS_ZMMUL]*cpu_capabilities[current_settings.cputype]=[]) and
            (is_64bit(left.resultdef) or
            (is_64bit(left.resultdef) or
             is_64bit(right.resultdef)) then
             is_64bit(right.resultdef)) then
           begin
           begin