Переглянути джерело

+ x86: track use of full ymm registers and generate vzeroupper if needed

git-svn-id: trunk@45484 -
florian 5 роки тому
батько
коміт
82a3877126

+ 3 - 1
compiler/globtype.pas

@@ -748,7 +748,9 @@ interface
          { subroutine needs to load and maintain a tls register }
          pi_needs_tls,
          { subroutine uses get_frame }
-         pi_uses_get_frame
+         pi_uses_get_frame,
+         { x86 only: subroutine uses ymm registers, requires vzeroupper call }
+         pi_uses_ymm
        );
        tprocinfoflags=set of tprocinfoflag;
 

+ 3 - 0
compiler/i386/cgcpu.pas

@@ -338,6 +338,9 @@ unit cgcpu;
             list.concat(tai_regalloc.dealloc(current_procinfo.framepointer,nil));
           end;
 
+        if pi_uses_ymm in current_procinfo.flags then
+          list.Concat(taicpu.op_none(A_VZEROUPPER));
+
         { return from proc }
         if po_interrupt in current_procinfo.procdef.procoptions then
           begin

+ 3 - 1
compiler/utils/ppuutils/ppudump.pp

@@ -1641,7 +1641,9 @@ const
          (mask:pi_needs_tls;
          str:' uses TLS data pointer '),
          (mask:pi_uses_get_frame;
-         str:' uses get_frame')
+         str:' uses get_frame'),
+         (mask:pi_uses_ymm;
+         str:' uses ymm register (x86 only)')
   );
 var
   procinfooptions : tprocinfoflags;

+ 4 - 0
compiler/x86_64/cgcpu.pas

@@ -423,7 +423,11 @@ unit cgcpu;
             list.concat(tai_regalloc.dealloc(current_procinfo.framepointer,nil));
           end;
 
+        if pi_uses_ymm in current_procinfo.flags then
+          list.Concat(taicpu.op_none(A_VZEROUPPER));
+
         list.concat(Taicpu.Op_none(A_RET,S_NO));
+
         if (pi_has_unwind_info in current_procinfo.flags) then
           begin
             tcpuprocinfo(current_procinfo).dump_scopes(list);