re PR middle-end/51867 (GCC generates inconsistent code for same sources calling...
authorBin Cheng <bin.cheng@arm.com>
Thu, 9 Feb 2012 09:37:37 +0000 (09:37 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Thu, 9 Feb 2012 09:37:37 +0000 (09:37 +0000)
PR target/51867
* builtins.c (expand_builtin): Don't check DECL_ASSEMBLER_NAME_SET_P.

PR target/51867
* testsuite/c-c++-common/dfp/signbit-2.c: Change '-O0' to '-O1'.
* testsuite/gcc.dg/pr51867.c: New test.

From-SVN: r184037

gcc/ChangeLog
gcc/builtins.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/dfp/signbit-2.c
gcc/testsuite/gcc.dg/pr51867.c [new file with mode: 0644]

index e44e4b8..05837c6 100644 (file)
@@ -1,3 +1,8 @@
+2012-02-09  Bin Cheng  <bin.cheng@arm.com>
+
+       PR middle-end/51867
+       * builtins.c (expand_builtin): Don't check DECL_ASSEMBLER_NAME_SET_P.
+
 2012-02-08  Magnus Granberg  <zorry@gentoo.org>
 
        PR driver/48524
index 74be552..cf49561 100644 (file)
@@ -5776,7 +5776,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
      set of builtins.  */
   if (!optimize
       && !called_as_built_in (fndecl)
-      && DECL_ASSEMBLER_NAME_SET_P (fndecl)
       && fcode != BUILT_IN_ALLOCA
       && fcode != BUILT_IN_ALLOCA_WITH_ALIGN
       && fcode != BUILT_IN_FREE)
index 66a7e41..2e12bb8 100644 (file)
@@ -1,3 +1,9 @@
+2012-02-09  Bin Cheng  <bin.cheng@arm.com>
+
+       PR middle-end/51867
+       * testsuite/c-c++-common/dfp/signbit-2.c: Change '-O0' to '-O1'.
+       * testsuite/gcc.dg/pr51867.c: New test.
+
 2012-02-09  Ian Lance Taylor  <iant@google.com>
 
        * go.test/go-test.exp (go-gc-tests): Don't run stack.go on systems
index e51bf91..5444d8f 100644 (file)
@@ -1,7 +1,10 @@
-/* { dg-options "-O0" } */
+/* { dg-options "-O1" } */
 
 /* Check that the compiler uses builtins for signbit; if not the link
    will fail because library functions are in libm.  */
+/* See PR51867.
+   Since GCC uses library call when optimizing for "-O0", this test
+   case requires at least "-O1" level optimization now.  */
 
 #include "dfp-dbg.h"
 
diff --git a/gcc/testsuite/gcc.dg/pr51867.c b/gcc/testsuite/gcc.dg/pr51867.c
new file mode 100644 (file)
index 0000000..3f1016e
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -fno-math-errno -fdump-rtl-expand" } */
+#include <math.h>
+
+float a(float x)
+{
+    return sqrtf(x);
+}
+float b(float x)
+{
+    return sqrtf(x);
+}
+/* Here the calls to sqrtf should be expanded into CALL_INSNs, rather than
+   fpu sqrtf rtl patterns.  */
+/* { dg-final { scan-rtl-dump-times "call_insn" 2 "expand" } } */
+/* { dg-final { cleanup-rtl-dump "expand" } } */