+2015-02-24 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ Add testcases missing from hotpatch v2
+ * gcc/testsuite/gcc.target/s390/hotpatch-13.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-15.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-17.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-19.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-11.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-13.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-15.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-20.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-9.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-14.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-16.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-18.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-10.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-12.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-14.c
+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-16.c
+
+ Backport from mainline
+ 2015-02-23 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * gcc.target/s390/hotpatch-8.c: Add -march=g5.
+ * gcc.target/s390/hotpatch-9.c: Add -march=g5.
+ * gcc.target/s390/hotpatch-compile-1.c: Fix error message.
+ * gcc.target/s390/hotpatch-compile-10.c: Likewise.
+ * gcc.target/s390/hotpatch-compile-11.c: Likewise.
+ * gcc.target/s390/hotpatch-compile-12.c: Likewise.
+ * gcc.target/s390/hotpatch-compile-13.c: Likewise.
+ * gcc.target/s390/hotpatch-compile-14.c: Likewise.
+ * gcc.target/s390/hotpatch-compile-2.c: Likewise.
+ * gcc.target/s390/hotpatch-compile-3.c: Likewise.
+ * gcc.target/s390/hotpatch-compile-4.c: Likewise.
+ * gcc.target/s390/hotpatch-compile-5.c: Likewise.
+ * gcc.target/s390/hotpatch-compile-6.c: Likewise.
+ * gcc.target/s390/hotpatch-compile-7.c: Likewise.
+ * gcc.target/s390/hotpatch-compile-8.c: Likewise.
+ * gcc.target/s390/hotpatch-compile-9.c: Likewise.
+
2015-02-23 Oleg Endo <olegendo@gcc.gnu.org>
Backport from mainline
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch --save-temps" } */
+
+#include <stdio.h>
+
+__attribute__ ((hotpatch(1,0)))
+void hp1(void)
+{
+ printf("hello, world!\n");
+}
+
+/* Check number of occurences of certain instructions. */
+/* { 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" } } */
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch --save-temps" } */
+
+#include <stdio.h>
+
+__attribute__ ((hotpatch(0,2)))
+void hp1(void)
+{
+ printf("hello, world!\n");
+}
+
+/* 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" } } */
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch --save-temps" } */
+
+#include <stdio.h>
+
+__attribute__ ((hotpatch(1,2)))
+void hp1(void)
+{
+ printf("hello, world!\n");
+}
+
+/* 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 "brcl\t\t0,0" } } */
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=0,0 --save-temps" } */
+
+#include <stdio.h>
+
+__attribute__ ((hotpatch(1,2)))
+void hp1(void)
+{
+ printf("hello, world!\n");
+}
+
+/* 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 "brcl\t\t0,0" } } */
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=1,2 --save-temps" } */
+
+#include <stdio.h>
+
+__attribute__ ((hotpatch(0,0)))
+void hp1(void)
+{
+ printf("hello, world!\n");
+}
+
+/* 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-not "brcl\t\t0,0" } } */
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=1,2 -mhotpatch=0,0 --save-temps" } */
+
+#include <stdio.h>
+
+void hp1(void)
+{
+ printf("hello, world!\n");
+}
+
+/* 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-not "brcl\t\t0,0" } } */
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=1,2 --save-temps" } */
+
+#include <stdio.h>
+
+/* { dg-prune-output "always_inline function might not be inlinable" } */
+__attribute__ ((always_inline))
+static void hp2(void)
+{
+ printf("hello, world!\n");
+}
+
+void hp1(void)
+{
+ hp2();
+}
+
+/* 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 "brcl\t\t0,0" } } */
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch --save-temps" } */
+
+#include <stdio.h>
+
+/* { dg-prune-output "always_inline function might not be inlinable" } */
+__attribute__ ((hotpatch(1,2)))
+__attribute__ ((always_inline))
+static void hp2(void)
+{
+ printf("hello, world!\n");
+}
+
+/* { dg-prune-output "called from here" } */
+void hp1(void)
+{
+ hp2();
+}
/* Functional tests for the function hotpatching feature. */
/* { dg-do compile } */
-/* { dg-options "-O3 -mesa -m31 -mhotpatch=0,3 --save-temps" } */
+/* { dg-options "-O3 -mesa -m31 -march=g5 -mhotpatch=0,3 --save-temps" } */
#include <stdio.h>
/* Functional tests for the function hotpatching feature. */
/* { dg-do compile } */
-/* { dg-options "-O3 -mesa -m31 -mhotpatch=0,4 --save-temps" } */
+/* { dg-options "-O3 -mesa -m31 -march=g5 -mhotpatch=0,4 --save-temps" } */
#include <stdio.h>
/* { 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" } */
+/* { dg-error "arguments to .-mhotpatch=n,m. should be non-negative integers" "" { target *-*-* } 1 } */
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch" } */
+
+__attribute__((hotpatch(0,0,0)))
+int main (void)
+{/* { dg-error "wrong number of arguments specified" } */
+ return 0;
+}
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch" } */
+
+int a;
+
+__attribute__((hotpatch(a,0)))
+int main (void)
+{ /* { dg-error "attribute is not a comma separated pair of non-negative integer constants or too large" } */
+ return 0;
+}
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch" } */
+
+int a;
+
+__attribute__((hotpatch(0,a)))
+int main (void)
+{ /* { dg-error "attribute is not a comma separated pair of non-negative integer constants or too large" } */
+ return 0;
+}
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=1000000,1000000" } */
+
+#include <stdio.h>
+
+void hp1(void)
+{
+ printf("hello, world!\n");
+}
+
+__attribute__ ((hotpatch(1000000,1000000)))
+void hp2(void)
+{
+ printf("hello, world!\n");
+}
+
+__attribute__ ((hotpatch(1000001,1000000)))
+void hp3(void)
+{ /* { dg-error " requested .hotpatch. attribute is not a comma separated pair" } */
+ printf("hello, world!\n");
+}
+
+__attribute__ ((hotpatch(1000000,1000001)))
+void hp4(void)
+{ /* { dg-error " requested .hotpatch. attribute is not a comma separated pair" } */
+ printf("hello, world!\n");
+}
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -mhotpatch=1000001,1000000" } */
+
+viod main(void)
+{
+ return 0;
+}
+
+/* { dg-error "argument to .-mhotpatch=n,m. is too large" "" { target *-*-* } 1 } */
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch" } */
+
+/* { dg-prune-output "always_inline function might not be inlinable" } */
+/* { dg-prune-output "called from here" } */
+
+#include <stdio.h>
+
+__attribute__ ((hotpatch(1,2)))
+static void hp1(void)
+{
+ printf("hello, world!\n");
+}
+
+__attribute__ ((hotpatch(1,2)))
+static inline void hp2(void)
+{
+ printf("hello, world!\n");
+}
+
+__attribute__ ((hotpatch(0,0)))
+__attribute__ ((always_inline))
+static void hp3(void)
+{
+ printf("hello, world!\n");
+}
+
+__attribute__ ((hotpatch(1,2)))
+__attribute__ ((always_inline))
+static void hp4(void)
+{
+ printf("hello, world!\n");
+}
+
+void main(void)
+{
+ hp1();
+ hp2();
+ hp3();
+ hp4();
+}
--- /dev/null
+/* A warning will be issued when requesting hotpatching on a nested function. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch" } */
+
+#include <stdio.h>
+
+typedef int (*fn_t)(void);
+
+fn_t hp1(void)
+{
+ __attribute__((hotpatch(0,0)))
+ int nested1(void)
+ { return 1; }
+
+ return nested1;
+}
+
+fn_t hp2(void)
+{
+ __attribute__ ((hotpatch(1,2)))
+ int nested2(void) /* { dg-warning "hotpatching is not compatible with nested functions" } */
+ { return 2; }
+
+ return nested2;
+}
/* { 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" } */
+/* { dg-error "arguments to .-mhotpatch=n,m. should be non-negative integers" "" { target *-*-* } 1 } */
/* { 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" } */
+/* { dg-error "arguments to .-mhotpatch=n,m. should be non-negative integers" "" { target *-*-* } 1 } */
/* { dg-do compile } */
/* { dg-options "-O3 -mzarch -mhotpatch=0,0,0" } */
-
-int main (void)
-{
- return 0;
-}
-
-/* { dg-excess-errors "argument to '-mhotpatch=' should be a non-negative integer" } */
+/* { dg-error "arguments to .-mhotpatch=n,m. should be non-negative integers" "" { target *-*-* } 1 } */
/* { dg-do compile } */
/* { dg-options "-O3 -mzarch -mhotpatch=a,0" } */
-
-int main (void)
-{
- return 0;
-}
-
-/* { dg-excess-errors "argument to '-mhotpatch=' should be a non-negative integer" } */
+/* { dg-error "arguments to .-mhotpatch=n,m. should be non-negative integers" "" { target *-*-* } 1 } */
/* { dg-do compile } */
/* { dg-options "-O3 -mzarch -mhotpatch=0,a" } */
-
-int main (void)
-{
- return 0;
-}
-
-/* { dg-excess-errors "argument to '-mhotpatch=' should be a non-negative integer" } */
+/* { dg-error "arguments to .-mhotpatch=n,m. should be non-negative integers" "" { target *-*-* } 1 } */
__attribute__((hotpatch(-1,0)))
int main (void)
-{
+{/* { dg-error "attribute is not a comma separated pair of non-negative integer constants or too large" } */
return 0;
}
-
-/* { dg-excess-errors "argument to '-mhotpatch=' should be a non-negative integer" } */
__attribute__((hotpatch(0,-1)))
int main (void)
-{
+{/* { dg-error "attribute is not a comma separated pair of non-negative integer constants or too large" } */
return 0;
}
-
-/* { dg-excess-errors "argument to '-mhotpatch=' should be a non-negative integer" } */
--- /dev/null
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch" } */
+
+__attribute__((hotpatch(0)))
+int main (void)
+{/* { dg-error "wrong number of arguments specified" } */
+ return 0;
+}