--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=znver3" } */
+
+extern "C" double pow(double, double);
+double sigmoid_x;
+double sigmoid() {
+ if (sigmoid_x)
+ return sigmoid_x;
+ return 0;
+}
+double der_sigmoid() {
+ double tmp = sigmoid();
+ return tmp - pow(tmp, 2);
+}
+
--- /dev/null
+/* PR middle-end/123826 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+#ifdef __NO_MATH_ERRNO__
+int main() { return 0; }
+#else
+#include <errno.h>
+#include <float.h>
+#include <math.h>
+
+double foo(double x)
+{
+ return x + pow(x, 2.0);
+}
+
+int main()
+{
+#ifdef math_errhandling
+#ifdef MATH_ERRNO
+ if ((math_errhandling & MATH_ERRNO) == 0)
+ return 0;
+#else
+ if ((math_errhandling & 1) == 0)
+ return 0;
+#endif
+#endif
+
+ errno = 0;
+ double x = foo(DBL_MAX);
+ if (errno != ERANGE)
+ __builtin_abort ();
+ return 0;
+}
+#endif
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=znver3" } */
+
+float fnk00xX_rae1_1;
+double pow(double, double);
+double sqrt(double);
+void write_r4(float *);
+void fnk00xX() {
+ int i;
+ float rs2;
+ double ds2;
+ for (; i; i += 1) {
+ sqrt(i);
+ ds2 = ds2 + pow(fnk00xX_rae1_1, 2.0);
+ rs2 = ds2;
+ }
+ write_r4(&rs2);
+}
{
switch (gimple_call_combined_fn (stmt))
{
- CASE_CFN_POW:
- if (gimple_call_lhs (stmt)
- && TREE_CODE (gimple_call_arg (stmt, 1)) == REAL_CST
- && real_equal (&TREE_REAL_CST (gimple_call_arg (stmt, 1)),
- &dconst2)
- && convert_mult_to_fma (stmt,
- gimple_call_arg (stmt, 0),
- gimple_call_arg (stmt, 0),
- &fma_state))
- {
- unlink_stmt_vdef (stmt);
- if (gsi_remove (&gsi, true)
- && gimple_purge_dead_eh_edges (bb))
- *m_cfg_changed_p = true;
- release_defs (stmt);
- continue;
- }
- break;
-
case CFN_COND_MUL:
if (convert_mult_to_fma (stmt,
gimple_call_arg (stmt, 1),