This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Add additional __builtin_unreachable() test.
- From: David Daney <ddaney at caviumnetworks dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Paolo Bonzini <paolo dot bonzini at gmail dot com>
- Date: Tue, 16 Jun 2009 10:42:29 -0700
- Subject: [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" } } */