[PATCH 2/2] Add test cases for noreorder

Andi Kleen andi@firstfloor.org
Sun Sep 14 17:52:00 GMT 2014


From: Andi Kleen <ak@linux.intel.com>

Add some simple test cases for noreorder behaving like
-fno-toplevel-reorder and -fno-toplevel-reorder still working.
Unfortunately there's no easy way to check for output order in DG,
so we just check for existence.

gcc/testsuite/:

2014-09-14  Andi Kleen  <ak@linux.intel.com>

	* gcc.dg/noreorder.c: New test.
	* gcc.dg/noreorder2.c: New test.
	* gcc.dg/noreorder3.c: New test.
---
 gcc/testsuite/gcc.dg/noreorder.c  | 24 ++++++++++++++++++++++++
 gcc/testsuite/gcc.dg/noreorder2.c | 11 +++++++++++
 gcc/testsuite/gcc.dg/noreorder3.c | 10 ++++++++++
 3 files changed, 45 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/noreorder.c
 create mode 100644 gcc/testsuite/gcc.dg/noreorder2.c
 create mode 100644 gcc/testsuite/gcc.dg/noreorder3.c

diff --git a/gcc/testsuite/gcc.dg/noreorder.c b/gcc/testsuite/gcc.dg/noreorder.c
new file mode 100644
index 0000000..1559465
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noreorder.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern void f2(int);
+
+__attribute__((no_reorder, noinline)) static int foobar(void)
+{
+	f2(1);
+}
+
+static int barbar(void)
+{
+	f2(2);
+}
+
+int bozo(void)
+{
+	f2(3);
+	foobar();
+}
+
+/* { dg-final { scan-assembler "foobar" } } */
+/* { dg-final { scan-assembler "bozo" } } */
+/* { dg-final { scan-assembler-not "barbar" } } */
diff --git a/gcc/testsuite/gcc.dg/noreorder2.c b/gcc/testsuite/gcc.dg/noreorder2.c
new file mode 100644
index 0000000..558361b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noreorder2.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-toplevel-reorder" } */
+
+__attribute__((no_reorder)) int foobar;
+
+static int barbar;
+int bozo;
+
+/* { dg-final { scan-assembler "foobar" } } */
+/* { dg-final { scan-assembler "bozo" } } */
+/* { dg-final { scan-assembler "barbar" } } */
diff --git a/gcc/testsuite/gcc.dg/noreorder3.c b/gcc/testsuite/gcc.dg/noreorder3.c
new file mode 100644
index 0000000..a0b637f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noreorder3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+__attribute__((no_reorder)) int foobar;
+static int barbar;
+int bozo;
+
+/* { dg-final { scan-assembler "foobar" } } */
+/* { dg-final { scan-assembler "bozo" } } */
+/* { dg-final { scan-assembler-not "barbar" } } */
-- 
2.1.0



More information about the Gcc-patches mailing list