]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: extend.texi: s/390: Update documentation of hotpatch attribute.
authorDominik Vogt <vogt@linux.vnet.ibm.com>
Mon, 23 Feb 2015 11:36:01 +0000 (11:36 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Mon, 23 Feb 2015 11:36:01 +0000 (11:36 +0000)
2015-02-23  Dominik Vogt  <vogt@linux.vnet.ibm.com>

Backport from mainline
2015-01-27  Dominik Vogt  <vogt@linux.vnet.ibm.com>

* doc/extend.texi: s/390: Update documentation of hotpatch attribute.
* doc/invoke.texi (-mhotpatch): s/390: Update documentation of
-mhotpatch= option.
* config/s390/s390.opt (mhotpatch): s/390: Remove -mhotpatch and
-mno-hotpatch options.  Change syntax of -mhotpatch= option.
* config/s390/s390.c (s390_hotpatch_trampoline_halfwords_default):
Renamed.
(s390_hotpatch_trampoline_halfwords_max): Renamed.
(s390_hotpatch_hw_max): New name.
(s390_hotpatch_trampoline_halfwords): Renamed.
(s390_hotpatch_hw_before_label): New name.
(get_hotpatch_attribute): Removed.
(s390_hotpatch_hw_after_label): New name.
(s390_handle_hotpatch_attribute): Add second parameter to hotpatch
attribute.
(s390_attribute_table): Ditto.
(s390_function_num_hotpatch_trampoline_halfwords): Renamed.
(s390_function_num_hotpatch_hw): New name.
Remove special handling of inline functions and hotpatching.
Return number of nops before and after the function label.
(s390_can_inline_p): Removed.
(s390_asm_output_function_label): Emit a configurable number of nops
after the function label.
(s390_option_override): Update -mhotpatch= syntax and remove -mhotpatch.
(TARGET_CAN_INLINE_P) Removed.
(TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P): New.

From-SVN: r220914

25 files changed:
gcc/ChangeLog
gcc/config/s390/s390.c
gcc/config/s390/s390.opt
gcc/doc/extend.texi
gcc/doc/invoke.texi
gcc/testsuite/gcc.target/s390/hotpatch-1.c
gcc/testsuite/gcc.target/s390/hotpatch-10.c
gcc/testsuite/gcc.target/s390/hotpatch-11.c
gcc/testsuite/gcc.target/s390/hotpatch-12.c
gcc/testsuite/gcc.target/s390/hotpatch-2.c
gcc/testsuite/gcc.target/s390/hotpatch-3.c
gcc/testsuite/gcc.target/s390/hotpatch-4.c
gcc/testsuite/gcc.target/s390/hotpatch-5.c
gcc/testsuite/gcc.target/s390/hotpatch-6.c
gcc/testsuite/gcc.target/s390/hotpatch-7.c
gcc/testsuite/gcc.target/s390/hotpatch-8.c
gcc/testsuite/gcc.target/s390/hotpatch-9.c
gcc/testsuite/gcc.target/s390/hotpatch-compile-1.c
gcc/testsuite/gcc.target/s390/hotpatch-compile-2.c
gcc/testsuite/gcc.target/s390/hotpatch-compile-3.c
gcc/testsuite/gcc.target/s390/hotpatch-compile-4.c
gcc/testsuite/gcc.target/s390/hotpatch-compile-5.c
gcc/testsuite/gcc.target/s390/hotpatch-compile-6.c
gcc/testsuite/gcc.target/s390/hotpatch-compile-7.c
gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c

index b30050d163740e6d45e5b16fc37bc1b70bd735fa..014da10875a7a97841a31bea821cc7adf4c8c5d0 100644 (file)
@@ -1,3 +1,35 @@
+2015-02-23  Dominik Vogt  <vogt@linux.vnet.ibm.com>
+
+       Backport from mainline
+       2015-01-27  Dominik Vogt  <vogt@linux.vnet.ibm.com>
+
+       * doc/extend.texi: s/390: Update documentation of hotpatch attribute.
+       * doc/invoke.texi (-mhotpatch): s/390: Update documentation of
+       -mhotpatch= option.
+       * config/s390/s390.opt (mhotpatch): s/390: Remove -mhotpatch and
+       -mno-hotpatch options.  Change syntax of -mhotpatch= option.
+       * config/s390/s390.c (s390_hotpatch_trampoline_halfwords_default):
+       Renamed.
+       (s390_hotpatch_trampoline_halfwords_max): Renamed.
+       (s390_hotpatch_hw_max): New name.
+       (s390_hotpatch_trampoline_halfwords): Renamed.
+       (s390_hotpatch_hw_before_label): New name.
+       (get_hotpatch_attribute): Removed.
+       (s390_hotpatch_hw_after_label): New name.
+       (s390_handle_hotpatch_attribute): Add second parameter to hotpatch
+       attribute.
+       (s390_attribute_table): Ditto.
+       (s390_function_num_hotpatch_trampoline_halfwords): Renamed.
+       (s390_function_num_hotpatch_hw): New name.
+       Remove special handling of inline functions and hotpatching.
+       Return number of nops before and after the function label.
+       (s390_can_inline_p): Removed.
+       (s390_asm_output_function_label): Emit a configurable number of nops
+       after the function label.
+       (s390_option_override): Update -mhotpatch= syntax and remove -mhotpatch.
+       (TARGET_CAN_INLINE_P) Removed.
+       (TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P): New.
+
 2015-02-22  Uros Bizjak  <ubizjak@gmail.com>
 
        Backport from mainline
index 4fcefd70735a7ab2f7dd77762b7d3bd87a87c78e..1914c0356564432d20054aea1059555a9def874f 100644 (file)
@@ -407,24 +407,9 @@ struct GTY(()) machine_function
    bytes on a z10 (or higher) CPU.  */
 #define PREDICT_DISTANCE (TARGET_Z10 ? 384 : 2048)
 
-static const int s390_hotpatch_trampoline_halfwords_default = 12;
-static const int s390_hotpatch_trampoline_halfwords_max = 1000000;
-static int s390_hotpatch_trampoline_halfwords = -1;
-
-/* Return the argument of the given hotpatch attribute or the default value if
-   no argument is present.  */
-
-static inline int
-get_hotpatch_attribute (tree hotpatch_attr)
-{
-  const_tree args;
-
-  args = TREE_VALUE (hotpatch_attr);
-
-  return (args) ?
-    TREE_INT_CST_LOW (TREE_VALUE (args)):
-    s390_hotpatch_trampoline_halfwords_default;
-}
+static const int s390_hotpatch_hw_max = 1000000;
+static int s390_hotpatch_hw_before_label = 0;
+static int s390_hotpatch_hw_after_label = 0;
 
 /* Check whether the hotpatch attribute is applied to a function and, if it has
    an argument, the argument is valid.  */
@@ -433,34 +418,48 @@ static tree
 s390_handle_hotpatch_attribute (tree *node, tree name, tree args,
                                int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
 {
+  tree expr;
+  tree expr2;
+  int err;
+
   if (TREE_CODE (*node) != FUNCTION_DECL)
     {
       warning (OPT_Wattributes, "%qE attribute only applies to functions",
               name);
       *no_add_attrs = true;
     }
-  else if (args)
+  if (args != NULL && TREE_CHAIN (args) != NULL)
+    {
+      expr = TREE_VALUE (args);
+      expr2 = TREE_VALUE (TREE_CHAIN (args));
+    }
+  if (args == NULL || TREE_CHAIN (args) == NULL)
+    err = 1;
+  else if (TREE_CODE (expr) != INTEGER_CST
+          || !INTEGRAL_TYPE_P (TREE_TYPE (expr))
+          || TREE_INT_CST_HIGH (expr) != 0
+          || TREE_INT_CST_LOW (expr) > (unsigned int)s390_hotpatch_hw_max)
+    err = 1;
+  else if (TREE_CODE (expr2) != INTEGER_CST
+          || !INTEGRAL_TYPE_P (TREE_TYPE (expr2))
+          || TREE_INT_CST_HIGH (expr2) != 0
+          || TREE_INT_CST_LOW (expr2) > (unsigned int)s390_hotpatch_hw_max)
+    err = 1;
+  else
+    err = 0;
+  if (err)
     {
-      tree expr = TREE_VALUE (args);
-
-      if (TREE_CODE (expr) != INTEGER_CST
-         || !INTEGRAL_TYPE_P (TREE_TYPE (expr))
-         || TREE_INT_CST_HIGH (expr) != 0
-         || TREE_INT_CST_LOW (expr) > (unsigned int)
-         s390_hotpatch_trampoline_halfwords_max)
-       {
-         error ("requested %qE attribute is not a non-negative integer"
-                " constant or too large (max. %d)", name,
-                s390_hotpatch_trampoline_halfwords_max);
-         *no_add_attrs = true;
-       }
+      error ("requested %qE attribute is not a comma separated pair of"
+            " non-negative integer constants or too large (max. %d)", name,
+            s390_hotpatch_hw_max);
+      *no_add_attrs = true;
     }
 
   return NULL_TREE;
 }
 
 static const struct attribute_spec s390_attribute_table[] = {
-  { "hotpatch", 0, 1, true, false, false, s390_handle_hotpatch_attribute, false
+  { "hotpatch", 2, 2, true, false, false, s390_handle_hotpatch_attribute, false
   },
   /* End element.  */
   { NULL,        0, 0, false, false, false, NULL, false }
@@ -1664,29 +1663,44 @@ s390_option_override (void)
       {
        switch (opt->opt_index)
          {
-         case OPT_mhotpatch:
-           s390_hotpatch_trampoline_halfwords = (opt->value) ?
-             s390_hotpatch_trampoline_halfwords_default : -1;
-           break;
          case OPT_mhotpatch_:
            {
-             int val;
-
-             val = integral_argument (opt->arg);
-             if (val == -1)
+             int val1;
+             int val2;
+             char s[256];
+             char *t;
+
+             strncpy (s, opt->arg, 256);
+             s[255] = 0;
+             t = strchr (s, ',');
+             if (t != NULL)
+               {
+                 *t = 0;
+                 t++;
+                 val1 = integral_argument (s);
+                 val2 = integral_argument (t);
+               }
+             else
+               {
+                 val1 = -1;
+                 val2 = -1;
+               }
+             if (val1 == -1 || val2 == -1)
                {
                  /* argument is not a plain number */
-                 error ("argument to %qs should be a non-negative integer",
-                        "-mhotpatch=");
+                 error ("arguments to %qs should be non-negative integers",
+                        "-mhotpatch=n,m");
                  break;
                }
-             else if (val > s390_hotpatch_trampoline_halfwords_max)
+             else if (val1 > s390_hotpatch_hw_max
+                      || val2 > s390_hotpatch_hw_max)
                {
                  error ("argument to %qs is too large (max. %d)",
-                        "-mhotpatch=", s390_hotpatch_trampoline_halfwords_max);
+                        "-mhotpatch=n,m", s390_hotpatch_hw_max);
                  break;
                }
-             s390_hotpatch_trampoline_halfwords = val;
+             s390_hotpatch_hw_before_label = val1;
+             s390_hotpatch_hw_after_label = val2;
              break;
            }
          default:
@@ -5418,84 +5432,80 @@ get_some_local_dynamic_name (void)
   gcc_unreachable ();
 }
 
-/* Returns -1 if the function should not be made hotpatchable.  Otherwise it
-   returns a number >= 0 that is the desired size of the hotpatch trampoline
-   in halfwords. */
+/* Returns false if the function should not be made hotpatchable.
+   Otherwise it assigns the number of NOP halfwords to be emitted
+   before and after the function label to hw_before and hw_after.
+   Both must not be NULL.  */
 
-static int s390_function_num_hotpatch_trampoline_halfwords (tree decl,
-                                                           bool do_warn)
+static bool
+s390_function_num_hotpatch_hw (tree decl,
+                              int *hw_before,
+                              int *hw_after)
 {
   tree attr;
 
-  if (DECL_DECLARED_INLINE_P (decl)
-      || DECL_ARTIFICIAL (decl)
+  *hw_before = 0;
+  *hw_after = 0;
+
+  if (DECL_ARTIFICIAL (decl)
       || MAIN_NAME_P (DECL_NAME (decl)))
     {
-      /* - Explicitly inlined functions cannot be hotpatched.
-        - Artificial functions need not be hotpatched.
-        - Making the main function hotpatchable is useless. */
-      return -1;
+      /* - Artificial functions need not be hotpatched.
+        - Making the main function hotpatchable is useless.  */
+      return false;
     }
   attr = lookup_attribute ("hotpatch", DECL_ATTRIBUTES (decl));
-  if (attr || s390_hotpatch_trampoline_halfwords >= 0)
-    {
-      if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (decl)))
-       {
-         if (do_warn)
-           warning (OPT_Wattributes, "function %qE with the %qs attribute"
-                    " is not hotpatchable", DECL_NAME (decl), "always_inline");
-         return -1;
-       }
-      else
-       {
-         return (attr) ?
-           get_hotpatch_attribute (attr) : s390_hotpatch_trampoline_halfwords;
-       }
-    }
 
-  return -1;
-}
+  /* Handle the arguments of the hotpatch attribute.  The values
+     specified via attribute might override the cmdline argument
+     values.  */
+  if (attr)
+    {
+      tree args = TREE_VALUE (attr);
 
-/* Hook to determine if one function can safely inline another.  */
+      *hw_before = TREE_INT_CST_LOW (TREE_VALUE (args));
+      *hw_after = TREE_INT_CST_LOW (TREE_VALUE (TREE_CHAIN (args)));
+    }
+  else
+    {
+      /* Use the values specified by the cmdline arguments.  */
+      *hw_before = s390_hotpatch_hw_before_label;
+      *hw_after = s390_hotpatch_hw_after_label;
+    }
 
-static bool
-s390_can_inline_p (tree caller, tree callee)
-{
-  if (s390_function_num_hotpatch_trampoline_halfwords (callee, false) >= 0)
+  if (*hw_before == 0 && *hw_after == 0)
     return false;
 
-  return default_target_can_inline_p (caller, callee);
+  if (decl_function_context (decl) != NULL_TREE)
+    {
+      warning_at (DECL_SOURCE_LOCATION (decl), OPT_mhotpatch_,
+                 "hotpatching is not compatible with nested functions");
+      return false;
+    }
+
+  return true;
 }
 
+
 /* Write the extra assembler code needed to declare a function properly.  */
 
 void
 s390_asm_output_function_label (FILE *asm_out_file, const char *fname,
                                tree decl)
 {
-  int hotpatch_trampoline_halfwords = -1;
+  int hw_before, hw_after;
+  bool hotpatch_p = (decl
+                    ? s390_function_num_hotpatch_hw (decl,
+                                                     &hw_before, &hw_after)
+                    : false);
 
-  if (decl)
-    {
-      hotpatch_trampoline_halfwords =
-       s390_function_num_hotpatch_trampoline_halfwords (decl, true);
-      if (hotpatch_trampoline_halfwords >= 0
-         && decl_function_context (decl) != NULL_TREE)
-       {
-         warning_at (DECL_SOURCE_LOCATION (decl), OPT_mhotpatch,
-                     "hotpatching is not compatible with nested functions");
-         hotpatch_trampoline_halfwords = -1;
-       }
-    }
-
-  if (hotpatch_trampoline_halfwords > 0)
+  if (hotpatch_p)
     {
       int i;
-
       /* Add a trampoline code area before the function label and initialize it
         with two-byte nop instructions.  This area can be overwritten with code
         that jumps to a patched version of the function.  */
-      for (i = 0; i < hotpatch_trampoline_halfwords; i++)
+      for (i = 0; i < hw_before; i++)
        asm_fprintf (asm_out_file, "\tnopr\t%%r7\n");
       /* Note:  The function label must be aligned so that (a) the bytes of the
         following nop do not cross a cacheline boundary, and (b) a jump address
@@ -5507,11 +5517,32 @@ s390_asm_output_function_label (FILE *asm_out_file, const char *fname,
 
   ASM_OUTPUT_LABEL (asm_out_file, fname);
 
-  /* Output a four-byte nop if hotpatching is enabled.  This can be overwritten
-     atomically with a relative backwards jump to the trampoline area.  */
-  if (hotpatch_trampoline_halfwords >= 0)
-    asm_fprintf (asm_out_file, "\tnop\t0\n");
-}
+  /* Output a series of NOPs after the function label.  */
+  if (hotpatch_p)
+    {
+      while (hw_after > 0)
+       {
+         if (hw_after >= 3 && TARGET_CPU_ZARCH)
+           {
+             asm_fprintf (asm_out_file, "\tbrcl\t\t0,0\n");
+             hw_after -= 3;
+           }
+         else if (hw_after >= 2)
+           {
+             gcc_assert (hw_after == 2 || !TARGET_CPU_ZARCH);
+             asm_fprintf (asm_out_file, "\tnop\t0\n");
+             hw_after -= 2;
+           }
+         else
+           {
+             gcc_assert (hw_after == 1);
+             asm_fprintf (asm_out_file, "\tnopr\t%%r7\n");
+             hw_after -= 1;
+           }
+       }
+    }
+}          
+      
 
 /* Output machine-dependent UNSPECs occurring in address constant X
    in assembler syntax to stdio stream FILE.  Returns true if the
@@ -11817,8 +11848,8 @@ s390_loop_unroll_adjust (unsigned nunroll, struct loop *loop)
 #undef TARGET_ATTRIBUTE_TABLE
 #define TARGET_ATTRIBUTE_TABLE s390_attribute_table
 
-#undef TARGET_CAN_INLINE_P
-#define TARGET_CAN_INLINE_P s390_can_inline_p
+#undef TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P
+#define TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P hook_bool_const_tree_true
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
index 65d17c3342eaafbd2e0ca1f05722e19f9af6f87d..615e4dde206aec77c674458dc4fb2f88eea36186 100644 (file)
@@ -96,13 +96,15 @@ mhard-float
 Target Report RejectNegative Negative(msoft-float) InverseMask(SOFT_FLOAT, HARD_FLOAT)
 Enable hardware floating point
 
-mhotpatch
-Target Report Var(s390_deferred_options) Defer
-Prepend the function label with 12 two-byte Nop instructions, and add a four byte Nop instruction after the label for hotpatching.
-
 mhotpatch=
 Target RejectNegative Report Joined Var(s390_deferred_options) Defer
-Prepend the function label with the given number of two-byte Nop instructions, and add a four byte Nop instruction after the label for hotpatching.
+Takes two non-negative integer numbers separated by a comma.
+Prepend the function label with the number of two-byte Nop
+instructions indicated by the first.  Append Nop instructions
+covering the number of halfwords indicated by the second after the
+label.  Nop instructions of the largest possible size are used
+(six, four or two bytes), beginning with the largest possible
+size.  Using 0 for both values disables hotpatching.
 
 mlong-double-128
 Target Report RejectNegative Negative(mlong-double-64) Mask(LONG_DOUBLE_128)
index 3d794db837f09e5df40ae0c427254cc26064c76f..2478bb1f3240091e60d775a7e1747a05b658f1cf 100644 (file)
@@ -3123,16 +3123,19 @@ this function attribute to make GCC generate the ``hot-patching'' function
 prologue used in Win32 API functions in Microsoft Windows XP Service Pack 2
 and newer.
 
-@item hotpatch [(@var{prologue-halfwords})]
+@item hotpatch (@var{halfwords-before-function-label},@var{halfwords-after-function-label})
 @cindex @code{hotpatch} attribute
 
 On S/390 System z targets, you can use this function attribute to
-make GCC generate a ``hot-patching'' function prologue.  The
-@code{hotpatch} has no effect on funtions that are explicitly
-inline.  If the @option{-mhotpatch} or @option{-mno-hotpatch}
-command-line option is used at the same time, the @code{hotpatch}
-attribute takes precedence.  If an argument is given, the maximum
-allowed value is 1000000.
+make GCC generate a ``hot-patching'' function prologue.  If the
+@option{-mhotpatch=} command-line option is used at the same time,
+the @code{hotpatch} attribute takes precedence.  The first of the
+two arguments specifies the number of halfwords to be added before
+the function label.  A second argument can be used to specify the
+number of halfwords to be added after the function label.  For
+both arguments the maximum allowed value is 1000000.
+
+If both ar guments are zero, hotpatching is disabled.
 
 @item naked
 @cindex function without a prologue/epilogue code
index 0b0f0701c9a24aed860ab5f8564f9499f2238ec0..b56338409b35df1e85825e349359b2a146b1ed55 100644 (file)
@@ -886,7 +886,7 @@ See RS/6000 and PowerPC Options.
 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
 -mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size -mstack-guard @gol
--mhotpatch[=@var{halfwords}] -mno-hotpatch}
+-mhotpatch=@var{halfwords},@var{halfwords}}
 
 @emph{Score Options}
 @gccoptlist{-meb -mel @gol
@@ -18594,17 +18594,17 @@ In order to be efficient the extra code makes the assumption that the stack star
 at an address aligned to the value given by @var{stack-size}.
 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
 
-@item -mhotpatch[=@var{halfwords}]
-@itemx -mno-hotpatch
+@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
 @opindex mhotpatch
 If the hotpatch option is enabled, a ``hot-patching'' function
 prologue is generated for all functions in the compilation unit.
 The funtion label is prepended with the given number of two-byte
-Nop instructions (@var{halfwords}, maximum 1000000) or 12 Nop
-instructions if no argument is present.  Functions with a
-hot-patching prologue are never inlined automatically, and a
-hot-patching prologue is never generated for functions functions
-that are explicitly inline.
+Nop instructions (@var{pre-halfwords}, maximum 1000000).  After
+the label, 2 * @var{post-halfwords} bytes are appended, using the
+larges nop like instructions the architecture allows (maximum
+1000000).
+
+If both arguments are zero, hotpatching is disabled.
 
 This option can be overridden for individual functions with the
 @code{hotpatch} attribute.
index b9d6139b080a99ba24894f85b6409ddc64ff37d6..e7e90585ebb58966f5c03cb384ffa2b0d9813546 100644 (file)
@@ -1,7 +1,7 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch --save-temps" } */
 
 #include <stdio.h>
 
@@ -10,11 +10,7 @@ void hp1(void)
   printf("hello, world!\n");
 }
 
-int main (void)
-{
-  return 0;
-}
-
 /* Check number of occurences of certain instructions.  */
-/* { dg-final { scan-assembler-times "nopr\t%r7" 12 } } */
-/* { dg-final { scan-assembler-times "nop\t0" 1 } } */
+/* { dg-final { scan-assembler-not "nopr\t%r7" } } */
+/* { dg-final { scan-assembler-not "nop\t0" } } */
+/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */
index b91b3478ee312f0bd6fdc8b19aec43f0f149f611..78afb8cc4069254214861a290e78cfdef0062a9b 100644 (file)
@@ -1,21 +1,16 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mno-hotpatch --save-temps" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=0,0 --save-temps" } */
 
 #include <stdio.h>
 
-__attribute__ ((hotpatch(2)))
 void hp1(void)
 {
   printf("hello, world!\n");
 }
 
-int main (void)
-{
-  return 0;
-}
-
 /* Check number of occurences of certain instructions.  */
-/* { dg-final { scan-assembler-times "nopr\t%r7" 2 } } */
-/* { dg-final { scan-assembler-times "nop\t0" 1 } } */
+/* { dg-final { scan-assembler-not "nopr\t%r7" } } */
+/* { dg-final { scan-assembler-not "nop\t0" } } */
+/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */
index 491677342530e7f4f7ce3316a46433ef576164ad..d4c577e65af3eb7e32bce8452c776f8922a4210e 100644 (file)
@@ -1,7 +1,7 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mhotpatch -mno-hotpatch --save-temps" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=1,0 --save-temps" } */
 
 #include <stdio.h>
 
@@ -10,11 +10,7 @@ void hp1(void)
   printf("hello, world!\n");
 }
 
-int main (void)
-{
-  return 0;
-}
-
 /* Check number of occurences of certain instructions.  */
-/* { dg-final { scan-assembler-not "nopr\t%r7" } } */
+/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */
 /* { dg-final { scan-assembler-not "nop\t0" } } */
+/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */
index b3e9427d4e2734f3cc943330f607bd7d595238ba..cc32e7c3f71845431e035621ddc81bc70a739fe8 100644 (file)
@@ -1,7 +1,7 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mno-hotpatch -mhotpatch=1 --save-temps" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=999,0 --save-temps" } */
 
 #include <stdio.h>
 
@@ -10,11 +10,7 @@ void hp1(void)
   printf("hello, world!\n");
 }
 
-int main (void)
-{
-  return 0;
-}
-
 /* Check number of occurences of certain instructions.  */
-/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */
-/* { dg-final { scan-assembler-times "nop\t0" 1 } } */
+/* { dg-final { scan-assembler-times "nopr\t%r7" 999 } } */
+/* { dg-final { scan-assembler-not "nop\t0" } } */
+/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */
index 6cc29447de4a52f736d44693edfb6a32525d432d..af8f59243efcd748fed5c39660ebdb5e02e62794 100644 (file)
@@ -1,7 +1,7 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mhotpatch=1 --save-temps" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=0,1 --save-temps" } */
 
 #include <stdio.h>
 
@@ -10,11 +10,7 @@ void hp1(void)
   printf("hello, world!\n");
 }
 
-int main (void)
-{
-  return 0;
-}
-
 /* Check number of occurences of certain instructions.  */
 /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */
-/* { dg-final { scan-assembler-times "nop\t0" 1 } } */
+/* { dg-final { scan-assembler-not "nop\t0" } } */
+/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */
index 9f0b2b756a41242bc26d688f8cb3aee198bce28d..4138d63268404b918e2bfbe5dbde0ebe8dc875fe 100644 (file)
@@ -1,7 +1,7 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mhotpatch=0 --save-temps" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=0,2 --save-temps" } */
 
 #include <stdio.h>
 
@@ -10,11 +10,7 @@ void hp1(void)
   printf("hello, world!\n");
 }
 
-int main (void)
-{
-  return 0;
-}
-
 /* Check number of occurences of certain instructions.  */
 /* { dg-final { scan-assembler-not "nopr\t%r7" } } */
 /* { dg-final { scan-assembler-times "nop\t0" 1 } } */
+/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */
index c1dba20a37925645854f1f8a278551bc346f9f3e..afe1ad67383fea5ee21489891df0ce05eb2f3e21 100644 (file)
@@ -1,26 +1,16 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=0,3 --save-temps" } */
 
 #include <stdio.h>
 
-inline void hp1(void)
+void hp1(void)
 {
   printf("hello, world!\n");
 }
 
-__attribute__ ((always_inline))
-void hp2(void) /* { dg-warning "always_inline function might not be inlinable" } */
-{
-  printf("hello, world!\n");
-} /* { dg-warning "function 'hp2' with the 'always_inline' attribute is not hotpatchable" } */
-
-int main (void)
-{
-  return 0;
-}
-
 /* Check number of occurences of certain instructions.  */
 /* { dg-final { scan-assembler-not "nopr\t%r7" } } */
 /* { dg-final { scan-assembler-not "nop\t0" } } */
+/* { dg-final { scan-assembler-times "brcl\t\t0,0" 1 } } */
index ec267d65aaeb9b94823126030d14678f1d54a3d3..ea3e29ee7950e4bcc6dbaedf32d3e8c9e595078f 100644 (file)
@@ -1,21 +1,16 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=0,4 --save-temps" } */
 
 #include <stdio.h>
 
-__attribute__ ((hotpatch))
 void hp1(void)
 {
   printf("hello, world!\n");
 }
 
-int main (void)
-{
-  return 0;
-}
-
 /* Check number of occurences of certain instructions.  */
-/* { dg-final { scan-assembler-times "nopr\t%r7" 12 } } */
-/* { dg-final { scan-assembler-times "nop\t0" 1 } } */
+/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */
+/* { dg-final { scan-assembler-not "nop\t0" } } */
+/* { dg-final { scan-assembler-times "brcl\t\t0,0" 1 } } */
index 5af090d03a66a7eb900726dd5488dd777b0f47ce..e91a2a6ad03eeb7754ae0c1d33f8f56cdd0c40a7 100644 (file)
@@ -1,21 +1,16 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=0,5 --save-temps" } */
 
 #include <stdio.h>
 
-__attribute__ ((hotpatch(1)))
 void hp1(void)
 {
   printf("hello, world!\n");
 }
 
-int main (void)
-{
-  return 0;
-}
-
 /* Check number of occurences of certain instructions.  */
-/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */
+/* { dg-final { scan-assembler-not "nopr\t%r7" } } */
 /* { dg-final { scan-assembler-times "nop\t0" 1 } } */
+/* { dg-final { scan-assembler-times "brcl\t\t0,0" 1 } } */
index e73a510b4d6bd37d6fec7fc8607e4fd1398e7ff9..fe4b069e58254434cbf9bed440df7db72078f677 100644 (file)
@@ -1,21 +1,16 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=0,6 --save-temps" } */
 
 #include <stdio.h>
 
-__attribute__ ((hotpatch(0)))
 void hp1(void)
 {
   printf("hello, world!\n");
 }
 
-int main (void)
-{
-  return 0;
-}
-
 /* Check number of occurences of certain instructions.  */
 /* { dg-final { scan-assembler-not "nopr\t%r7" } } */
-/* { dg-final { scan-assembler-times "nop\t0" 1 } } */
+/* { dg-final { scan-assembler-not "nop\t0" } } */
+/* { dg-final { scan-assembler-times "brcl\t\t0,0" 2 } } */
index 399aa7260b4fe3fed3319983aecec939ae56cd8d..8edcfccb62f780f9e16b85ba1dc2cae08fcd05c2 100644 (file)
@@ -1,28 +1,16 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mesa -m31 -mhotpatch=0,3 --save-temps" } */
 
 #include <stdio.h>
 
-__attribute__ ((hotpatch))
-inline void hp1(void)
+void hp1(void)
 {
   printf("hello, world!\n");
 }
 
-__attribute__ ((hotpatch))
-__attribute__ ((always_inline))
-void hp2(void) /* { dg-warning "always_inline function might not be inlinable" } */
-{
-  printf("hello, world!\n");
-} /* { dg-warning "function 'hp2' with the 'always_inline' attribute is not hotpatchable" } */
-
-int main (void)
-{
-  return 0;
-}
-
 /* Check number of occurences of certain instructions.  */
-/* { dg-final { scan-assembler-not "nopr\t%r7" } } */
-/* { dg-final { scan-assembler-not "nop\t0" } } */
+/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */
+/* { dg-final { scan-assembler-times "nop\t0" 1 } } */
+/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */
index 5da675866b32657af2959c1e1f8fafeb6b7c6008..25b377180d63f09a69ad057d458f4337e0f67f4f 100644 (file)
@@ -1,21 +1,16 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mhotpatch=1 --save-temps" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mesa -m31 -mhotpatch=0,4 --save-temps" } */
 
 #include <stdio.h>
 
-__attribute__ ((hotpatch(2)))
 void hp1(void)
 {
   printf("hello, world!\n");
 }
 
-int main (void)
-{
-  return 0;
-}
-
 /* Check number of occurences of certain instructions.  */
-/* { dg-final { scan-assembler-times "nopr\t%r7" 2 } } */
-/* { dg-final { scan-assembler-times "nop\t0" 1 } } */
+/* { dg-final { scan-assembler-not "nopr\t%r7" } } */
+/* { dg-final { scan-assembler-times "nop\t0" 2 } } */
+/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */
index 45a2cc5dc20660a52553864442f6c6d26b8c7f0f..d88e07eb2d6a6fc17ba045a3961db32e4e4a3db6 100644 (file)
@@ -1,27 +1,11 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mhotpatch" } */
-
-#include <stdio.h>
-
-void hp1(void)
-{
-  printf("hello, world!\n");
-}
-
-inline void hp2(void)
-{
-  printf("hello, world!\n");
-}
-
-__attribute__ ((always_inline))
-void hp3(void) /* { dg-warning "always_inline function might not be inlinable" } */
-{
-  printf("hello, world!\n");
-} /* { dg-warning "function 'hp3' with the 'always_inline' attribute is not hotpatchable" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=-1,0" } */
 
 int main (void)
 {
   return 0;
 }
+
+/* { dg-excess-errors "argument to '-mhotpatch=' should be a non-negative integer" } */
index 5947f564f53009b0881ecad2a266926c7de68c9e..95820e493fcfc447a68ddfa5c1ebbfae14754531 100644 (file)
@@ -1,27 +1,11 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mhotpatch=0" } */
-
-#include <stdio.h>
-
-void hp1(void)
-{
-  printf("hello, world!\n");
-}
-
-inline void hp2(void)
-{
-  printf("hello, world!\n");
-}
-
-__attribute__ ((always_inline))
-void hp3(void) /* { dg-warning "always_inline function might not be inlinable" } */
-{
-  printf("hello, world!\n");
-} /* { dg-warning "function 'hp3' with the 'always_inline' attribute is not hotpatchable" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=0,-1" } */
 
 int main (void)
 {
   return 0;
 }
+
+/* { dg-excess-errors "argument to '-mhotpatch=' should be a non-negative integer" } */
index e0c7f6f52c193a1b0e3931f686180354027c3105..bbed9759fbd908878a55ed9898895d5b2f7d3dcd 100644 (file)
@@ -1,27 +1,11 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mhotpatch=1" } */
-
-#include <stdio.h>
-
-void hp1(void)
-{
-  printf("hello, world!\n");
-}
-
-inline void hp2(void)
-{
-  printf("hello, world!\n");
-}
-
-__attribute__ ((always_inline))
-void hp3(void) /* { dg-warning "always_inline function might not be inlinable" } */
-{
-  printf("hello, world!\n");
-} /* { dg-warning "function 'hp3' with the 'always_inline' attribute is not hotpatchable" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=0" } */
 
 int main (void)
 {
   return 0;
 }
+
+/* { dg-excess-errors "argument to '-mhotpatch=' should be a non-negative integer" } */
index d9f13425adc249ece9ad6c90238cb60905bebd5f..4d926594a5cca04dc431626ed7d0a4ea140539ec 100644 (file)
@@ -1,7 +1,7 @@
 /* Functional tests for the function hotpatching feature.  */
 
 /* { dg-do compile } */
-/* { dg-options "-O3 -mzarch -mhotpatch=-1" } */
+/* { dg-options "-O3 -mzarch -mhotpatch=0,0,0" } */
 
 int main (void)
 {
index 53f7eac9e5405f213fa1946f36e99c2dcdda4f45..46c9004d3e8a27851f2da5c40026961ec8203997 100644 (file)
@@ -1,28 +1,11 @@
 /* Functional tests for the function hotpatching feature.  */
 
 /* { dg-do compile } */
-/* { dg-options "-O3 -mzarch -mhotpatch=1000000" } */
-
-#include <stdio.h>
-
-void hp1(void)
-{
-  printf("hello, world!\n");
-}
-
-__attribute__ ((hotpatch(1000000)))
-void hp2(void)
-{
-  printf("hello, world!\n");
-}
-
-__attribute__ ((hotpatch(1000001)))
-void hp3(void)
-{ /* { dg-error "requested 'hotpatch' attribute is not a non-negative integer constant or too large .max. 1000000." } */
-  printf("hello, world!\n");
-}
+/* { dg-options "-O3 -mzarch -mhotpatch=a,0" } */
 
 int main (void)
 {
   return 0;
 }
+
+/* { dg-excess-errors "argument to '-mhotpatch=' should be a non-negative integer" } */
index cb10b66f0d3c6fd7acd32f97019d2453a390a530..b28e205512221a19238e39d9b4dfa15f2b8a74be 100644 (file)
@@ -1,11 +1,11 @@
 /* Functional tests for the function hotpatching feature.  */
 
 /* { dg-do compile } */
-/* { dg-options "-O3 -mzarch -mhotpatch=1000001" } */
+/* { dg-options "-O3 -mzarch -mhotpatch=0,a" } */
 
 int main (void)
 {
   return 0;
 }
 
-/* { dg-excess-errors "argument to '-mhotpatch=' is too large .max. 1000000." } */
+/* { dg-excess-errors "argument to '-mhotpatch=' should be a non-negative integer" } */
index 98ccb42c003d883a621a7f23959158456f72cc3b..2080eb1f94ac9852cc043b0265fa0aced4d973d2 100644 (file)
@@ -1,68 +1,12 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mno-hotpatch" } */
-
-#include <stdio.h>
-
-__attribute__ ((hotpatch))
-void hp1(void)
-{
-  printf("hello, world!\n");
-}
-
-__attribute__ ((hotpatch))
-inline void hp2(void)
-{
-  printf("hello, world!\n");
-}
-
-__attribute__ ((hotpatch))
-__attribute__ ((always_inline))
-void hp3(void) /* { dg-warning "always_inline function might not be inlinable" } */
-{
-  printf("hello, world!\n");
-} /* { dg-warning "function 'hp3' with the 'always_inline' attribute is not hotpatchable" } */
-
-__attribute__ ((hotpatch(0)))
-void hp4(void)
-{
-  printf("hello, world!\n");
-}
-
-__attribute__ ((hotpatch(0)))
-inline void hp5(void)
-{
-  printf("hello, world!\n");
-}
-
-__attribute__ ((hotpatch(0)))
-__attribute__ ((always_inline))
-void hp6(void) /* { dg-warning "always_inline function might not be inlinable" } */
-{
-  printf("hello, world!\n");
-} /* { dg-warning "function 'hp6' with the 'always_inline' attribute is not hotpatchable" } */
-
-__attribute__ ((hotpatch(1)))
-void hp7(void)
-{
-  printf("hello, world!\n");
-}
-
-__attribute__ ((hotpatch(1)))
-inline void hp8(void)
-{
-  printf("hello, world!\n");
-}
-
-__attribute__ ((hotpatch(1)))
-__attribute__ ((always_inline))
-void hp9(void) /* { dg-warning "always_inline function might not be inlinable" } */
-{
-  printf("hello, world!\n");
-} /* { dg-warning "function 'hp9' with the 'always_inline' attribute is not hotpatchable" } */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch" } */
 
+__attribute__((hotpatch(-1,0)))
 int main (void)
 {
   return 0;
 }
+
+/* { dg-excess-errors "argument to '-mhotpatch=' should be a non-negative integer" } */
index 489fc5dd9f0bd8bfe1a1f353585b1eb30def7cd8..46a38c860c262ebe0386b94a9ab4e83446be1036 100644 (file)
@@ -1,23 +1,12 @@
 /* Functional tests for the function hotpatching feature.  */
 
-/* { dg-do run } */
-/* { dg-options "-O3 -mzarch -mhotpatch" } */
-
-#include <stdio.h>
-
-int hp1(void)
-{
-  int nested1(void) /* { dg-warning "hotpatching is not compatible with nested functions" } */
-  { return 1; }
-
-  __attribute__ ((hotpatch))
-  int nested2(void) /* { dg-warning "hotpatching is not compatible with nested functions" } */
-  { return 1; }
-
-  return nested1() - nested2();
-}
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch" } */
 
+__attribute__((hotpatch(0,-1)))
 int main (void)
 {
-  return hp1();
+  return 0;
 }
+
+/* { dg-excess-errors "argument to '-mhotpatch=' should be a non-negative integer" } */