--- gcc/tree-call-cdce.cc.jj	2022-10-31 09:04:56.484075098 +0100
+++ gcc/tree-call-cdce.cc	2022-11-07 14:51:54.223803618 +0100
@@ -693,20 +693,31 @@ get_no_error_domain (enum built_in_funct
     {
     /* Trig functions: return [-1, +1]  */
     CASE_FLT_FN (BUILT_IN_ACOS):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_ACOS):
     CASE_FLT_FN (BUILT_IN_ASIN):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_ASIN):
       return get_domain (-1, true, true,
                          1, true, true);
     /* Hyperbolic functions.  */
     CASE_FLT_FN (BUILT_IN_ACOSH):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_ACOSH):
       /* acosh: [1, +inf)  */
       return get_domain (1, true, true,
                          1, false, false);
     CASE_FLT_FN (BUILT_IN_ATANH):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_ATANH):
       /* atanh: (-1, +1)  */
       return get_domain (-1, true, false,
                          1, true, false);
+    case BUILT_IN_COSHF16:
+    case BUILT_IN_SINHF16:
+      /* coshf16: (-11, +11)  */
+      return get_domain (-11, true, false,
+			 11, true, false);
     case BUILT_IN_COSHF:
     case BUILT_IN_SINHF:
+    case BUILT_IN_COSHF32:
+    case BUILT_IN_SINHF32:
       /* coshf: (-89, +89)  */
       return get_domain (-89, true, false,
                          89, true, false);
@@ -714,21 +725,39 @@ get_no_error_domain (enum built_in_funct
     case BUILT_IN_SINH:
     case BUILT_IN_COSHL:
     case BUILT_IN_SINHL:
+    case BUILT_IN_COSHF64:
+    case BUILT_IN_SINHF64:
       /* cosh: (-710, +710)  */
       return get_domain (-710, true, false,
                          710, true, false);
+    case BUILT_IN_COSHF128:
+    case BUILT_IN_SINHF128:
+      /* coshf128: (-11357, +11357)  */
+      return get_domain (-11357, true, false,
+			 11357, true, false);
     /* Log functions: (0, +inf)  */
     CASE_FLT_FN (BUILT_IN_LOG):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG):
     CASE_FLT_FN (BUILT_IN_LOG2):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG2):
     CASE_FLT_FN (BUILT_IN_LOG10):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG10):
       return get_domain (0, true, false,
                          0, false, false);
     CASE_FLT_FN (BUILT_IN_LOG1P):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG1P):
       return get_domain (-1, true, false,
                          0, false, false);
     /* Exp functions.  */
+    case BUILT_IN_EXPF16:
+    case BUILT_IN_EXPM1F16:
+      /* expf: (-inf, 11)  */
+      return get_domain (-1, false, false,
+			 11, true, false);
     case BUILT_IN_EXPF:
     case BUILT_IN_EXPM1F:
+    case BUILT_IN_EXPF32:
+    case BUILT_IN_EXPM1F32:
       /* expf: (-inf, 88)  */
       return get_domain (-1, false, false,
                          88, true, false);
@@ -736,18 +765,35 @@ get_no_error_domain (enum built_in_funct
     case BUILT_IN_EXPM1:
     case BUILT_IN_EXPL:
     case BUILT_IN_EXPM1L:
+    case BUILT_IN_EXPF64:
+    case BUILT_IN_EXPM1F64:
       /* exp: (-inf, 709)  */
       return get_domain (-1, false, false,
                          709, true, false);
+    case BUILT_IN_EXPF128:
+    case BUILT_IN_EXPM1F128:
+      /* expf128: (-inf, 11356)  */
+      return get_domain (-1, false, false,
+			 11356, true, false);
+    case BUILT_IN_EXP2F16:
+      /* exp2f16: (-inf, 16)  */
+      return get_domain (-1, false, false,
+			 16, true, false);
     case BUILT_IN_EXP2F:
+    case BUILT_IN_EXP2F32:
       /* exp2f: (-inf, 128)  */
       return get_domain (-1, false, false,
                          128, true, false);
     case BUILT_IN_EXP2:
     case BUILT_IN_EXP2L:
+    case BUILT_IN_EXP2F64:
       /* exp2: (-inf, 1024)  */
       return get_domain (-1, false, false,
                          1024, true, false);
+    case BUILT_IN_EXP2F128:
+      /* exp2f128: (-inf, 16384)  */
+      return get_domain (-1, false, false,
+			 16384, true, false);
     case BUILT_IN_EXP10F:
     case BUILT_IN_POW10F:
       /* exp10f: (-inf, 38)  */
--- gcc/testsuite/gcc.dg/pr107547.c.jj	2022-11-07 15:01:29.836952863 +0100
+++ gcc/testsuite/gcc.dg/pr107547.c	2022-11-07 15:00:22.878866103 +0100
@@ -0,0 +1,40 @@
+/* PR tree-optimization/107547 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int x;
+
+void
+foo (void)
+{
+#define TEST(...) \
+  __builtin_acos##__VA_ARGS__ (x);	\
+  __builtin_asin##__VA_ARGS__ (x);	\
+  __builtin_acosh##__VA_ARGS__ (x);	\
+  __builtin_atanh##__VA_ARGS__ (x);	\
+  __builtin_cosh##__VA_ARGS__ (x);	\
+  __builtin_sinh##__VA_ARGS__ (x);	\
+  __builtin_log##__VA_ARGS__ (x);	\
+  __builtin_log2##__VA_ARGS__ (x);	\
+  __builtin_log10##__VA_ARGS__ (x);	\
+  __builtin_log1p##__VA_ARGS__ (x);	\
+  __builtin_exp##__VA_ARGS__ (x);	\
+  __builtin_expm1##__VA_ARGS__ (x);	\
+  __builtin_exp2##__VA_ARGS__ (x);	\
+  __builtin_sqrt##__VA_ARGS__ (x)
+  TEST (f);
+  TEST ();
+  TEST (l);
+#ifdef __FLT16_MAX__
+  TEST (f16);
+#endif
+#ifdef __FLT32_MAX__
+  TEST (f32);
+#endif
+#ifdef __FLT64_MAX__
+  TEST (f64);
+#endif
+#ifdef __FLT128_MAX__
+  TEST (f128);
+#endif
+}
