Browse Source

+ random bits for quad support on RiscV

florian 6 months ago
parent
commit
2c5a070959
4 changed files with 27 additions and 0 deletions
  1. 2 0
      compiler/compinnr.pas
  2. 12 0
      compiler/defutil.pas
  3. 10 0
      compiler/riscv/cpubase.pas
  4. 3 0
      compiler/riscv/itcpugas.pas

+ 2 - 0
compiler/compinnr.pas

@@ -176,6 +176,8 @@ type
      in_min_int64        = 146,
      in_min_int64        = 146,
      in_max_qword        = 147,
      in_max_qword        = 147,
      in_max_int64        = 148,
      in_max_int64        = 148,
+     in_min_quad         = 149,
+     in_max_quad         = 150,
 
 
 { MMX functions }
 { MMX functions }
 { these contants are used by the mmx unit }
 { these contants are used by the mmx unit }

+ 12 - 0
compiler/defutil.pas

@@ -257,6 +257,9 @@ interface
     {# Returns true, if def is an extended type }
     {# Returns true, if def is an extended type }
     function is_extended(def : tdef) : boolean;
     function is_extended(def : tdef) : boolean;
 
 
+    {# Returns true, if def is quad type }
+    function is_quad(def : tdef) : boolean;
+
     {# Returns true, if definition is a "real" real (i.e. single/double/extended) }
     {# Returns true, if definition is a "real" real (i.e. single/double/extended) }
     function is_real(def : tdef) : boolean;
     function is_real(def : tdef) : boolean;
 
 
@@ -476,6 +479,7 @@ implementation
       end;
       end;
 
 
 
 
+    { returns true, if def is an extended type }
     function is_extended(def : tdef) : boolean;
     function is_extended(def : tdef) : boolean;
       begin
       begin
         result:=(def.typ=floatdef) and
         result:=(def.typ=floatdef) and
@@ -483,6 +487,14 @@ implementation
       end;
       end;
 
 
 
 
+    { returns true, if def is a quad type }
+    function is_quad(def : tdef) : boolean;
+      begin
+        result:=(def.typ=floatdef) and
+          (tfloatdef(def).floattype=s128real);
+      end;
+
+
     { returns true, if definition is a "real" real (i.e. single/double/extended) }
     { returns true, if definition is a "real" real (i.e. single/double/extended) }
     function is_real(def : tdef) : boolean;
     function is_real(def : tdef) : boolean;
       begin
       begin

+ 10 - 0
compiler/riscv/cpubase.pas

@@ -156,6 +156,16 @@ uses
         A_FCVT_D_L,A_FCVT_D_LU,A_FMV_D_X,
         A_FCVT_D_L,A_FCVT_D_LU,A_FMV_D_X,
 {$endif RISCV64}
 {$endif RISCV64}
 
 
+        { Q-extension }
+//        A_FLD,A_FSD,
+//        A_FMADD_D,A_FMSUB_D,A_FNMSUB_D,A_FNMADD_D,
+//        A_FADD_D,A_FSUB_D,A_FMUL_D,A_FDIV_D,
+//        A_FSQRT_D,A_FSGNJ_D,A_FSGNJN_D,A_FSGNJX_D,
+        A_FMIN_Q,A_FMAX_Q,
+//        A_FEQ_D,A_FLT_D,A_FLE_D,A_FCLASS_D,
+//        A_FCVT_D_S,A_FCVT_S_D,
+//        A_FCVT_W_D,A_FCVT_WU_D,A_FCVT_D_W,A_FCVT_D_WU,
+
         { Machine mode }
         { Machine mode }
         A_MRET,A_HRET,A_SRET,A_URET,
         A_MRET,A_HRET,A_SRET,A_URET,
         A_WFI,
         A_WFI,

+ 3 - 0
compiler/riscv/itcpugas.pas

@@ -147,6 +147,9 @@ unit itcpugas;
         'fcvt.d.l','fcvt.d.lu','fmv.d.x',
         'fcvt.d.l','fcvt.d.lu','fmv.d.x',
 {$endif RISCV64}
 {$endif RISCV64}
 
 
+        { q-extension }
+        'fmax.q','fmax.q',
+
         { Machine mode }
         { Machine mode }
         'mret','hret','sret','uret',
         'mret','hret','sret','uret',
         'wfi',
         'wfi',