re PR rtl-optimization/66838 (Calling multiple SYSV AMD64 ABI functions from MS x64...
authorUros Bizjak <uros@gcc.gnu.org>
Wed, 15 Jul 2015 07:28:33 +0000 (09:28 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Wed, 15 Jul 2015 07:28:33 +0000 (09:28 +0200)
PR rtl-optimization/66838
* postreload.c (reload_cse_move2add): Also process
CALL_INSN_FUNCTION_USAGE when resetting information of
call-clobbered registers.

testsuite/ChangeLog:

PR rtl-optimization/66838
* gcc.target/i386/pr66838.c: New test.

From-SVN: r225806

gcc/ChangeLog
gcc/postreload.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr66838.c [new file with mode: 0644]

index 1e7fbab..327564f 100644 (file)
@@ -1,3 +1,10 @@
+2015-07-15  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR rtl-optimization/66838
+       * postreload.c (reload_cse_move2add): Also process
+       CALL_INSN_FUNCTION_USAGE when resetting information of
+       call-clobbered registers.
+
 2015-07-14  Sandra Loosemore  <sandra@codesourcery.com>
            Cesar Philippidis  <cesar@codesourcery.com>
            Chung-Lin Tang  <cltang@codesourcery.com>
@@ -21,8 +28,8 @@
        (nios2_expand_cache_builtin): New function.
        (nios2_expand_wrpie_builtin): New function.
        (nios2_expand_eni_builtin): New function.
-       (nios2_expand_builtin): Add arch field handling and new builtin 
-        cases.
+       (nios2_expand_builtin): Add arch field handling and new builtin
+       cases.
        * doc/extend.texi (Altera Nios II Built-in Functions): Document
        new builtins.
        * doc/md.texi (Machine Constraints): Document U and v constraints.
        * omega.h: Don't include config.h, don't include params.h again if
        omega.h has already been included.
        * graphite-poly.h: Include sese.h.
-       * graphite.c: Don't include sese.h, remove needless includes and 
+       * graphite.c: Don't include sese.h, remove needless includes and
        minimize includes outside #ifdef HAVE_isl block.
        * graphite-blocking.c: Don't include sese.h, remove needless includes,
        and wrap entire file in #ifdef HAVE_isl
index a7eb55f..88d5234 100644 (file)
@@ -2127,12 +2127,29 @@ reload_cse_move2add (rtx_insn *first)
         unknown values.  */
       if (CALL_P (insn))
        {
+         rtx link;
+
          for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--)
            {
              if (call_used_regs[i])
                /* Reset the information about this register.  */
                reg_mode[i] = VOIDmode;
            }
+
+         for (link = CALL_INSN_FUNCTION_USAGE (insn); link;
+              link = XEXP (link, 1))
+           {
+             rtx setuse = XEXP (link, 0);
+             rtx usage_rtx = XEXP (setuse, 0);
+             if (GET_CODE (setuse) == CLOBBER
+                 && REG_P (usage_rtx))
+               {
+                 unsigned int end_regno = END_REGNO (usage_rtx);
+                 for (unsigned int r = REGNO (usage_rtx); r < end_regno; ++r)
+                   /* Reset the information about this register.  */
+                   reg_mode[r] = VOIDmode;
+               }
+           }
        }
     }
   return changed;
index b5a2707..82d8660 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-15  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR rtl-optimization/66838
+       * gcc.target/i386/pr66838.c: New test.
+
 2015-07-14  Patrick Palka  <ppalka@gcc.gnu.org>
 
        PR c++/66850
        * gcc.target/mips/umips-branch-14.c: New file.
        * gcc.target/mips/umips-branch-15.c: New file.
        * gcc.target/mips/umips-branch-16.c: New file.
-       * gcc.target/mips/branch-helper.h (OCCUPY_0x10000): New define.  
+       * gcc.target/mips/branch-helper.h (OCCUPY_0x10000): New define.
        (OCCUPY_0xfffc): New define.
 
 2015-07-08  Renlin Li  <renlin.li@arm.com>
        * gcc.target/arm/attr_thumb-static.c: Test for all targets.
        Fix return value.
 
-2015-05-05  Jakub Jelinek  <jakub@redhat.com>
+2015-07-06  Jakub Jelinek  <jakub@redhat.com>
 
-        PR target/65956
-        * gcc.c-torture/execute/pr65956.c: New test.
+       PR target/65956
+       * gcc.c-torture/execute/pr65956.c: New test.
 
 2015-07-06  Alan Lawrence  <alan.lawrence@arm.com>
 
        * gcc.target/arm/armv8-sync-op-full.c: Likewise.
        * gcc.target/arm/armv8-sync-op-release.c: Likewise.
        * gcc.target/arm/armv8-sync-op-acquire.c: Likewise.  Also, replace
-        'stlex' with 'strex' as the expected output.
+       'stlex' with 'strex' as the expected output.
 
 2015-07-01  Paolo Carlini  <paolo.carlini@oracle.com>
 
 2015-06-24  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
 
        * gcc.target/arm/fixed_float_conversion.c: Skip for inappropriate
-          multilibs.
+       multilibs.
        * gcc.target/arm/memset-inline-10.c: Likewise.
        * gcc.target/arm/pr58784.c: Likewise.
        * gcc.target/arm/pr59985.C: Likewise.
 
 2015-06-24  James Greenhalgh  <james.greenhalgh@arm.com>
 
-        * lib/c-torture.exp: Don't call check_effective_target_lto
+       * lib/c-torture.exp: Don't call check_effective_target_lto
        before setting up environment correctly.
-        * lib/gcc-dg.exp: Likewise, and protect
+       * lib/gcc-dg.exp: Likewise, and protect
        gcc_force_conventional_output.
 
 2015-06-24  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
 
 2015-06-23  Chen Gang  <gang.chen.5i5j@gmail.com>
 
-        PR target/65803
+       PR target/65803
        * gcc.c-torture/pr65803.c: New test.
 
 2015-06-23  Patrick Palka  <ppalka@gcc.gnu.org>
 
 2015-06-01  Alex Velenko  <Alex.Velenko@arm.com>
 
-        * gcc.target/arm/thumb-ltu.c (foo): Predefined.
-        (bar): Predefined.
+       * gcc.target/arm/thumb-ltu.c (foo): Predefined.
+       (bar): Predefined.
 
 2015-06-01  Richard Biener  <rguenther@suse.de>
 
diff --git a/gcc/testsuite/gcc.target/i386/pr66838.c b/gcc/testsuite/gcc.target/i386/pr66838.c
new file mode 100644 (file)
index 0000000..46effed
--- /dev/null
@@ -0,0 +1,36 @@
+/* { dg-do run { target lp64 } } */
+/* { dg-options "-O2" } */
+
+void abort (void);
+
+char global;
+
+__attribute__((sysv_abi, noinline, noclone))
+void sysv_abi_func(char const *desc, void *local)
+{
+  register int esi asm ("esi");
+  register int edi asm ("edi");
+  
+  if (local != &global)
+    abort ();
+
+  /* Clobber some of the extra SYSV ABI registers.  */
+  asm volatile ("movl\t%2, %0\n\tmovl\t%2, %1"
+               : "=r" (esi), "=r" (edi)
+               : "i" (0xdeadbeef));
+}
+
+__attribute__((ms_abi, noinline, noclone))
+void ms_abi_func ()
+{
+  sysv_abi_func ("1st call", &global);
+  sysv_abi_func ("2nd call", &global);
+  sysv_abi_func ("3rd call", &global);
+}
+
+int
+main(void)
+{
+  ms_abi_func();
+  return 0;
+}