summaryrefslogtreecommitdiff
path: root/gcc/fortran/simplify.c
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-02 03:52:05 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-02 03:52:05 +0000
commit72a81e55421a2af798db69a896a5f86c34e56554 (patch)
tree408921fa9a67315131afa2c70e4eaade2e8ff08b /gcc/fortran/simplify.c
parent193f80d0e09d402ca5d3d95f49aedcf907fc86ac (diff)
downloadgcc-72a81e55421a2af798db69a896a5f86c34e56554.tar.gz
PR fortran/33197
* gfortran.h (HAVE_mpc_arc): Define. * simplify.c (gfc_simplify_acos): Handle complex acos. (gfc_simplify_acosh): Likewise for acosh. (gfc_simplify_asin): Likewise for asin. (gfc_simplify_asinh): Likewise for asinh. (gfc_simplify_atan): Likewise for atan. (gfc_simplify_atanh): Likewise for atanh. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152394 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r--gcc/fortran/simplify.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index a22dd00c2d8..9856b2eabbd 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -745,16 +745,21 @@ gfc_simplify_acos (gfc_expr *x)
&x->where);
return &gfc_bad_expr;
}
+ result = gfc_constant_result (x->ts.type, x->ts.kind, &x->where);
+ mpfr_acos (result->value.real, x->value.real, GFC_RND_MODE);
break;
case BT_COMPLEX:
+#ifdef HAVE_mpc_arc
+ result = gfc_constant_result (x->ts.type, x->ts.kind, &x->where);
+ mpc_acos (result->value.complex, x->value.complex, GFC_MPC_RND_MODE);
+ break;
+#else
return NULL;
+#endif
default:
gfc_internal_error ("in gfc_simplify_acos(): Bad type");
}
- result = gfc_constant_result (x->ts.type, x->ts.kind, &x->where);
-
- mpfr_acos (result->value.real, x->value.real, GFC_RND_MODE);
return range_check (result, "ACOS");
}
@@ -781,7 +786,13 @@ gfc_simplify_acosh (gfc_expr *x)
mpfr_acosh (result->value.real, x->value.real, GFC_RND_MODE);
break;
case BT_COMPLEX:
+#ifdef HAVE_mpc_arc
+ result = gfc_constant_result (x->ts.type, x->ts.kind, &x->where);
+ mpc_acosh (result->value.complex, x->value.complex, GFC_MPC_RND_MODE);
+ break;
+#else
return NULL;
+#endif
default:
gfc_internal_error ("in gfc_simplify_acosh(): Bad type");
}
@@ -1043,7 +1054,13 @@ gfc_simplify_asin (gfc_expr *x)
mpfr_asin (result->value.real, x->value.real, GFC_RND_MODE);
break;
case BT_COMPLEX:
+#ifdef HAVE_mpc_arc
+ result = gfc_constant_result (x->ts.type, x->ts.kind, &x->where);
+ mpc_asin (result->value.complex, x->value.complex, GFC_MPC_RND_MODE);
+ break;
+#else
return NULL;
+#endif
default:
gfc_internal_error ("in gfc_simplify_asin(): Bad type");
}
@@ -1067,7 +1084,13 @@ gfc_simplify_asinh (gfc_expr *x)
mpfr_asinh (result->value.real, x->value.real, GFC_RND_MODE);
break;
case BT_COMPLEX:
+#ifdef HAVE_mpc_arc
+ result = gfc_constant_result (x->ts.type, x->ts.kind, &x->where);
+ mpc_asinh (result->value.complex, x->value.complex, GFC_MPC_RND_MODE);
+ break;
+#else
return NULL;
+#endif
default:
gfc_internal_error ("in gfc_simplify_asinh(): Bad type");
}
@@ -1091,7 +1114,13 @@ gfc_simplify_atan (gfc_expr *x)
mpfr_atan (result->value.real, x->value.real, GFC_RND_MODE);
break;
case BT_COMPLEX:
+#ifdef HAVE_mpc_arc
+ result = gfc_constant_result (x->ts.type, x->ts.kind, &x->where);
+ mpc_atan (result->value.complex, x->value.complex, GFC_MPC_RND_MODE);
+ break;
+#else
return NULL;
+#endif
default:
gfc_internal_error ("in gfc_simplify_atan(): Bad type");
}
@@ -1123,7 +1152,13 @@ gfc_simplify_atanh (gfc_expr *x)
mpfr_atanh (result->value.real, x->value.real, GFC_RND_MODE);
break;
case BT_COMPLEX:
+#ifdef HAVE_mpc_arc
+ result = gfc_constant_result (x->ts.type, x->ts.kind, &x->where);
+ mpc_atanh (result->value.complex, x->value.complex, GFC_MPC_RND_MODE);
+ break;
+#else
return NULL;
+#endif
default:
gfc_internal_error ("in gfc_simplify_atanh(): Bad type");
}