diff options
Diffstat (limited to 'gcc/fortran/frontend-passes.c')
-rw-r--r-- | gcc/fortran/frontend-passes.c | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 9fa50ee..91d216b 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -1863,84 +1863,6 @@ combine_array_constructor (gfc_expr *e) return true; } -/* Change (-1)**k into 1-ishift(iand(k,1),1) and - 2**k into ishift(1,k) */ - -static bool -optimize_power (gfc_expr *e) -{ - gfc_expr *op1, *op2; - gfc_expr *iand, *ishft; - - if (e->ts.type != BT_INTEGER) - return false; - - op1 = e->value.op.op1; - - if (op1 == NULL || op1->expr_type != EXPR_CONSTANT) - return false; - - if (mpz_cmp_si (op1->value.integer, -1L) == 0) - { - gfc_free_expr (op1); - - op2 = e->value.op.op2; - - if (op2 == NULL) - return false; - - iand = gfc_build_intrinsic_call (current_ns, GFC_ISYM_IAND, - "_internal_iand", e->where, 2, op2, - gfc_get_int_expr (e->ts.kind, - &e->where, 1)); - - ishft = gfc_build_intrinsic_call (current_ns, GFC_ISYM_ISHFT, - "_internal_ishft", e->where, 2, iand, - gfc_get_int_expr (e->ts.kind, - &e->where, 1)); - - e->value.op.op = INTRINSIC_MINUS; - e->value.op.op1 = gfc_get_int_expr (e->ts.kind, &e->where, 1); - e->value.op.op2 = ishft; - return true; - } - else if (mpz_cmp_si (op1->value.integer, 2L) == 0) - { - gfc_free_expr (op1); - - op2 = e->value.op.op2; - if (op2 == NULL) - return false; - - ishft = gfc_build_intrinsic_call (current_ns, GFC_ISYM_ISHFT, - "_internal_ishft", e->where, 2, - gfc_get_int_expr (e->ts.kind, - &e->where, 1), - op2); - *e = *ishft; - return true; - } - - else if (mpz_cmp_si (op1->value.integer, 1L) == 0) - { - op2 = e->value.op.op2; - if (op2 == NULL) - return false; - - gfc_free_expr (op1); - gfc_free_expr (op2); - - e->expr_type = EXPR_CONSTANT; - e->value.op.op1 = NULL; - e->value.op.op2 = NULL; - mpz_init_set_si (e->value.integer, 1); - /* Typespec and location are still OK. */ - return true; - } - - return false; -} - /* Recursive optimization of operators. */ static bool @@ -2001,9 +1923,6 @@ optimize_op (gfc_expr *e) case INTRINSIC_DIVIDE: return combine_array_constructor (e) || changed; - case INTRINSIC_POWER: - return optimize_power (e); - default: break; } |