This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add additional __builtin_unreachable() test.


Paolo requested this additional test for the new __builtin_unreachable() built-in.

Tested on x86_64-pc-linux-gnu.

OK to commit?

2009-06-16 David Daney <ddaney@caviumnetworks.com>

* gcc.target/i386/builtin-unreachable.c: New test.
Index: gcc/testsuite/gcc.target/i386/builtin-unreachable.c
===================================================================
--- gcc/testsuite/gcc.target/i386/builtin-unreachable.c	(revision 0)
+++ gcc/testsuite/gcc.target/i386/builtin-unreachable.c	(revision 0)
@@ -0,0 +1,12 @@
+/* This should return 1 without setting up a stack frame or
+   jumping.  */
+/* { dg-do compile } */
+/* { dg-options "-O2 -m32 -fomit-frame-pointer" } */
+int h (char *p)
+{
+  if (*p)
+    __builtin_unreachable ();
+  return p ? 1 : 0;
+}
+/* { dg-final { scan-assembler-not "%e\[bs\]p" } } */
+/* { dg-final { scan-assembler-not "\[\\t \]+j" } } */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]