===================================================================
@@ -5745,10 +5745,12 @@
return targetm.expand_builtin (exp, target, subtarget, mode, ignore);
/* When not optimizing, generate calls to library functions for a certain
- set of builtins. */
+ set of builtins.
+
+ See PR51867.
+ Don't check "DECL_ASSEMBLER_NAME_SET_P (fndecl)" here any more. */
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)
===================================================================
@@ -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" } } */
===================================================================
@@ -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"